10-07-2012, 07:05 AM | #1 |
Connoisseur
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
|
Calibre in mixed case sensitive/insensitive environments
Hi to all!
I use calibre to manage my book collection on an usb disk formatted with ntfs. I need to be able to operate calibre both in windows and linuxes environments. So there are the possibility of issues due to the mixture of case sensitiveness and in sensitiveness and the possibility that adding a book under linux, the same is not accessible under windows due to its 256 character limit for the complete file path. So, according to me, the best way to avoid such problems is: 1) assure that calibre creates directory and files all in upper case 2) assure that the overall length of the file path is no longer than a given value (by opportunely shortening the file name or the name of the directory containing each book or both). I'm not a very skilled python programmer (even if I've done some python programming some time ago) and I don't know how calibre is structured, however I would like to try to modify calibre so that to solve these incompatibility issues. Before starting studying and coding, I would like to know if the proposed approach is feasible for the remaining part of the program or if it risks to break how the library is managed and in case I would like to discuss of alternative ways to solve the issue. Finally if a solution will be found, will it be integrated in the main code? Thank you, Xwang |
10-07-2012, 07:07 AM | #2 |
creator of calibre
Posts: 43,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Why dont you simply use a case insensitive file system for linux? There are various FUSE based alternatives that will do the trick.
|
10-07-2012, 07:21 AM | #3 | |
Connoisseur
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
|
Quote:
I did not known it, but I can verify if it resolves the first part of the problem. The second one (the possibility to create under linux path longer than 256 characters) will remain unsolved (I've encountered such a problem having added a book under linux with a long name created by searching metadata on the net). But this second issue seems to me more important than the previous one. Xwang |
|
10-07-2012, 07:26 AM | #4 |
creator of calibre
Posts: 43,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It's a trivial (one line) patch to limit the filename length in calibre. It's not something I am going to accept into mainline calibre but instructions on running calibre from source are in the user manual, just follow them and make the change in your local copy.
|
10-07-2012, 07:50 AM | #5 | |
Connoisseur
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
|
Quote:
Xwang |
|
10-08-2012, 01:41 PM | #6 |
Connoisseur
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
|
At the end I've decided to try to solve my problem by writing a plugin.
When called it will for each book in the library 1) rename all authors and book title by adding a "special" temporary string at the end 2) rename again authors and title by transforming in upper case and removing the special string 3) check if the path length from the Calibre library is excessively long and eventually rename the title by cutting the last part This approach, if I'm correct, should: a) avoid problems with the alternate use of linux and windows (at the cost of having all authors and titles displayed in upper case; cost which is not a matter to me) b) permit me to avoid any modification to calibre source code (which then I will have to maintain for future releases) Is this approach viable? Any suggestion? Thank you, Xwang PS I've thought that to avoid unuseful renaming for books which have already been "upper cased", perhaps I can first off all compare the upper cased author name and title with the actual path on disk and proceed only if the two strings do not agree. If they agree I can directly pass to the following book. |
08-16-2022, 03:06 PM | #7 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
In case this is helpful to any future person, I developed my own fix to this by forking the Quality Check Plugin and adding an additional function to it: "Check and re-case book paths."
What this does is checks 1) does the database filepath exist and 2) if so does the database filepath differ (in case) from the actual filepath. In the event that it does, the plugin fixes the actual filepath so that it agrees with the filepath that is in the database. The relevant code is in the "check_path_case_match" function of https://github.com/cbartondock/Quali...r/check_fix.py. The plugin can be found at https://github.com/cbartondock/QualityCheckFork |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Case Sensitive Regular Expression | silentguy | Calibre | 5 | 05-11-2015 05:56 AM |
Change uppercase to mixed case | ElMiko | Sigil | 15 | 06-13-2012 07:13 AM |
Debug commands not case sensitive | jmseight | Kindle Developer's Corner | 0 | 04-03-2012 11:11 PM |
Small bug? Case-insensitive tags. | Arrghus | Calibre | 9 | 07-12-2011 01:03 AM |
K3 search case sensitive only? | charonme | Amazon Kindle | 1 | 01-28-2011 05:15 PM |