![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 427
Karma: 2666666
Join Date: Nov 2020
Device: none
|
`gui.book_on_device` returns lower case book path for MTP devices
I'm using the book_on_device function to get book path on device but this function returns lower case path on MTP devices, could this function be updated? Or maybe there is another function I could use to get the correct book path on MTP devices?
|
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 427
Karma: 2666666
Join Date: Nov 2020
Device: none
|
I find the code converts the path to lower case: https://github.com/kovidgoyal/calibr..._cache.py#L177
but I don't know if calibre's developer would accept the change, I hope remove `.lower()` won't break other code. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,260
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That function is definitely not going to be changed. And IIRC paths in MTP are case insensitive.
|
![]() |
![]() |
![]() |
#4 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 427
Karma: 2666666
Join Date: Nov 2020
Device: none
|
Is there another function I could use to get the file name uploaded to mtp device by calibre? A user created an issue at https://github.com/xxyzz/WordDumb/issues/206 says calibre could change the book file name and my code would break using lower case path or the original book file name.
|
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,260
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The lowercased path is what calibre uses as a key. So no there is no other function. WHy do you care if the path is lowercased?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 427
Karma: 2666666
Join Date: Nov 2020
Device: none
|
Because I need to create a ".sdr" folder with the same name as the book file to put Kindle Word Wise file and X-Ray file, use the lower case folder name doesn't work for Kindle...
|
![]() |
![]() |
![]() |
#7 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 427
Karma: 2666666
Join Date: Nov 2020
Device: none
|
The upload book job results contain the correct book file name, I think I could use that value.
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,260
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you are sending the book file yourself then yes you can use it.
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,905
Karma: 7076137
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You can also try using os.path.realpath(lower_case_full_path).
In my tests on Windows 10 it converts an lcase path to the path as it really exists. I didn't try it on an MTP device. Example: Code:
import os.path s = 'c:/users/me' print(os.path.realpath(s)) C:\Users\Me |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Device Driver API for MTP devices (e.g. Kindle Scribe) | tomsem | Development | 2 | 09-24-2023 12:19 PM |
Shortcut to execute title case, lower case, etc. | birkmaggs | Library Management | 2 | 10-28-2018 11:42 PM |
Kindle Fire giving "invalid MTP path" error | Deadser | Devices | 2 | 06-29-2017 05:22 PM |
lower case to capital | tscamera | Sigil | 12 | 03-18-2012 10:54 PM |
[Bug] Calibre using all lower case path names | krunk | Calibre | 0 | 05-01-2010 02:58 PM |