na-- / ebook-tools

Shell scripts for organizing and managing ebook collections
GNU General Public License v3.0
721 stars 69 forks source link

ERROR on lines 136 and 313 #23

Open FMusic opened 3 years ago

FMusic commented 3 years ago

Hello, For runinng:

sudo ./organize-ebooks.sh -o=/media/storage/certain --organize--without--isbn 
--output-folder-uncertain=/media/storage/uncertain 
--output-folder-corrupt=/media/storage/corrupt 
-ofp=/media/storage/pamphlets --keep-metadata 
--output-filename-template='"${d[AUTHORS]// & /, }/${d[AUTHORS]// & /, } - ${d[SERIES]:+ [${d[SERIES]//:/ -}] - }
${d[TITLE]//:/ -}${d[PUBLISHED]:+ (${d[PUBLISHED]%%-*})}${d[ISBN]:+ [${d[ISBN]}]}.${d[EXT]}"' .

I get this:

ERROR on line 136 ./organize-ebooks.sh!
ERROR on line 313 ./organize-ebooks.sh!

I am running this on wsl ubuntu and with mounted hard drive. Installation of deps went easily.

FMusic commented 3 years ago

When I set verbose: sudo ./organize-ebooks.sh -v -o=/media/storage/certa in --organize--without--isbn --output-folder-uncertain=/media/storage/uncertain --output-folder-corrupt= /media/storage/corrupt -ofp=/media/storage/pamphlets --keep-metadata --output-filename-template='"${d[AU THORS]// & /, }/${d[AUTHORS]// & /, } - ${d[SERIES]:+[${d[SERIES]//:/ -}] - }${d[TITLE]//:/ -}${d[PUBLIS HED]:+ (${d[PUBLISHED]%%-*})}${d[ISBN]:+ [${d[ISBN]}]}.${d[EXT]}"' .

https://pastebin.com/Q7gStBSe this is what I get

weetabix commented 3 years ago

I too am getting a similar, or identical, issue:

~/git/ebook-tools/organize-ebooks.sh -sl -km -v -ocr=true -owi --pamphlet-max-filesize-kb=50 -o=../.ORGANIZED/ -ofu=../.ORGANIZED ./A*

[./Aaron A..(2010) [9780345519535].opf] Variables that will be used for the new filename construction: [./Aaron A..(2010) [9780345519535].opf] BTITLE Backlash: Star Wars Legends (Fate of the Jedi)_nAuthor(s) : Aaron Allston_nPublisher [./Aaron A..(2010) [9780345519535].opf] EXT opf [./Aaron A..(2010) [9780345519535].opf] METADATA_SOURCE Google [./Aaron A..(2010) [9780345519535].opf] OLD_FILE_PATH ._Aaron Allston - Backlash - Star Wars Legends (Fate of the Jedi) (2010) [9780345519535].opf [./Aaron A..(2010) [9780345519535].opf] ALL_FOUND_ISBNS 9780345519535 [./Aaron A..(2010) [9780345519535].opf] ISBN 9780345519535 [./Aaron A..(2010) [9780345519535].opf] /home/weetabix/git/ebook-tools/lib.sh: line 682: d[AUTHORS]: unbound variable [./Aaron A..(2010) [9780345519535].opf] ERROR on line 682 /home/weetabix/git/ebook-tools/lib.sh! [./Aaron A..(2010) [9780345519535].opf] ERROR on line 136 /home/weetabix/git/ebook-tools/organize-ebooks.sh! ERROR on line 313 /home/weetabix/git/ebook-tools/organize-ebooks.sh!

weetabix commented 3 years ago

Solved. Reinstall Calibre, and the Extract ISBN and Goodreads plugins. I do not understand what broke, but this resolved my issue. Please let me know if it fixes yours.

Christopher-Dauchter commented 3 years ago

I only had the error on line 313. Following @weetabix advice I re-installed Calibre, then the Goodreads Plugin, then the WorldCat xISBN plugin and everything worked again. Thanks mate 👍

Bonscha commented 10 months ago

I have the "on line 313" issue as well. I tried reinstalling calibre and both plugins, but it seems the plugins cannot be installed.

calibre-customize -l doesn't show them at least

What I have done:

root@raspberrypi:/home/pi# apt remove calibre
[...]
root@raspberrypi:/home/pi# apt-get install calibre
[...]
root@raspberrypi:/home/pi# calibre-customize -a "/etc/ebooktools/Goodreads.zip"
Plugin added: Goodreads (1, 7, 9)
root@raspberrypi:/home/pi# calibre-customize -a "/etc/ebooktools/xisbn.zip"
Plugin added: WorldCat xISBN (1, 0, 0)
root@raspberrypi:/home/pi# /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh -oft='"${d[AUTHORS]// & /, }/${d[AUTHORS]// & /, } - ${d[SERIES]:+[${d[SERIES]//:/ -}] - }${d[TITLE]//:/ -}${d[PUBLISHED]:+ (${d[PUBLISHED]%%-*})}${d[ISBN]:+ [${d[ISBN]}]}.${d[EXT]}"' -owi -owis=Goodreads,Amazon.de,Google -ofu=/media/devmon/sda1-usb-USB_DISK-0:0-par/uncertain -o=/media/devmon/sda1-usb-USB_DISK-0:0-par/output /media/devmon/sda1-usb-USB_DISK-0:0-par/A
ERROR on line 313 /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh!
root@raspberrypi:/home/pi# 

Any ideas? Did I do something wrong in the installing/uninstalling?

edit:

I forgot to enable the plugins... Did that with:

root@raspberrypi:/home/pi# calibre-customize --enable-plugin Goodreads
root@raspberrypi:/home/pi# calibre-customize --enable-plugin WorldCat xISBN

Script keeps failing, here is the verbose output of when it fails:

root@raspberrypi:/home/pi# /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh -v -oft='"${d[AUTHORS]// & /, }/${d[AUTHORS]// & /, } - ${d[SERIES]:+[${d[SERIES]//:/ -}] - }${d[TITLE]//:/ -}${d[PUBLISHED]:+ (${d[PUBLISHED]%%-*})}${d[ISBN]:+ [${d[ISBN]}]}.${d[EXT]}"' -owi -owis=Goodreads,Amazon.de,Google -ofu=/media/devmon/sda1-usb-USB_DISK-0:0-par/uncertain -o=/media/devmon/sda1-usb-USB_DISK-0:0-par/output /media/devmon/sda1-usb-USB_DISK-0:0-par/A
Recursively scanning '/media/devmon/sda1-usb-USB_DISK-0:0-par/A' for files
[/media/de..rians Stammesvampiren.epub] Testing '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Adrian, Lara - Midnight Breed - Alles über die Welt von Lara Adrians Stammesvampiren.epub' for corruption...
[/media/de..rians Stammesvampiren.epub] The file has a '.epub' extension, testing with 7z...
[/media/de..rians Stammesvampiren.epub] File passed the corruption test, looking for ISBNs...
[/media/de..rians Stammesvampiren.epub] Searching file '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Adrian, Lara - Midnight Breed - Alles über die Welt von Lara Adrians Stammesvampiren.epub' for ISBN numbers...
[/media/de..rians Stammesvampiren.epub] Ebook MIME type: application/epub+zip
[/media/de..rians Stammesvampiren.epub] Traceback (most recent call last):
[/media/de..rians Stammesvampiren.epub]   File "/usr/bin/ebook-meta", line 21, in <module>
[/media/de..rians Stammesvampiren.epub]     sys.exit(main())
[/media/de..rians Stammesvampiren.epub]              ^^^^^^
[/media/de..rians Stammesvampiren.epub]   File "/usr/lib/calibre/calibre/ebooks/metadata/cli.py", line 184, in main
[/media/de..rians Stammesvampiren.epub]     with open(path, 'rb') as stream:
[/media/de..rians Stammesvampiren.epub]          ^^^^^^^^^^^^^^^^
[/media/de..rians Stammesvampiren.epub] FileNotFoundError: [Errno 2] No such file or directory: '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Adrian, Lara - Midnight Breed - Alles über die Welt von Lara Adrians Stammesvampiren.epub'
[/media/de..rians Stammesvampiren.epub] ERROR on line 549 /etc/ebooktools/ebook-tools-0.5.1/lib.sh!
[/media/de..rians Stammesvampiren.epub] ERROR on line 549 /etc/ebooktools/ebook-tools-0.5.1/lib.sh!
[/media/de..rians Stammesvampiren.epub] ERROR on line 296 /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh!
ERROR on line 313 /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh!

It seems to have a problem with "ü", when I delete that file, the script seems to run fine... until it finds another Umlaut, i assume. Can I fix this somehow?

edit2;

Another log, this time no Umlaut involved, but a rather long string of weird numbers in the "series" output.

[...]
[/media/de..d der schwarze Moench.epub] [fetch-meta-title] The identify phase took 4.04 seconds
[/media/de..d der schwarze Moench.epub] [fetch-meta-title] The longest time (3.995544) was taken by: Goodreads
[/media/de..d der schwarze Moench.epub] [fetch-meta-title] Merging results from different sources
[/media/de..d der schwarze Moench.epub] [fetch-meta-title] We have 1 merged results, merging took: 0.00 seconds
[/media/de..d der schwarze Moench.epub] [fetch-meta-title] 
[/media/de..d der schwarze Moench.epub] Successfully fetched metadata: 
[/media/de..d der schwarze Moench.epub] [meta-title] Title               : Pelagia Und Der Schwarze Mönch
[/media/de..d der schwarze Moench.epub] [meta-title] Author(s)           : Boris Akunin
[/media/de..d der schwarze Moench.epub] [meta-title] Publisher           : Goldmann Verlag
[/media/de..d der schwarze Moench.epub] [meta-title] Tags                : Mystery, Historical, Crime, Thriller
[/media/de..d der schwarze Moench.epub] [meta-title] Series              : Приключения Пелагии (серия
[/media/de..d der schwarze Moench.epub] [meta-title]    «Провинціальный детективъ») #2
[/media/de..d der schwarze Moench.epub] [meta-title] Languages           : deu
[/media/de..d der schwarze Moench.epub] [meta-title] Rating              : 2
[/media/de..d der schwarze Moench.epub] [meta-title] Published           : 2001-01-01T08:00:00+00:00
[/media/de..d der schwarze Moench.epub] [meta-title] Identifiers         : goodreads:2180464, amazon:3442455006, isbn:9783442455003
[/media/de..d der schwarze Moench.epub] [meta-title] Comments            : <p>Ein geheimnisvoller schwarzer Mönch, den man nachts über einen See
[/media/de..d der schwarze Moench.epub] [meta-title]    wandeln sieht, versetzt ein russisches Provinzstädtchen in Angst und Schrecken. Die Mönche
[/media/de..d der schwarze Moench.epub] [meta-title]    eines nahe gelegenen Klosters halten die Erscheinung für eine Reinkarnation des heiligen
[/media/de..d der schwarze Moench.epub] [meta-title]    Vasilisk und bitten ihren Erzbischof um Hilfe. Drei Männer enden in Wahnsinn und Tod,
[/media/de..d der schwarze Moench.epub] [meta-title]    bis Pelagia, als Novize verkleidet, dem Spuk ein Ende bereitet ...  </p>
[/media/de..d der schwarze Moench.epub] Addding additional metadata to the end of the metadata file...
[/media/de..d der schwarze Moench.epub] grep: character code point value in \x{} or \o{} is too large
[/media/de..d der schwarze Moench.epub] Organizing '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Akunin, Boris - Pelagia 2 - Pelagia und der schwarze Moench.epub' (with '/tmp/tmp.LSu1PbamX0.txt')...
[/media/de..d der schwarze Moench.epub] Variables that will be used for the new filename construction:
[/media/de..d der schwarze Moench.epub]     AUTHORS              Boris Akunin
[/media/de..d der schwarze Moench.epub]     TAGS                 Mystery, Historical, Crime, Thriller
[/media/de..d der schwarze Moench.epub]     OF_BOOK_PRODUCER     calibre (0.9.22) [http:__calibre-ebook.com]
[/media/de..d der schwarze Moench.epub]     TITLE                Pelagia Und Der Schwarze Mönch
[/media/de..d der schwarze Moench.epub]     OF_AUTHORS           Boris Akunin [Akunin, Boris]
[/media/de..d der schwarze Moench.epub]     PUBLISHER            Goldmann Verlag
[/media/de..d der schwarze Moench.epub]     OF_TITLE             Pelagia und der schwarze Moench
[/media/de..d der schwarze Moench.epub]     PUBLISHED            2001-01-01T08:00:00+00:00
[/media/de..d der schwarze Moench.epub]     IDENTIFIERS          goodreads:2180464, amazon:3442455006, isbn:9783442455003
[/media/de..d der schwarze Moench.epub]     OF_TITLE_SORT        Pelagia und der schwarze Moench
[/media/de..d der schwarze Moench.epub]     META_FETCH_METHOD    title
[/media/de..d der schwarze Moench.epub]     OF_PUBLISHED         2013-02-16T23:00:00+00:00
[/media/de..d der schwarze Moench.epub]     RATING               2
[/media/de..d der schwarze Moench.epub]     OF_LANGUAGES         deu
[/media/de..d der schwarze Moench.epub]     SERIES               Приключения Пелагии (серия «Провинціальный детективъ�
[/media/de..d der schwarze Moench.epub]     OF_RATING            
[/media/de..d der schwarze Moench.epub]     LANGUAGES            deu
[/media/de..d der schwarze Moench.epub]     EXT                  epub
[/media/de..d der schwarze Moench.epub]     COMMENTS             _p_Ein geheimnisvoller schwarzer Mönch, den man nachts über einen See wandeln sieht, versetzt ein 
[/media/de..d der schwarze Moench.epub]     OLD_FILE_PATH        _media_devmon_sda1-usb-USB_DISK-0:0-par_A_Akunin, Boris - Pelagia 2 - Pelagia und der schwarze Moenc
[/media/de..d der schwarze Moench.epub]     OF_SERIES            Pelagia #2
[/media/de..d der schwarze Moench.epub] The new file name of the book file/link '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Akunin, Boris - Pelagia 2 - Pelagia und der schwarze Moench.epub' will be: 'Boris Akunin/Boris Akunin - [Приключения Пелагии (серия «Провинціальный детективъ�] - Pelagia Und Der Schwarze Mönch (2001).epub'
[/media/de..d der schwarze Moench.epub] Moving file '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Akunin, Boris - Pelagia 2 - Pelagia und der schwarze Moench.epub' to '/media/devmon/sda1-usb-USB_DISK-0:0-par/uncertain/Boris Akunin/Boris Akunin - [Приключения Пелагии (серия «Провинціальный детективъ�] - Pelagia Und Der Schwarze Mönch (2001).epub'...
[/media/de..d der schwarze Moench.epub] mv: cannot move '/media/devmon/sda1-usb-USB_DISK-0:0-par/A/Akunin, Boris - Pelagia 2 - Pelagia und der schwarze Moench.epub' to a subdirectory of itself, '/media/devmon/sda1-usb-USB_DISK-0:0-par/uncertain/Boris Akunin/Boris Akunin - ['$'\320\237\321\200\320\270\320\272\320\273\321\216\321\207\320\265\320\275\320\270\321\217'' '$'\320\237\320\265\320\273\320\260\320\263\320\270\320\270'' ('$'\321\201\320\265\321\200\320\270\321\217'' '$'\302\253\320\237\321\200\320\276\320\262\320\270\320\275\321\206\321\226\320\260\320\273\321\214\320\275\321\213\320\271'' '$'\320\264\320\265\321\202\320\265\320\272\321\202\320\270\320\262\321\212\302''] - Pelagia Und Der Schwarze M'$'\303\266''nch (2001).epub'
[/media/de..d der schwarze Moench.epub] ERROR on line 639 /etc/ebooktools/ebook-tools-0.5.1/lib.sh!
[/media/de..d der schwarze Moench.epub] ERROR on line 220 /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh!
ERROR on line 313 /etc/ebooktools/ebook-tools-0.5.1/organize-ebooks.sh!