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'")
|
"for instructions on using 'Connect to iTunes'")
|
||||||
ITUNES_SANDBOX_LOCKOUT_MESSAGE = _(
|
ITUNES_SANDBOX_LOCKOUT_MESSAGE = _(
|
||||||
'<p>Unable to communicate with iTunes.</p>'
|
'<p>Unable to communicate with iTunes.</p>'
|
||||||
"<p>As of iTunes version 10.6.3, application 'sandboxing' "
|
'<p>Refer to this '
|
||||||
'was implemented by Apple, disabling inter-application communications '
|
'<a href="http://www.mobileread.com/forums/showpost.php?p=2113958&postcount=3">forum post</a> '
|
||||||
'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> '
|
|
||||||
'for more information.</p>'
|
'for more information.</p>'
|
||||||
'<p></p>')
|
'<p></p>')
|
||||||
|
|
||||||
@ -232,8 +229,9 @@ class ITUNES(DriverBase):
|
|||||||
# 0x12a0 iPhone 4S
|
# 0x12a0 iPhone 4S
|
||||||
# 0x12a2 iPad2 (GSM)
|
# 0x12a2 iPad2 (GSM)
|
||||||
# 0x12a3 iPad2 (CDMA)
|
# 0x12a3 iPad2 (CDMA)
|
||||||
|
# 0x12a6 iPad3 (GSM)
|
||||||
VENDOR_ID = [0x05ac]
|
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]
|
BCD = [0x01]
|
||||||
|
|
||||||
# Plugboard ID
|
# Plugboard ID
|
||||||
@ -2362,6 +2360,8 @@ class ITUNES(DriverBase):
|
|||||||
|
|
||||||
if isosx:
|
if isosx:
|
||||||
import appscript
|
import appscript
|
||||||
|
as_name = appscript.__name__
|
||||||
|
as_version = appscript.__version__
|
||||||
'''
|
'''
|
||||||
Launch iTunes if not already running
|
Launch iTunes if not already running
|
||||||
'''
|
'''
|
||||||
@ -2383,18 +2383,25 @@ class ITUNES(DriverBase):
|
|||||||
self.initial_status = 'already running'
|
self.initial_status = 'already running'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Test OSA. If we can't get the app name, we can't talk to iTunes.
|
Test OSA communication with iTunes.
|
||||||
As of iTunes 10.6.3 (June 2012), sandboxing was implemented disabling OSA
|
|
||||||
interapp communications.
|
|
||||||
If unable to communicate with iTunes, set self.iTunes to None, then
|
If unable to communicate with iTunes, set self.iTunes to None, then
|
||||||
report to user in open()
|
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:
|
try:
|
||||||
foo = self.iTunes.name()
|
foo = self.iTunes.name()
|
||||||
|
as_binding = "static"
|
||||||
except:
|
except:
|
||||||
self.iTunes = None
|
self.iTunes = None
|
||||||
if DEBUG:
|
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
|
return
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -2415,6 +2422,7 @@ class ITUNES(DriverBase):
|
|||||||
logger().info(" [OSX %s - %s (%s), driver version %d.%d.%d]" %
|
logger().info(" [OSX %s - %s (%s), driver version %d.%d.%d]" %
|
||||||
(self.iTunes.name(), self.iTunes.version(), self.initial_status,
|
(self.iTunes.name(), self.iTunes.version(), self.initial_status,
|
||||||
self.version[0],self.version[1],self.version[2]))
|
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)
|
logger().info(" calibre_library_path: %s" % self.calibre_library_path)
|
||||||
|
|
||||||
if iswindows:
|
if iswindows:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user