marianosimone / epub-thumbnailer

Script to extract the cover of an epub book and create a thumbnail for it
GNU General Public License v3.0
191 stars 29 forks source link

Doesn't work with Muffin window manager and Nemo file manager #26

Closed aritorhamo closed 4 years ago

aritorhamo commented 4 years ago

In Linux Mint 19.2 I get: sh: 1: gnome-shell: not found

It would be nice to have epub thumbnails, but I'm not exited about installing another shell with it's possible problems just for that reason. I'm reporting this anyway, in case it might be useful to developers.

File manager: Nemo Window manager: Muffin Result of the command "ps -A" (tried to attach it as a text file, but the file wasn't accepted by this report system):

_PID TTY TIME CMD 1 ? 00:00:02 systemd 2 ? 00:00:00 kthreadd 4 ? 00:00:00 kworker/0:0H 6 ? 00:00:00 mm_percpu_wq 7 ? 00:00:04 ksoftirqd/0 8 ? 00:00:20 rcu_sched 9 ? 00:00:00 rcu_bh 10 ? 00:00:00 migration/0 11 ? 00:00:00 watchdog/0 12 ? 00:00:00 cpuhp/0 13 ? 00:00:00 cpuhp/1 14 ? 00:00:00 watchdog/1 15 ? 00:00:00 migration/1 16 ? 00:00:02 ksoftirqd/1 18 ? 00:00:00 kworker/1:0H 19 ? 00:00:00 cpuhp/2 20 ? 00:00:00 watchdog/2 21 ? 00:00:00 migration/2 22 ? 00:00:01 ksoftirqd/2 24 ? 00:00:00 kworker/2:0H 25 ? 00:00:00 cpuhp/3 26 ? 00:00:00 watchdog/3 27 ? 00:00:00 migration/3 28 ? 00:00:04 ksoftirqd/3 30 ? 00:00:00 kworker/3:0H 31 ? 00:00:00 kdevtmpfs 32 ? 00:00:00 netns 33 ? 00:00:00 rcu_tasks_kthre 34 ? 00:00:00 kauditd 37 ? 00:00:00 khungtaskd 38 ? 00:00:00 oom_reaper 39 ? 00:00:00 writeback 40 ? 00:00:01 kcompactd0 41 ? 00:00:00 ksmd 42 ? 00:00:00 khugepaged 43 ? 00:00:00 crypto 44 ? 00:00:00 kintegrityd 45 ? 00:00:00 kblockd 46 ? 00:00:00 ata_sff 47 ? 00:00:00 md 48 ? 00:00:00 edac-poller 49 ? 00:00:00 devfreq_wq 50 ? 00:00:00 watchdogd 54 ? 00:02:28 kswapd0 55 ? 00:00:01 kworker/u9:0 56 ? 00:00:00 ecryptfs-kthrea 98 ? 00:00:00 kthrotld 99 ? 00:00:00 acpi_thermal_pm 100 ? 00:00:00 scsi_eh_0 101 ? 00:00:00 scsi_tmf_0 102 ? 00:00:00 scsi_eh_1 103 ? 00:00:00 scsi_tmf_1 105 ? 00:00:00 scsi_eh_2 106 ? 00:00:00 scsi_tmf_2 107 ? 00:00:00 scsi_eh_3 108 ? 00:00:00 scsi_tmf_3 117 ? 00:00:01 kworker/2:1H 118 ? 00:00:00 kworker/1:1H 119 ? 00:00:02 kworker/0:1H 123 ? 00:00:00 ipv6_addrconf 133 ? 00:00:00 kstrp 150 ? 00:00:00 charger_manager 208 ? 00:00:00 scsi_eh_4 209 ? 00:00:00 scsi_tmf_4 210 ? 00:00:00 scsi_eh_5 211 ? 00:00:00 scsi_tmf_5 216 ? 00:00:01 kworker/3:1H 221 ? 00:00:40 kworker/0:2 228 ? 00:00:00 scsi_eh_7 229 ? 00:00:00 scsi_tmf_7 230 ? 00:00:13 usb-storage 352 ? 00:00:00 btrfs-worker 353 ? 00:00:00 btrfs-worker-hi 354 ? 00:00:00 btrfs-delalloc 355 ? 00:00:00 btrfs-flush_del 356 ? 00:00:00 btrfs-cache 357 ? 00:00:00 btrfs-submit 358 ? 00:00:00 btrfs-fixup 359 ? 00:00:00 btrfs-endio 360 ? 00:00:00 btrfs-endio-met 361 ? 00:00:00 btrfs-endio-met 362 ? 00:00:00 btrfs-endio-rai 363 ? 00:00:00 btrfs-endio-rep 364 ? 00:00:00 btrfs-rmw 365 ? 00:00:00 btrfs-endio-wri 366 ? 00:00:00 btrfs-freespace 367 ? 00:00:00 btrfs-delayed-m 368 ? 00:00:00 btrfs-readahead 369 ? 00:00:00 btrfs-qgroup-re 370 ? 00:00:00 btrfs-extent-re 371 ? 00:00:00 btrfs-cleaner 372 ? 00:00:05 btrfs-transacti 413 ? 00:00:03 systemd-journal 424 ? 00:00:00 lvmetad 437 ? 00:00:00 systemd-udevd 592 ? 00:00:00 nv_queue 593 ? 00:00:00 nv_queue 626 ? 00:00:00 nvidia-modeset/ 627 ? 00:00:00 nvidia-modeset/ 655 ? 00:00:00 UVM global queu 657 ? 00:00:00 UVM deferred re 661 ? 00:00:00 UVM Tools Event 717 ? 00:00:00 btrfs-worker 718 ? 00:00:00 btrfs-worker-hi 719 ? 00:00:00 btrfs-delalloc 720 ? 00:00:00 btrfs-flush_del 721 ? 00:00:00 btrfs-cache 722 ? 00:00:00 btrfs-submit 723 ? 00:00:00 btrfs-fixup 724 ? 00:00:00 btrfs-endio 725 ? 00:00:00 btrfs-endio-met 726 ? 00:00:00 btrfs-endio-met 727 ? 00:00:00 btrfs-endio-rai 728 ? 00:00:00 btrfs-endio-rep 729 ? 00:00:00 btrfs-rmw 730 ? 00:00:00 btrfs-endio-wri 731 ? 00:00:00 btrfs-freespace 732 ? 00:00:00 btrfs-delayed-m 733 ? 00:00:00 btrfs-readahead 734 ? 00:00:00 btrfs-qgroup-re 735 ? 00:00:00 btrfs-extent-re 739 ? 00:00:00 btrfs-cleaner 740 ? 00:00:15 btrfs-transacti 754 ? 00:00:00 btrfs-worker 755 ? 00:00:00 btrfs-worker-hi 756 ? 00:00:00 btrfs-delalloc 757 ? 00:00:00 btrfs-flush_del 758 ? 00:00:00 btrfs-cache 759 ? 00:00:00 btrfs-submit 760 ? 00:00:00 btrfs-fixup 761 ? 00:00:00 btrfs-endio 762 ? 00:00:00 btrfs-endio-met 763 ? 00:00:00 btrfs-endio-met 764 ? 00:00:00 btrfs-endio-rai 765 ? 00:00:00 btrfs-endio-rep 766 ? 00:00:00 btrfs-rmw 767 ? 00:00:00 btrfs-endio-wri 768 ? 00:00:00 btrfs-freespace 769 ? 00:00:00 btrfs-delayed-m 770 ? 00:00:00 btrfs-readahead 771 ? 00:00:00 btrfs-qgroup-re 772 ? 00:00:00 btrfs-extent-re 777 ? 00:00:00 btrfs-cleaner 778 ? 00:00:27 btrfs-transacti 832 ? 00:00:00 systemd-timesyn 833 ? 00:00:11 systemd-resolve 911 ? 00:00:00 rsyslogd 913 ? 00:00:00 smartd 915 ? 00:00:00 nvidia-persiste 916 ? 00:00:20 udisksd 918 ? 00:00:00 ModemManager 919 ? 00:00:01 dbus-daemon 926 ? 00:00:01 NetworkManager 929 ? 00:00:00 wpa_supplicant 932 ? 00:00:02 irqbalance 946 ? 00:00:00 avahi-daemon 952 ? 00:00:00 networkd-dispat 953 ? 00:00:00 cron 956 ? 00:00:00 bluetoothd 957 ? 00:00:11 acpid 958 ? 00:00:01 systemd-logind 959 ? 00:00:00 accounts-daemon 971 ? 00:00:00 avahi-daemon 1004 ? 00:00:03 polkitd 1010 ? 00:00:00 kerneloops 1013 ? 00:00:00 kerneloops 1047 ? 00:00:00 lightdm 1058 tty7 01:55:49 Xorg 1059 tty1 00:00:00 agetty 1078 ? 00:10:31 irq/30-nvidia 1079 ? 00:00:00 nvidia 1080 ? 00:00:38 nv_queue 1157 ? 00:00:00 upowerd 1195 ? 00:00:00 dhclient 1200 ? 00:00:00 lightdm 1344 ? 00:00:00 systemd 1345 ? 00:00:00 (sd-pam) 1362 ? 00:00:00 gnome-keyring-d 1365 ? 00:00:04 cinnamon-sessio 1378 ? 00:00:04 dbus-daemon 1429 ? 00:00:00 ssh-agent 1441 ? 00:00:00 at-spi-bus-laun 1446 ? 00:00:00 dbus-daemon 1448 ? 00:00:02 at-spi2-registr 1453 ? 00:00:11 cinnamon-screen 1459 ? 00:00:00 gvfsd 1464 ? 00:00:00 gvfsd-fuse 1483 ? 00:00:01 csd-a11y-keyboa 1484 ? 00:00:01 csd-a11y-settin 1486 ? 00:00:01 csd-automount 1487 ? 00:00:01 csd-background 1488 ? 00:00:01 csd-xsettings 1490 ? 00:00:01 csd-color 1494 ? 00:00:03 csd-housekeepin 1495 ? 00:00:03 csd-keyboard 1496 ? 00:07:58 pulseaudio 1498 ? 00:00:00 rtkit-daemon 1502 ? 00:00:01 csd-cursor 1503 ? 00:00:01 csd-clipboard 1507 ? 00:00:02 csd-media-keys 1510 ? 00:00:01 csd-mouse 1515 ? 00:00:01 csd-orientation 1526 ? 00:00:03 csd-power 1527 ? 00:00:01 csd-print-notif 1532 ? 00:00:02 csd-screensaver 1536 ? 00:00:01 csd-sound 1544 ? 00:00:01 csd-wacom 1546 ? 00:00:01 csd-xrandr 1556 ? 00:00:01 gvfs-udisks2-vo 1558 ? 00:00:00 dconf-service 1578 ? 00:00:00 gvfs-mtp-volume 1583 ? 00:00:00 gvfs-gphoto2-vo 1591 ? 00:00:00 gvfs-goa-volume 1596 ? 00:00:00 csd-printer 1601 ? 00:00:00 goa-daemon 1605 ? 00:00:00 colord 1618 ? 00:00:00 goa-identity-se 1625 ? 00:00:00 gvfs-afc-volume 1639 ? 00:00:00 btrfs-worker 1640 ? 00:00:00 btrfs-worker-hi 1641 ? 00:00:00 btrfs-delalloc 1642 ? 00:00:00 btrfs-flush_del 1643 ? 00:00:00 btrfs-cache 1644 ? 00:00:00 btrfs-submit 1645 ? 00:00:00 btrfs-fixup 1646 ? 00:00:00 btrfs-endio 1647 ? 00:00:00 btrfs-endio-met 1648 ? 00:00:00 btrfs-endio-met 1649 ? 00:00:00 btrfs-endio-rai 1650 ? 00:00:00 btrfs-endio-rep 1651 ? 00:00:00 btrfs-rmw 1652 ? 00:00:00 btrfs-endio-wri 1653 ? 00:00:00 btrfs-freespace 1654 ? 00:00:00 btrfs-delayed-m 1655 ? 00:00:00 btrfs-readahead 1656 ? 00:00:00 btrfs-qgroup-re 1657 ? 00:00:00 btrfs-extent-re 1688 ? 00:00:00 krfcommd 1693 ? 00:00:00 cinnamon-launch 1694 ? 00:40:51 cinnamon 1709 ? 00:00:01 polkit-gnome-au 1725 ? 00:00:04 nemo-desktop 1726 ? 00:00:00 nm-applet 1729 ? 00:00:00 cinnamon-killer 1730 ? 00:00:00 blueberry-obex- 1760 ? 00:00:00 obexd 1764 ? 00:00:00 python3 1776 ? 00:00:00 gvfsd-metadata 1803 ? 00:00:00 gvfsd-trash 1819 ? 00:00:00 blueberry-tray 1831 ? 00:00:00 python3 1832 ? 00:00:00 rfkill 1834 ? 00:00:00 btrfs-cleaner 1835 ? 00:00:36 btrfs-transacti 1856 ? 00:00:01 mintUpdate 2003 ? 00:00:01 applet.py 2046 ? 00:00:00 kworker/u9:5 2048 ? 00:35:08 transmission-gt 2390 ? 00:04:22 thunderbird 2520 ? 03:13:56 firefox 2575 ? 00:24:16 Web Content 2656 ? 00:00:14 WebExtensions 2701 ? 00:20:06 Web Content 2749 ? 00:07:14 Web Content 2773 ? 06:23:32 Web Content 2951 ? 00:00:00 gvfsd-http 3021 ? 00:00:02 sd_dummy 3024 ? 00:00:02 sd_espeak-ng 3030 ? 00:00:03 sdgeneric 3033 ? 00:00:00 speech-dispatch 3426 ? 00:12:02 Web Content 4486 ? 00:00:00 packagekitd 10559 ? 00:32:50 gnome-system-mo 10668 ? 00:00:00 bwrap 10676 ? 00:00:31 kworker/2:1 10677 ? 00:00:00 flatpak-session 10682 ? 00:00:00 xdg-document-po 10685 ? 00:00:00 xdg-permission- 10696 ? 00:00:00 bwrap 10697 ? 00:00:00 flatpak-dbus-pr 10699 ? 00:00:00 bwrap 10700 ? 00:04:55 quodlibet 10721 ? 00:00:00 xdg-desktop-por 10726 ? 00:00:00 sh 10727 ? 00:00:00 pxgsettings 10732 ? 00:00:00 xdg-desktop-por 12628 ? 00:00:27 kworker/1:1 13788 ? 00:05:11 Web Content 13833 ? 00:03:50 Web Content 14272 ? 00:00:00 cupsd 14273 ? 00:00:00 cups-browsed 14691 ? 00:00:23 kworker/3:2 14987 ? 00:00:49 nemo 16171 ? 00:00:00 gconfd-2 17967 ? 00:01:20 RDD Process 18186 ? 00:00:00 kworker/0:1 19659 ? 00:00:03 kworker/u8:8 20994 ? 00:00:00 sh 20995 ? 00:00:00 gvfsd-admin 21137 ? 00:00:12 xed 22109 ? 00:00:01 kworker/u8:4 22193 ? 00:00:38 Web Content 22836 ? 00:00:00 gvfsd-network 22859 ? 00:00:00 gvfsd-dnssd 22913 ? 00:00:00 kworker/3:0 22971 ? 00:00:01 kworker/u8:2 23264 ? 00:00:01 kworker/u8:0 23485 ? 00:00:00 kworker/1:2 23622 ? 00:00:00 kworker/2:0 23731 ? 00:00:00 kworker/u8:3 23822 ? 00:00:01 gnome-terminal- 23829 pts/0 00:00:00 bash 23845 pts/0 00:00:00 dbus-launch 23846 ? 00:00:00 dbus-daemon 23855 ? 00:00:00 gvfsd 23860 ? 00:00:00 gvfsd-fuse 23880 ? 00:00:00 kworker/u8:5 24011 ? 00:00:00 kworker/u8:1 24032 ? 00:00:00 mintreport 24034 ? 00:00:02 mintreport 24133 pts/0 00:00:00 ps

marianosimone commented 4 years ago

Thanks for reporting!

Can you give me some more context on which desktop environment are you using? My guess is that the installation will be one of the "modern" ones, so you'll want to end up in:

https://github.com/marianosimone/epub-thumbnailer/blob/00b0f14f72fd634c3d183ccf0f9f10df59cebb98/install.py#L133-L139

The version guesser is one of the hardest parts (and has grown quite a bit over the years), so if you can try hardcoding the guesser to return 'gnome3' and confirm that it works, I'll probably end up making the installer default to that (it's been years since I've seen changes for older versions, as people transition to newer ones)

aritorhamo commented 4 years ago

Thanks for your reply! The desktop environment I'm using is Cinnamon 4.2.3. I'm not a coder, so I don't know how to make the guesser to return 'gnome3'. I took a look at the code trying to figure that out, but I don't understand enough of what's going on in the code to do that. Should I just replace something in the code with the string 'gnome3', or is it more complicated?

marianosimone commented 4 years ago

Thanks for putting the effort in, even not being a coder :)

