mvz / alexandria-book-collection-manager

Fork of the Alexandria Book Collection Manager
GNU General Public License v2.0
27 stars 15 forks source link

Picture of book without ISBN disappears after restart #6

Open GuillaumeHM opened 6 years ago

GuillaumeHM commented 6 years ago

When I add a book with a picture and without ISBN field filled, the book with its picture appears in the book list of my_library_1 after clicking on ADD button. If I restart the software, book still appears but without the picture. But the picture file is still in the ~/.alexandria/my_library_1/.

This bug is annoying. My Alexandria version is 0.7.1

Note : there are also pictures of book I deleted from my_library_1 (moved to my_library_2) in the folder. There is also a lot of .cover.orig picture files. I think they appear when I change the picture of a book. There should be a way to clean up all these unneeded files.

Thanks for your help

g-maxime commented 2 years ago

String.hash result isn't the same across run, so cover cannot be retrieved from book.ident

Maybe using Digest::MD5 here?

https://github.com/mvz/alexandria-book-collection-manager/blob/09326dfc35fe5b0dafdc48c7a121565bd66cdba2/lib/alexandria/models/book.rb#L42

mvz commented 2 years ago

Thanks, @g-maxime for figuring this out!