SaveToDisk loses one of identical Authors/Title books

Bug #863472 reported by Alan Smith
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

In calibre 0.8.20 binary install on OSX 10.6.8, books are lost using the Save Template "{author_sort}/{title}/{title} - {authors}" during Save To Disk. In two separate records, if Authors matches Authors AND Title matches Title, one of those records is dropped during the Save To Disk. This happens when 2 or more books have identical Authors and Title combinations, independently of any other fields including IDs. For example, 2 books are both Saved when they have identical ISBN13s and unique Authors or unique Titles; but 2 books are not Saved when Authors/Title combination keys aren't unique even when their ISBN13s are unique. Starson replicated this behavior yesterday; I don't know what platform he was on. Request changes, to at least warn the user of a filename conflict, listing authors/titles of those books that have the filename conflict. Or, automatically assign something unique such as book ID number to the path for those particular files, to avoid the filename conflict. Or give user choice of what to do.

Revision history for this message
Alan Smith (dralans) wrote :

Four books total were attempted to Save, 2 sets of 2 identicals. Only 1 of each set was then available in the OS.
Save template today was "{author_sort}/{title}/{authors} - {series}{series_index:0>2s| | - }{title}".

Here's debugger output:

----

calibre Debug log
calibre 0.8.21
Darwin-10.8.0-x86_64-i386-64bit
Darwin
('Darwin', '10.8.0', 'Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64')
Python 2.7.1
OSX: ('10.6.8', ('', '', ''), 'x86_64')
Starting up...
Started up in 3.66050696373
Worker Launch took: 0.0979180335999
Worker Launch took: 0.0884280204773
Worker Launch took: 0.10520195961
Worker Launch took: 0.109071969986
Job: 1 Save books (0 of 4) finished
Save books (0 of 4)

Job: 1 Save books (0 of 4) finished
Save books (0 of 4)

Job: 3 Save books (2 of 4) finished
Save books (2 of 4)

Job: 2 Save books (1 of 4) finished
Save books (1 of 4)

Job: 4 Save books (3 of 4) finished
Save books (3 of 4)

Job: 1 Save books (0 of 4) finished
Save books (0 of 4)

Job: 3 Save books (2 of 4) finished
Save books (2 of 4)

Job: 2 Save books (1 of 4) finished
Save books (1 of 4)

----

I'll try to attach a screenshot.

Revision history for this message
Alan Smith (dralans) wrote :

Screenshot attached. Shows the selection saved, and the results.

Alan Smith (dralans)
visibility: public → private
Alan Smith (dralans)
information type: Private → Public
Revision history for this message
fenuks (fenuks) wrote :

I have related problem when using option 'Save to disk in a single directory'. If I save several fetched news from single recipe e.g. several Reuters recipes with save template "{author_sort}/{title}/{title} - {authors}" only one recipe will be actually saved to disk. Of course I can change above template ("{author_sort}/{title}/{title} - {authors} ({id})" do the trick), but it's not what I usually want (e.g. for pdf files). It would be useful if calibre have additional template which would be used when filename collision occur or one of other solution to this problem suggested by Alan Smith (bug reporter).

Revision history for this message
Eli Schwartz (eschwartz) wrote :

The most common scenario in which this case might occur would be when someone is updating their save-to-disk folder. I cannot see this changing to bug people about that, nor should multiple copies be saved automatically.

If calibre is overwriting a book with a later book that uses the same calculated template path, the solution is to change the template.

calibre has a powerful template language which is explained here: http://manual.calibre-ebook.com/template_lang.html

In this particular case, I would use the following template fragment in general program mode:

program:

in_list(
 field('Tags'),
 ',',
 'News',
 'save as news',
 'do not save as news'
)

Simply switch out the "save as news" and "do not save as news" for whatever appropriate filename fragment you wish. Presumably, if it is news you would use field('date') which contains the timestamp when the record was added to the library.
And if it isn't news, you would use '' leaving it empty.

This works because all news downloads contain the "News" tag.

For multiple book records with the same author-title set, the other possibility is book duplicates, which are their own problem, and can nevertheless be saved separately by appropriate manual tagging.

Problem solved?

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
Revision history for this message
Kovid Goyal (kovid) wrote :

Note that the fix means that if you save to disk with multiple books selected and two or more of those books end up having the same filename the filename will be adjusted. It does not mean that save to disk will not overwrite existing files from a previous save to disk operation.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.