mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nook driver: Put files in NOOK/Books instead of NOOK/My Files on recent nook devices so they are all listed in one place in the NOOK UI. See #1990730 (books saved in wrong directory on nook 4e)
This commit is contained in:
parent
67bcfac6b7
commit
6c4f3d85ab
@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
Device driver for Barns and Nobel's Nook
|
Device driver for Barns and Nobel's Nook
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import io, os, errno
|
import io, os
|
||||||
|
|
||||||
from calibre import fsync, prints
|
from calibre import fsync, prints
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
@ -105,13 +105,12 @@ class NOOK_COLOR(NOOK):
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
prints('Opened NOOK with product id:', product_id)
|
prints('Opened NOOK with product id:', product_id)
|
||||||
if product_id >= 0xb:
|
if product_id >= 0xb:
|
||||||
|
self.EBOOK_DIR_MAIN = 'NOOK/Books' if product_id >= 0xd else 'NOOK/My Files'
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
prints('Setting Nook upload directory to NOOK/My Files')
|
prints(f'Setting Nook upload directory to {self.EBOOK_DIR_MAIN}')
|
||||||
self.EBOOK_DIR_MAIN = 'NOOK/My Files'
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.join(self._main_prefix, *self.EBOOK_DIR_MAIN.split('/')))
|
os.makedirs(os.path.join(self._main_prefix, *self.EBOOK_DIR_MAIN.split('/')), exist_ok=True)
|
||||||
except OSError as err:
|
except OSError:
|
||||||
if err.errno != errno.EEXIST:
|
|
||||||
self.EBOOK_DIR_MAIN = 'NOOK'
|
self.EBOOK_DIR_MAIN = 'NOOK'
|
||||||
|
|
||||||
def get_carda_ebook_dir(self, for_upload=False):
|
def get_carda_ebook_dir(self, for_upload=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user