mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/j-howell/calibre
This commit is contained in:
commit
2e8b8bac6d
@ -425,7 +425,8 @@ class MTP_DEVICE(BASE):
|
|||||||
name = f.name
|
name = f.name
|
||||||
if iswindows:
|
if iswindows:
|
||||||
plen = len(base)
|
plen = len(base)
|
||||||
name = ''.join(shorten_components_to(245-plen, [name]))
|
max_len = 225 if self.is_kindle and path.endswith('.kfx') else 245 # allow for len of additional files
|
||||||
|
name = ''.join(shorten_components_to(max_len-plen, [name]))
|
||||||
with open(os.path.join(base, name), 'wb') as out:
|
with open(os.path.join(base, name), 'wb') as out:
|
||||||
try:
|
try:
|
||||||
self.get_mtp_file(f, out)
|
self.get_mtp_file(f, out)
|
||||||
@ -436,10 +437,10 @@ class MTP_DEVICE(BASE):
|
|||||||
if self.is_kindle and path.endswith('.kfx'):
|
if self.is_kindle and path.endswith('.kfx'):
|
||||||
# copy additional KFX files from the associated .sdr folder
|
# copy additional KFX files from the associated .sdr folder
|
||||||
try:
|
try:
|
||||||
sdr_folder_name = f.name[:-4] + '.sdr'
|
out_folder, out_file = os.path.split(out.name)
|
||||||
new_sdr_path = os.path.join(os.path.split(out.name)[0], sdr_folder_name)
|
new_sdr_path = os.path.join(out_folder, out_file[:-4] + '.sdr')
|
||||||
os.mkdir(new_sdr_path)
|
os.mkdir(new_sdr_path)
|
||||||
self.scan_sdr_for_kfx_files(f.parent, (sdr_folder_name, 'assets'), new_sdr_path)
|
self.scan_sdr_for_kfx_files(f.parent, (f.name[:-4] + '.sdr', 'assets'), new_sdr_path)
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return ans
|
return ans
|
||||||
|
Loading…
x
Reference in New Issue
Block a user