mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GwR revisions wip
This commit is contained in:
parent
7a67294ae7
commit
5cf08b6b52
@ -35,10 +35,39 @@ if iswindows:
|
|||||||
|
|
||||||
class ITUNES(DevicePlugin):
|
class ITUNES(DevicePlugin):
|
||||||
'''
|
'''
|
||||||
try:
|
Calling sequences:
|
||||||
pythoncom.CoInitialize()
|
Initialization:
|
||||||
finally:
|
can_handle() or can_handle_windows()
|
||||||
pythoncom.CoUninitialize()
|
reset()
|
||||||
|
open()
|
||||||
|
card_prefix()
|
||||||
|
can_handle()
|
||||||
|
set_progress_reporter()
|
||||||
|
get_device_information()
|
||||||
|
card_prefix()
|
||||||
|
free_space()
|
||||||
|
(Job 1 Get device information finishes)
|
||||||
|
can_handle()
|
||||||
|
set_progress_reporter()
|
||||||
|
books() (once for each storage point)
|
||||||
|
settings()
|
||||||
|
settings()
|
||||||
|
can_handle() (~1x per second OSX while idle)
|
||||||
|
Delete:
|
||||||
|
delete_books()
|
||||||
|
remove_books_from_metadata()
|
||||||
|
sync_booklists()
|
||||||
|
card_prefix()
|
||||||
|
free_space()
|
||||||
|
Upload:
|
||||||
|
settings()
|
||||||
|
set_progress_reporter()
|
||||||
|
upload_books()
|
||||||
|
add_books_to_metadata()
|
||||||
|
set_progress_reporter()
|
||||||
|
sync_booklists()
|
||||||
|
card_prefix()
|
||||||
|
free_space()
|
||||||
'''
|
'''
|
||||||
|
|
||||||
name = 'Apple device interface'
|
name = 'Apple device interface'
|
||||||
@ -1778,16 +1807,26 @@ class ITUNES(DevicePlugin):
|
|||||||
def _get_sources(self):
|
def _get_sources(self):
|
||||||
'''
|
'''
|
||||||
Return a dict of sources
|
Return a dict of sources
|
||||||
|
Check for >1 iPod device connected to iTunes
|
||||||
'''
|
'''
|
||||||
if isosx:
|
if isosx:
|
||||||
names = [s.name() for s in self.iTunes.sources()]
|
names = [s.name() for s in self.iTunes.sources()]
|
||||||
kinds = [str(s.kind()).rpartition('.')[2] for s in self.iTunes.sources()]
|
kinds = [str(s.kind()).rpartition('.')[2] for s in self.iTunes.sources()]
|
||||||
return dict(zip(kinds,names))
|
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
# Assumes a pythoncom wrapper
|
# Assumes a pythoncom wrapper
|
||||||
it_sources = ['Unknown','Library','iPod','AudioCD','MP3CD','Device','RadioTuner','SharedLibrary']
|
it_sources = ['Unknown','Library','iPod','AudioCD','MP3CD','Device','RadioTuner','SharedLibrary']
|
||||||
names = [s.name for s in self.iTunes.sources]
|
names = [s.name for s in self.iTunes.sources]
|
||||||
kinds = [it_sources[s.kind] for s in self.iTunes.sources]
|
kinds = [it_sources[s.kind] for s in self.iTunes.sources]
|
||||||
|
|
||||||
|
# If more than one connected iDevice, remove all from list to prevent driver initialization
|
||||||
|
if kinds.count('iPod') > 1:
|
||||||
|
if DEBUG:
|
||||||
|
self.log.error(" %d connected iPod devices detected, calibre supports a single connected iDevice" % kinds.count('iPod'))
|
||||||
|
while kinds.count('iPod'):
|
||||||
|
index = kinds.index('iPod')
|
||||||
|
kinds.pop(index)
|
||||||
|
names.pop(index)
|
||||||
|
|
||||||
return dict(zip(kinds,names))
|
return dict(zip(kinds,names))
|
||||||
|
|
||||||
def _is_alpha(self,char):
|
def _is_alpha(self,char):
|
||||||
@ -1931,6 +1970,7 @@ class ITUNES(DevicePlugin):
|
|||||||
self.log.info(" ITUNES._remove_from_iTunes():")
|
self.log.info(" ITUNES._remove_from_iTunes():")
|
||||||
|
|
||||||
if isosx:
|
if isosx:
|
||||||
|
try:
|
||||||
storage_path = os.path.split(cached_book['lib_book'].location().path)
|
storage_path = os.path.split(cached_book['lib_book'].location().path)
|
||||||
if cached_book['lib_book'].location().path.startswith(self.iTunes_media):
|
if cached_book['lib_book'].location().path.startswith(self.iTunes_media):
|
||||||
title_storage_path = storage_path[0]
|
title_storage_path = storage_path[0]
|
||||||
@ -1959,6 +1999,8 @@ class ITUNES(DevicePlugin):
|
|||||||
self.log.info(" '%s' stored external to iTunes, no files deleted" % cached_book['title'])
|
self.log.info(" '%s' stored external to iTunes, no files deleted" % cached_book['title'])
|
||||||
|
|
||||||
self.iTunes.delete(cached_book['lib_book'])
|
self.iTunes.delete(cached_book['lib_book'])
|
||||||
|
except:
|
||||||
|
self.log.warning(" error removing %s from iTunes" % cached_book['title'])
|
||||||
|
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
'''
|
'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user