Could you please try changing line 123 in install.py?

From:

environment = check_desktop_env()

To:

environment = 'gnome3'
aritorhamo commented 4 years ago

The change you suggested brought the following result:

........................................ Checking dependencies ...

Required dependencies: Python Imaging Library ....... OK

Installing epub-thumbnailer to /usr/bin/ ... Could not install ........................................

Is there anything else I could try?

marianosimone commented 4 years ago

Based on your output, I guess you already have a file named /usr/bin/epub-thumbnailer. One thing that you could try is deleting that file first (probably with something like sudo rm /usr/bin/epub-thumbnailer) and then trying re-installing

aritorhamo commented 4 years ago

I indeed already had that file. Removing it didn't help, though. I still get the result I described in my previous message.

marianosimone commented 4 years ago

Sorry for the delay in the reply... This is very weird. I'd expect that removing the file would at least get you to the next step.

If you:

  1. Delete /usr/bin/epub-thumbnailer (as above. Then verify that it was actually deleted by trying to cat /usr/bin/epub-thumbnailer and getting an error message)
  2. Run the installer (and it fails as above)

Do yo have a file in /usr/bin/epub-thumbnailer again? I'm trying to understand if the problem is in the copying or the file or what.

aritorhamo commented 4 years ago

After re-checking that there's no epub-thumbnailer in /usr/bin, and doing some brainwork, I realised that I need more files from the GitHub page. I was trying to do the installation with install.py only. (I didn't realise that there was a download button for the program – perhaps the word "Clone" on the download button confused me.) I'm sorry about the extra brainwork that my error cost to you.

