mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When automatically sending news to device, send to main memory preferentially, if it has enough space. Fixes #8877 (Nook magazine default will not reset to main memory after setting to Card A)
This commit is contained in:
parent
bdd690df12
commit
806f6d7425
@ -1026,6 +1026,17 @@ class DeviceMixin(object): # {{{
|
||||
self.location_manager.free[1] : 'carda',
|
||||
self.location_manager.free[2] : 'cardb' }
|
||||
on_card = space.get(sorted(space.keys(), reverse=True)[0], None)
|
||||
try:
|
||||
total_size = sum([os.stat(f).st_size for f in files])
|
||||
except:
|
||||
try:
|
||||
traceback.print_exc()
|
||||
except:
|
||||
pass
|
||||
total_size = self.location_manager.free[0]
|
||||
if self.location_manager.free[0] > total_size + (1024**2):
|
||||
# Send news to main memory if enough space available
|
||||
on_card = None
|
||||
self.upload_books(files, names, metadata,
|
||||
on_card=on_card,
|
||||
memory=[files, remove])
|
||||
|
Loading…
x
Reference in New Issue
Block a user