Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 08-16-2022, 03:11 PM   #1
cbartondock
Junior Member
cbartondock began at the beginning.
 
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
cbartondock is offline   Reply With Quote
Old 08-16-2022, 08:14 PM   #2
jmurphy
Connoisseur
jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.jmurphy ought to be getting tired of karma fortunes by now.
 
Posts: 88
Karma: 1133066
Join Date: Sep 2007
Device: ipaq
Quote:
Originally Posted by cbartondock View Post
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
I'm not sure I understand. Windows is case insensitive, it is not possible to have two folders or files at the same level that differ only by case and it doesn't matter what case you use to access a file/folder.
jmurphy is offline   Reply With Quote
Advert
Old 08-16-2022, 09:11 PM   #3
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Old 08-16-2022, 09:14 PM   #4
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Old 08-17-2022, 10:34 AM   #5
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
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.
JimmXinu is offline   Reply With Quote
Advert
Old 08-17-2022, 10:44 AM   #6
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Old 08-17-2022, 10:50 AM   #7
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Old 08-17-2022, 04:46 PM   #8
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
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.
un_pogaz is offline   Reply With Quote
Old 08-17-2022, 06:09 PM   #9
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
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
BetterRed is offline   Reply With Quote
Old 08-20-2022, 08:29 AM   #10
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Old 08-20-2022, 10:29 PM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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
kovidgoyal is offline   Reply With Quote
Old 08-21-2022, 12:24 AM   #12
cbartondock
Junior Member
cbartondock began at the beginning.
 
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.
cbartondock is offline   Reply With Quote
Reply

Tags
fork, gui plugin, quality check


Forum Jump

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


All times are GMT -4. The time now is 08:47 PM.


MobileRead.com is a privately owned, operated and funded community.