Add a tweak in Preferences->Tweaks to control where news that is automatically uploaded to a reader is sent. Fixes #9427 (Allow user to set default location for news delivery (main memory or storage card))

This commit is contained in:
Kovid Goyal 2011-03-17 12:18:57 -06:00
parent d0d627472f
commit 34569d6cf2
2 changed files with 12 additions and 2 deletions

View File

@ -355,3 +355,11 @@ draw_hidden_section_indicators = True
# large covers
maximum_cover_size = (1200, 1600)
#: Where to send downloaded news
# When automatically sending downloaded news to a connected device, calibre
# will by default send it to the main memory. By changing this tweak, you can
# control where it is sent. Valid values are "main", "carda", "cardb". Note
# that if there isn't enough free space available on the location you choose,
# the files will be sent to the location with the most free space.
send_news_to_device_location = "main"

View File

@ -1052,11 +1052,13 @@ class DeviceMixin(object): # {{{
except:
pass
total_size = self.location_manager.free[0]
if self.location_manager.free[0] > total_size + (1024**2):
loc = tweaks['send_news_to_device_location']
loc_index = {"carda": 1, "cardb": 2}.get(loc, 0)
if self.location_manager.free[loc_index] > total_size + (1024**2):
# Send news to main memory if enough space available
# as some devices like the Nook Color cannot handle
# periodicals on SD cards properly
on_card = None
on_card = loc if loc in ('carda', 'cardb') else None
self.upload_books(files, names, metadata,
on_card=on_card,
memory=[files, remove])