Skip to content

Instantly share code, notes, and snippets.

@criztovyl
Last active December 30, 2023 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save criztovyl/e747c099205e7bd609f8a9aef1b80023 to your computer and use it in GitHub Desktop.
Save criztovyl/e747c099205e7bd609f8a9aef1b80023 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# GoKoKo - libgourou kobo koreader
# use libgourou to download epub via ACSM (e.g. from Kobo) and remove Adobe Adept DRM
# to allow reading in your eBook reader app of choice (e.g. KOReader), independent of whether it supports DRM.
sel=$1
if [ ! -f $sel ]; then
echo >&2 non such file $sel
exit 1
fi
gourou=/data/data/com.termux/files/home/libgourou
books=/data/data/com.termux/files/home/storage/shared/Books/
dl=$gourou/utils/acsmdownloader
deadept=$gourou/utils/adept_remove
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$gourou
export ADEPT_DIR=$gourou/.adept
tmp=$(mktemp -d)
$dl $sel -O $tmp
$deadept $tmp/*
fname=$(basename "$(ls $tmp/* | tail -n 1)")
fnew=$(echo -n $fname | tr -c "[:alnum:]_. -" "_")
mv "$tmp/$fname" "$books/$fnew"
rm -rf $tmp
rm -i $sel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment