08-16-2022, 03:11 PM | #1 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
[GUI Plugin] Fork of Quality Check to handle Case Sensitivity
I added an additional function to the Quality Check Plugin which, on windows, renames book paths so that they *case sensitively* match the paths in the Calibre Database.
Plugin can be found here: https://github.com/cbartondock/QualityCheckFork |
08-16-2022, 08:14 PM | #2 | |
Connoisseur
Posts: 88
Karma: 1133066
Join Date: Sep 2007
Device: ipaq
|
Quote:
|
|
Advert | |
|
08-16-2022, 09:11 PM | #3 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
The point is that the calibre db might store the path as "...\Author Name\Book Title\xyz.pdf" whereas it shows up in file explorer on windows as "...\author name\book Title\xyz.pdf"
As you say, on Windows this doesn't matter at all - the file system isn't case sensitive. But it does store the case in the filename. The problem comes if you want to transfer your library folder to a Linux machine, or even worse if you want to keep it synced to a library folder on a Linux machine. In this case the Linux machine will pick up the same database as on windows, but suddenly the case will matter because the Linux file system is case sensitive. The result is that half your books get messed up in the move. This plug-in resolves this issue by guaranteeing that if a database path resolves in windows then it will match the windows path *exactly*, not just up to case, and hence would resolve on a Linux machine also. Last edited by cbartondock; 08-16-2022 at 09:16 PM. |
08-16-2022, 09:14 PM | #4 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
I should add that the plug-in only resolves one direction of the case sensitivity issues for Linux <-> Windows sync. It lets you safely sync from Windows to Linux.
Going the other way though there is no guarantee, since if you add folders on the Linux machine that collide on a case sensitive file system who knows what could go wrong. |
08-17-2022, 10:34 AM | #5 |
Plugin Developer
Posts: 6,317
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
I haven't looked at this plugin in any detail, but it seems to me that this Calibre FAQ applies:
Why doesn’t calibre let me store books in my own folder structure? Changing anything in the library directly is considered a Bad Idea in general. And I don't think this will necessarily work. My (admittedly vague) recollection is that if you give windows a path name in all lowercase or all uppercase, it assumes it is caseless. IE, it only saves case when both upper and lower are present, which isn't always true. That said, it's your computer, do what you want. I would not recommend making this available for everyone, but linking to the github for those savvy enough to understand and use it seems about right to me. |
Advert | |
|
08-17-2022, 10:44 AM | #6 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
It works. I am using it to backup my library to a linux machine and it works brilliantly, without affecting the windows machine (because it can only possibly change the case). The trick (if you look in the code) is to change the name to a temporary name first:
author name -> _author name -> Author Name Again, all its doing is ensuring that if the database path resolves at all then it should case match the actual path. I agree, however, that since it modifies the actual file structure this is an at your own risk tool. I have not had any issues with it and I tested it on a library with >1000 books, but even so. As for the all lower case or all upper case thing, that really never comes up because I don't have any book titles that are entirely lower case or upper case or any authors that are. I suppose it is an edge case to keep in mind though. Last edited by cbartondock; 08-17-2022 at 10:47 AM. |
08-17-2022, 10:50 AM | #7 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
Just checked the all caps thing, what you said isn't true at least not on Windows 11.
|
08-17-2022, 04:46 PM | #8 |
Chalut o/
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
|
Um, I think it would be more relevant to suggest this feature as native to Calibre in "library maintenance".
If anything is going to affect the structure of your library it should be Calibre. Yes, Windows doesn't have this problem, but if one is transferring to a Linux system as presented here, being strict about the case is relevant. |
08-17-2022, 06:09 PM | #9 |
null operator (he/him)
Posts: 20,568
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
FTR : Apple HFS+ & APFS volumes can be configured to be case-sensitive or case-insensitive, IIRC the default is case-insensitive.
Calibre 3M active users - Windows 81.8%, Apple (OS X, MacOS)14.5%, Other (Linux etc) 3.7% BR |
08-20-2022, 08:29 AM | #10 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
I mean frankly the entire quality check plugin is so useful that it should be merged into mainline, but I digress. As it is what my function does is sort of one step further than quality check's "Check and rename book paths" so it felt natural to keep it in the plugin.
|
08-20-2022, 10:29 PM | #11 |
creator of calibre
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre already does not care about case. If a file with the exact case is not found, it will list the directory contents and use the first file with the appropriate file extension, automatically correcting the the case as well.
See the function format_abspath in backend.py |
08-21-2022, 12:24 AM | #12 |
Junior Member
Posts: 8
Karma: 10
Join Date: Aug 2022
Device: Onyx Boox
|
But it does care about the case of the author and book directory no? That's what my addendum to the plugin fixes, so that their cases agree with what is in the DB.
|
Tags |
fork, gui plugin, quality check |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Quality Check | kiwidude | Plugins | 1184 | 04-17-2024 06:17 PM |
[GUI Plugin] Check Books | thiago.eec | Plugins | 33 | 04-08-2024 03:00 PM |
[GUI Plugin] Quality Check Trie title avec "de la " | Doum | Assistance | 4 | 01-18-2021 10:50 AM |
'Find Next' with Quality Check plugin | Frizzell | Library Management | 1 | 10-31-2017 06:23 AM |
Removing Case Sensitivity | Talung | Calibre | 7 | 02-05-2009 01:41 AM |