Perhaps it should go like that:
Code:
# Check if the book was a KFX...
if [ "${last_read_mime}" == "application/x-kfx-ebook" ] ; then
# We want the metadata sidecar file, not the book itself...
last_read_kfx="${last_read_file%.*}.sdr/assets/metadata.kfx"
# Check that it exists...
if [ ! -f "${last_read_kfx}" ] ; then
last_read_kfx = last_read_file
fi
# Use KFX Meta.
...
That is, if the metadata.kfx sidecar does not exist, then pass to the kfxmeta.py the file itself.
Anybody of good will can validate the syntax at least?