SaveToDisk loses one of identical Authors/Title books

Bug #863472 reported by Alan Smith on 2011-09-30
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
calibre
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.

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.

Alan Smith (dralans) wrote :

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

Alan Smith (dralans) on 2011-10-02
visibility: public → private
Alan Smith (dralans) on 2014-02-21
information type: Private → Public
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).

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?

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
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  Edit
Everyone can see this information.

Other bug subscribers