blob: 6776c94f72341de85f58a22fa06beb9da6c53234 [file] [log] [blame]
#!/bin/bash
shopt -s lastpipe
epub="$(zenity --file-selection)"
files="$(mktemp -d)"
unzip "$epub" -d "$files"
# get list of xhtml files to display
xhtmls="$(ls "$files"/OEBPS/*.xhtml | xargs -l basename)"
choosepart() {
echo "$xhtmls" | zenity --list --title "epub parts | $epub" \
--text "Choose a part" \
--column "Parts" \
--width 400 --height 400 \
| read part
if [ "$part" = "" ]; then
exit 1
fi
echo part $part
path="$files/OEBPS/$part"
cat "$path" "$(dirname $0)/script.html" > "$path.html"
firefox "$path.html"
}
while choosepart; do
true
done
rm -rf "$files"