Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-16-2024, 08:25 AM   #1
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 414
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?
xxyzz is offline   Reply With Quote
Old 04-17-2024, 09:00 AM   #2
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 414
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.
xxyzz is offline   Reply With Quote
Advert
Old 04-17-2024, 09:43 AM   #3
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,874
Karma: 22666666
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.
kovidgoyal is online now   Reply With Quote
Old 04-17-2024, 09:55 AM   #4
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 414
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.
xxyzz is offline   Reply With Quote
Old 04-17-2024, 10:17 AM   #5
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,874
Karma: 22666666
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?
kovidgoyal is online now   Reply With Quote
Advert
Old 04-17-2024, 10:32 AM   #6
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 414
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...
xxyzz is offline   Reply With Quote
Old 04-17-2024, 11:00 AM   #7
xxyzz
Evangelist
xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.xxyzz ought to be getting tired of karma fortunes by now.
 
Posts: 414
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.
xxyzz is offline   Reply With Quote
Old 04-17-2024, 11:20 AM   #8
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,874
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you are sending the book file yourself then yes you can use it.
kovidgoyal is online now   Reply With Quote
Old 04-17-2024, 05:36 PM   #9
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
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
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 12:21 PM.


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