mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement #6237 - automatically connect to a folder on startup
This commit is contained in:
parent
e2b093f6ab
commit
0fcf26a113
@ -81,3 +81,11 @@ title_series_sorting = 'library_order'
|
|||||||
# strictly_alphabetic, it would remain "The Client".
|
# strictly_alphabetic, it would remain "The Client".
|
||||||
save_template_title_series_sorting = 'library_order'
|
save_template_title_series_sorting = 'library_order'
|
||||||
|
|
||||||
|
# Specify a folder that calibre should connect to at startup using
|
||||||
|
# connect_to_folder. This must be a full path to the folder. If the folder does
|
||||||
|
# not exist when calibre starts, it is ignored. If there are '\' characters in
|
||||||
|
# the path (such as in Windows paths), you must double them.
|
||||||
|
# Examples:
|
||||||
|
# auto_connect_to_folder = 'C:\\Users\\someone\\Desktop\\testlib'
|
||||||
|
# auto_connect_to_folder = '/home/dropbox/My Dropbox/someone/library'
|
||||||
|
auto_connect_to_folder = ''
|
@ -33,7 +33,7 @@ from calibre.devices.apple.driver import ITUNES_ASYNC
|
|||||||
from calibre.devices.folder_device.driver import FOLDER_DEVICE
|
from calibre.devices.folder_device.driver import FOLDER_DEVICE
|
||||||
from calibre.ebooks.metadata.meta import set_metadata
|
from calibre.ebooks.metadata.meta import set_metadata
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs, tweaks
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@ -613,6 +613,8 @@ class DeviceMixin(object): # {{{
|
|||||||
self.device_manager = DeviceManager(Dispatcher(self.device_detected),
|
self.device_manager = DeviceManager(Dispatcher(self.device_detected),
|
||||||
self.job_manager, Dispatcher(self.status_bar.show_message))
|
self.job_manager, Dispatcher(self.status_bar.show_message))
|
||||||
self.device_manager.start()
|
self.device_manager.start()
|
||||||
|
if tweaks['auto_connect_to_folder']:
|
||||||
|
self.connect_to_folder_named(tweaks['auto_connect_to_folder'])
|
||||||
|
|
||||||
def set_default_thumbnail(self, height):
|
def set_default_thumbnail(self, height):
|
||||||
r = QSvgRenderer(I('book.svg'))
|
r = QSvgRenderer(I('book.svg'))
|
||||||
@ -624,6 +626,11 @@ class DeviceMixin(object): # {{{
|
|||||||
self.default_thumbnail = (pixmap.width(), pixmap.height(),
|
self.default_thumbnail = (pixmap.width(), pixmap.height(),
|
||||||
pixmap_to_data(pixmap))
|
pixmap_to_data(pixmap))
|
||||||
|
|
||||||
|
def connect_to_folder_named(self, dir):
|
||||||
|
if os.path.isdir(dir):
|
||||||
|
kls = FOLDER_DEVICE
|
||||||
|
self.device_manager.mount_device(kls=kls, kind='folder', path=dir)
|
||||||
|
|
||||||
def connect_to_folder(self):
|
def connect_to_folder(self):
|
||||||
dir = choose_dir(self, 'Select Device Folder',
|
dir = choose_dir(self, 'Select Device Folder',
|
||||||
_('Select folder to open as device'))
|
_('Select folder to open as device'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user