![]() |
#1 |
Enthusiast
![]() Posts: 28
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
|
Deleting folders without OPF vs recreating OPF files
After a large import, many of the new books did not appear in my library.
The 'Check library' tool, shows many 'Extra titles'. When I look at the Calibre library folder structure in the Finder (I am on Mac OSX), I book folders with proper book files but no opf metadata file. I assume that the missing books, the Extra titles and the folders without opf all correspond to the same thing. Running 'Restore library' did not help. Running 'Add books' again on some original files did bring back their missing books. To get rid of the 'Extra books', I tried 'Moving library to new location', hoping that the folders without opf would be left behind. Unfortunately, they were copied as well. I have two questions: (1) How can I clear a Calibre library folder structure from all folders without opf files, which seem to be parasitic folders since the books they contain do do not appear in the GUI? (2) If such folders cannot be easily removed from within Calibre (ie: without writing my own shell script), is there a way to create or to recreate the opf files? Your answers and recommendations will be greatly appreciated, as they will condition what I do to restore my library. Thanks in advance! W. PS - the following threads discuss similar issues https://www.mobileread.com/forums/sho...d.php?t=255818 https://www.mobileread.com/forums/sho...d.php?t=256497 |
![]() |
![]() |
![]() |
#2 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,681
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@wladdy - have a look at Library Maintenance->Library backup status.
The opf files are created by a low priority background thread, after adding a lot of books I think it may take a while to create the opf files. If you want to hurry things along, quit calibre, and run the calibredb --backup_metadata command. BR |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 28
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
|
Thank you, BetterRed.
'calibredb backup_metadata' does nothing. 'calibredb backup_metadata --all' returns an error message (attached below). In both cases, I get the prompt back way too soon for any significant work to have been accomplished on the Calibre database. Any other ideas would be most welcome. Python function terminated unexpectedly: 'NoneType' object has no attribute 'title' Traceback (most recent call last): File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 209, in main return run_entry_point() File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 114, in run_entry_point return getattr(pmod, func)() File "site-packages/calibre/library/cli.py", line 1554, in main File "site-packages/calibre/library/cli.py", line 1192, in command_backup_metadata File "site-packages/calibre/db/legacy.py", line 355, in dump_metadata File "site-packages/calibre/db/cache.py", line 57, in call_func_with_lock File "site-packages/calibre/db/cache.py", line 1139, in dump_metadata File "site-packages/calibre/library/cli.py", line 1175, in __call__ AttributeError: 'NoneType' object has no attribute 'title' |
![]() |
![]() |
![]() |
#4 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,681
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@wladdy - sorry I can't offer any insight on the error message, other than the obvious. I've only used the command to 'hurry things along' when I've changed something like Publisher that cascaded through '000s of books.
One suggestion (if not already tried) - try using the Copy to Library feature (you may need to add it to a Toolbar) to Move (Copy with delete) all the books in the Book list to a fresh library. That should leave the library with a set of "left over" author/book folders that need "sorting out". First I would remove the old library from calibre (Library->Remove Library), it wont delete anything there, just lose sight of it. Then I would manually deal with the "left over" books - how I did that would depend on how many there were, what files existed and the mood I was in. BR |
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 28
Karma: 10
Join Date: Oct 2010
Device: iPad / Kindle DX
|
I ended up writing the following shell script to identify the folders with no OPF metadata file.
Code:
#!/bin/bash L="" r="/Volumes/Ext/CalibreLibrary/" d=$(find "$r" -type d -mindepth 2 -maxdepth 2) while read p do o=$(find "$p" -name *.opf) if [ -z "$o" ] then L="$L"$'\n'"$p" fi done <<< "$d" echo "$L" > "/Users/wladdy/Desktop/opfless" Code:
#!/bin/bash L="/Users/wladdy/Desktop/opfless" while read p do rm -r "$p" done < $L However, these work well enough as that are. O course, any Mac user interested is welcome to them (just be sure to adapt the pathnames to your own system). Thanks again to BetterRed, who made me realize that the generation of the opf metadate files continues in the background way after the import has finished. Actually, I think that what cause my problems was quitting Calibre and disconnecting the external drive containing my library before the job had ended. Maybe a future version of Calibre could include a warning to neither quit nor eject while the library is being worked on in the background. Anyway, problem solved! Onward to fresh ones... |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
For starters, code indenting and userfriendly variable names would be nice.
![]() You might want to investigate use of the "-exec" flag which tells find to execute commands for each found object. |
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,271
Karma: 27111060
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That error comes from a bug in calibredb (https://github.com/kovidgoyal/calibr...f37952eef31548)
|
![]() |
![]() |
![]() |
#8 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,681
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
But if you're pulling a usb then you should probably make sure there are no calibre processes hanging around before you do so. My Mac fu ain't up to telling you how best to do that ![]() BTW the message from Kovid indicates he has fixed the bug you reported in post #3 - it'll be in the next release BR |
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,392
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
Tags |
extra titles, missing books, opf |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change opf filename from content.opf to title.opf | northstar7 | Sigil | 3 | 09-23-2013 12:44 PM |
TWO OPF files or something like Media Queries in the OPF file for KF8 and MOBI? | DHahn | Kindle Formats | 3 | 04-17-2012 04:06 AM |
OPF files | ajmm | Calibre | 3 | 03-29-2012 12:35 AM |
Can I cut and paste the Calibre opf into the ePub opf? | wannabee | ePub | 0 | 07-12-2011 02:09 AM |
OPF file OPS/package.opf is missing | Run2Eat | ePub | 2 | 05-31-2011 06:52 PM |