mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GwR apple driver wip
This commit is contained in:
parent
ac8c95135b
commit
afe594d5aa
@ -139,23 +139,7 @@ class ITUNES(DevicePlugin):
|
||||
'''
|
||||
# print "ITUNES:can_handle()"
|
||||
if isosx:
|
||||
# Launch iTunes if not already running
|
||||
if not self.iTunes:
|
||||
if self.verbose:
|
||||
print "ITUNES:can_handle(): Instantiating iTunes"
|
||||
running_apps = appscript.app('System Events')
|
||||
if not 'iTunes' in running_apps.processes.name():
|
||||
if self.verbose:
|
||||
print "ITUNES:can_handle(): Launching iTunes"
|
||||
self.iTunes = iTunes= appscript.app('iTunes', hide=True)
|
||||
iTunes.run()
|
||||
if self.verbose:
|
||||
print "%s - %s (launched)" % (self.iTunes.name(), self.iTunes.version())
|
||||
else:
|
||||
self.iTunes = appscript.app('iTunes')
|
||||
if self.verbose:
|
||||
print " %s - %s (already running)" % (self.iTunes.name(), self.iTunes.version())
|
||||
|
||||
if self.iTunes:
|
||||
# Check for connected book-capable device
|
||||
names = [s.name() for s in self.iTunes.sources()]
|
||||
kinds = [str(s.kind()).rpartition('.')[2] for s in self.iTunes.sources()]
|
||||
@ -168,9 +152,12 @@ class ITUNES(DevicePlugin):
|
||||
else:
|
||||
if self.verbose:
|
||||
print "ITUNES.can_handle(): device not connected"
|
||||
self.iTunes = None
|
||||
self.sources = None
|
||||
return False
|
||||
else:
|
||||
# can_handle() is called once before open(), so need to return True
|
||||
# to keep things going
|
||||
print "ITUNES:can_handle(): iTunes not yet instantiated"
|
||||
return True
|
||||
|
||||
def can_handle_windows(self, device_id, debug=False):
|
||||
'''
|
||||
@ -236,7 +223,6 @@ class ITUNES(DevicePlugin):
|
||||
print "ITUNES:delete_books(): Deleting '%s - %s'" % (title, author)
|
||||
self.iTunes.delete(book)
|
||||
|
||||
|
||||
def eject(self):
|
||||
'''
|
||||
Un-mount / eject the device from the OS. This does not check if there
|
||||
@ -294,7 +280,22 @@ class ITUNES(DevicePlugin):
|
||||
this function that should serve as a good example for USB Mass storage
|
||||
devices.
|
||||
'''
|
||||
print "ITUNES.open()"
|
||||
if isosx:
|
||||
# Launch iTunes if not already running
|
||||
if self.verbose:
|
||||
print "ITUNES:open(): Instantiating iTunes"
|
||||
running_apps = appscript.app('System Events')
|
||||
if not 'iTunes' in running_apps.processes.name():
|
||||
if self.verbose:
|
||||
print "ITUNES:open(): Launching iTunes"
|
||||
self.iTunes = iTunes= appscript.app('iTunes', hide=True)
|
||||
iTunes.run()
|
||||
if self.verbose:
|
||||
print "%s - %s (launched)" % (self.iTunes.name(), self.iTunes.version())
|
||||
else:
|
||||
self.iTunes = appscript.app('iTunes')
|
||||
if self.verbose:
|
||||
print " %s - %s (already running)" % (self.iTunes.name(), self.iTunes.version())
|
||||
|
||||
def post_yank_cleanup(self):
|
||||
'''
|
||||
@ -373,7 +374,16 @@ class ITUNES(DevicePlugin):
|
||||
@return: A 3 element list with total space in bytes of (1, 2, 3). If a
|
||||
particular device doesn't have any of these locations it should return 0.
|
||||
"""
|
||||
if self.verbose:
|
||||
print "ITUNES:total_space()"
|
||||
capacity = 0
|
||||
if isosx:
|
||||
if 'iPod' in self.sources:
|
||||
connected_device = self.sources['iPod']
|
||||
capacity = self.iTunes.sources[connected_device].capacity()
|
||||
|
||||
return (capacity,-1,-1)
|
||||
|
||||
|
||||
def upload_books(self, files, names, on_card=None, end_session=True,
|
||||
metadata=None):
|
||||
@ -397,9 +407,6 @@ class ITUNES(DevicePlugin):
|
||||
'''
|
||||
raise NotImplementedError()
|
||||
|
||||
# Private methods
|
||||
|
||||
|
||||
class BookList(list):
|
||||
'''
|
||||
A list of books. Each Book object must have the fields:
|
||||
|
Loading…
x
Reference in New Issue
Block a user