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, 09: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: 436
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, 10: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: 436
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
Old 04-17-2024, 10: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: 44,657
Karma: 24966646
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 offline   Reply With Quote
Old 04-17-2024, 10: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: 436
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, 11: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: 44,657
Karma: 24966646
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 offline   Reply With Quote
Old 04-17-2024, 11: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: 436
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, 12:00 PM   #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: 436
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, 12:20 PM   #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: 44,657
Karma: 24966646
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 offline   Reply With Quote
Old 04-17-2024, 06: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: 12,099
Karma: 7908993
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 01:19 PM
Shortcut to execute title case, lower case, etc. birkmaggs Library Management 2 10-29-2018 12:42 AM
Kindle Fire giving "invalid MTP path" error Deadser Devices 2 06-29-2017 06:22 PM
lower case to capital tscamera Sigil 12 03-18-2012 11:54 PM
[Bug] Calibre using all lower case path names krunk Calibre 0 05-01-2010 03:58 PM


All times are GMT -4. The time now is 04:58 PM.


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