After downloading the files in src, the installation was partly succesfull. The process gave me only OK's and ended to "You might have to restart your file manager for the thumbnailer to be activated", but I still get no thumbnails for my EPUB files. I tried to delete the thumbnail cache and restarted the system as suggested, but that didn't help. Do you have any ideas what to try next?

marianosimone commented 4 years ago

It's pretty hard for me to debug further without having access to a machine with the particular configuration.

I'm really sorry that this doesn't work for you, and I'm leaving the issue open, in case someone comes looking for the same thing and can help us get a solution

aritorhamo commented 4 years ago

I'm really sorry that this doesn't work for you, and I'm leaving the issue open, in case someone comes looking for the same thing and can help us get a solution

Thanks for trying! I don't know how much it's about the file manager and how much about the operating system and the desktop environment, but I wish that popular distributions would take this matter to their hands and make epub-thumbnailer (or possibly some other method, if for some reason epub-thumbnailer can't be used) a part of the distribution.

cjkr commented 4 years ago

I was finally able to fix the problem with generating epub thumbnails in Linux Mint 19.2. I edited the file /usr/share/thumbnailers/epub.thumbnailer.

I changed the line Exec=/usr/bin/epub-thumbnailer %i %o %s to Exec=/usr/bin/epub-thumbnailer -i %i -o %o -s %s and it worked.

marianosimone commented 4 years ago

thanks for chiming in, @k1pp13. I'm a bit confused by why that would help, though. In theory /usr/bin/epub-thumbnailer is just a copy of epub-thumbnailer.py, which gets its params from argv without doing any smart parsing:

https://github.com/marianosimone/epub-thumbnailer/blob/00b0f14f72fd634c3d183ccf0f9f10df59cebb98/src/epub-thumbnailer.py#L102-L107

mind sharing a bit more of context on that? Thanks!

aritorhamo commented 4 years ago

I was finally able to fix the problem with generating epub thumbnails in Linux Mint 19.2. I edited the file /usr/share/thumbnailers/epub.thumbnailer.

I changed the line Exec=/usr/bin/epub-thumbnailer %i %o %s to Exec=/usr/bin/epub-thumbnailer -i %i -o %o -s %s and it worked.

I gave it a try, but it didn't work for me. My epub-thumbnailer file seems to be a little different from your's, though. Instead of %i %o %s I have %u %o %s. I tried modifying your edited version accordingly, but that didn't change the result.

cjkr commented 4 years ago

I realized that I had tried to install another thumbnailer (gnome-epub-thumbnailer) and this had some prerequisites that are perhaps missing in Linux Mint, while present in Ubuntu. In installed the variants of these packages (as well as their dev files): gdk-pixbuf-2.0 gio-2.0 libarchive libxml-2.0

marianosimone commented 4 years ago

Thanks for the pointer, @k1pp13

Sorry to bother you, @aritorhamo ... but could you try running the thumbnailer as a standalone program to see if there's any problem with the pre-requisites?

You could try something like:

python epub-thumbnailer.py your_epub_fule.epub test.png 50

aritorhamo commented 4 years ago

I'm glad to help. Standalone version seems to work. It produced a small png image of the cover art.

aritorhamo commented 4 years ago

When I tried the standalone version, I realised from an error message, that I was trying to use an HTML version of the epub-thumbnailer file. I changed it to the right one, and got the program to work. It then occured to me to check the file in /usr/bin/. It was an HTML version too (although I thought I avoided that mistake, after making it once before – sigh, sorry for the confusion). I deleted it, and did the installation with the right one, but the program still didn't work. The installation process looked OK, like this:

Installing epub-thumbnailer to /usr/bin/ ... OK Installing thumbnailer hook in /usr/share/thumbnailers ... OK You might have to restart your file manager for the thumbnailer to be activated.

...but still no thumbnails for epub files. Should I perhaps do something more to fully remove the previous installation?

marianosimone commented 4 years ago

At this point, I doubt that the problem is the installation itself (so uninstalling probably won't help) This is now a problem of the environment and/or the file manager. One final hail Mary would be to delete the cache and see if that gets things to start rolling:

rm -rf ~/.cache/thumbnails

Again, I'm really sorry that I can't provide more support on this. I don't currently have access to a linux box.

aritorhamo commented 4 years ago

No problem, thanks for trying. I already tried removing the thumbnail cache, as it's suggested in the installation guide.

I made a feature request about this on the GitHub website of the Nemo project. Let's hope showing EPUB thumbnails will become a normal part of Nemo in the near future.