mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for iTunes breaking scripting with version 10.6.3 on OS X. Fixes #1012243 (Cannot connect to update iTunes 10.6.3)
This commit is contained in:
commit
ff80d9c8ce
@ -212,11 +212,8 @@ class ITUNES(DriverBase):
|
||||
"for instructions on using 'Connect to iTunes'")
|
||||
ITUNES_SANDBOX_LOCKOUT_MESSAGE = _(
|
||||
'<p>Unable to communicate with iTunes.</p>'
|
||||
"<p>As of iTunes version 10.6.3, application 'sandboxing' "
|
||||
'was implemented by Apple, disabling inter-application communications '
|
||||
'between iTunes and third-party applications.</p>'
|
||||
'<p>Refer to the forum post '
|
||||
'<a href="http://www.mobileread.com/forums/showpost.php?p=2113958&postcount=3">Apple implements sandboxing for iTunes 10.6.3</a> '
|
||||
'<p>Refer to this '
|
||||
'<a href="http://www.mobileread.com/forums/showpost.php?p=2113958&postcount=3">forum post</a> '
|
||||
'for more information.</p>'
|
||||
'<p></p>')
|
||||
|
||||
@ -232,8 +229,9 @@ class ITUNES(DriverBase):
|
||||
# 0x12a0 iPhone 4S
|
||||
# 0x12a2 iPad2 (GSM)
|
||||
# 0x12a3 iPad2 (CDMA)
|
||||
# 0x12a6 iPad3 (GSM)
|
||||
VENDOR_ID = [0x05ac]
|
||||
PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x129f,0x12a2,0x12a3]
|
||||
PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x129f,0x12a2,0x12a3,0x12a6]
|
||||
BCD = [0x01]
|
||||
|
||||
# Plugboard ID
|
||||
@ -2362,6 +2360,8 @@ class ITUNES(DriverBase):
|
||||
|
||||
if isosx:
|
||||
import appscript
|
||||
as_name = appscript.__name__
|
||||
as_version = appscript.__version__
|
||||
'''
|
||||
Launch iTunes if not already running
|
||||
'''
|
||||
@ -2371,7 +2371,7 @@ class ITUNES(DriverBase):
|
||||
if DEBUG:
|
||||
logger().info( "ITUNES:_launch_iTunes(): Launching iTunes" )
|
||||
try:
|
||||
self.iTunes = iTunes= appscript.app('iTunes', hide=True)
|
||||
self.iTunes = iTunes = appscript.app('iTunes', hide=True)
|
||||
except:
|
||||
self.iTunes = None
|
||||
raise UserFeedback(' ITUNES._launch_iTunes(): unable to find installed iTunes', details=None, level=UserFeedback.WARN)
|
||||
@ -2383,18 +2383,25 @@ class ITUNES(DriverBase):
|
||||
self.initial_status = 'already running'
|
||||
|
||||
'''
|
||||
Test OSA. If we can't get the app name, we can't talk to iTunes.
|
||||
As of iTunes 10.6.3 (June 2012), sandboxing was implemented disabling OSA
|
||||
interapp communications.
|
||||
Test OSA communication with iTunes.
|
||||
If unable to communicate with iTunes, set self.iTunes to None, then
|
||||
report to user in open()
|
||||
'''
|
||||
as_binding = "dynamic"
|
||||
try:
|
||||
# Try dynamic binding - works with iTunes <= 10.6.1
|
||||
foo = self.iTunes.name()
|
||||
except:
|
||||
# Try static binding
|
||||
import itunes
|
||||
self.iTunes = appscript.app('iTunes',terms=itunes)
|
||||
try:
|
||||
foo = self.iTunes.name()
|
||||
as_binding = "static"
|
||||
except:
|
||||
self.iTunes = None
|
||||
if DEBUG:
|
||||
logger().info(" unable to communicate with iTunes, raising dialog to user")
|
||||
logger().info(" unable to communicate with iTunes via %s %s using any binding" % (as_name, as_version))
|
||||
return
|
||||
|
||||
'''
|
||||
@ -2415,6 +2422,7 @@ class ITUNES(DriverBase):
|
||||
logger().info(" [OSX %s - %s (%s), driver version %d.%d.%d]" %
|
||||
(self.iTunes.name(), self.iTunes.version(), self.initial_status,
|
||||
self.version[0],self.version[1],self.version[2]))
|
||||
logger().info(" communicating with iTunes via %s %s using %s binding" % (as_name, as_version, as_binding))
|
||||
logger().info(" calibre_library_path: %s" % self.calibre_library_path)
|
||||
|
||||
if iswindows:
|
||||
|
Loading…
x
Reference in New Issue
Block a user