From 34569d6cf2fae5a97c6156692834deb72aef9118 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Mar 2011 12:18:57 -0600 Subject: [PATCH] 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)) --- resources/default_tweaks.py | 8 ++++++++ src/calibre/gui2/device.py | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 38c1685b7c..464c9d2cfd 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -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" + diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 2cbecc134c..215e67c46f 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -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])