mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Added test for no existing playlists in response to lp:1141078. Driver is unable to add books to iTunes if Books playlist doesn't already exist.
This commit is contained in:
parent
9fa3a1b558
commit
88c150fd2e
@ -20,8 +20,7 @@ from calibre.utils.config import config_dir, dynamic, prefs
|
|||||||
from calibre.utils.date import now, parse_date
|
from calibre.utils.date import now, parse_date
|
||||||
from calibre.utils.zipfile import ZipFile
|
from calibre.utils.zipfile import ZipFile
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = CALIBRE_DEBUG
|
||||||
#DEBUG = CALIBRE_DEBUG
|
|
||||||
|
|
||||||
def strftime(fmt='%Y/%m/%d %H:%M:%S', dt=None):
|
def strftime(fmt='%Y/%m/%d %H:%M:%S', dt=None):
|
||||||
|
|
||||||
@ -862,7 +861,6 @@ class ITUNES(DriverBase):
|
|||||||
Note that most of the initialization is necessarily performed in can_handle(), as
|
Note that most of the initialization is necessarily performed in can_handle(), as
|
||||||
we need to talk to iTunes to discover if there's a connected iPod
|
we need to talk to iTunes to discover if there's a connected iPod
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if self.iTunes is None:
|
if self.iTunes is None:
|
||||||
raise OpenFeedback(self.ITUNES_SANDBOX_LOCKOUT_MESSAGE)
|
raise OpenFeedback(self.ITUNES_SANDBOX_LOCKOUT_MESSAGE)
|
||||||
|
|
||||||
@ -2157,6 +2155,7 @@ class ITUNES(DriverBase):
|
|||||||
if 'iPod' in self.sources:
|
if 'iPod' in self.sources:
|
||||||
connected_device = self.sources['iPod']
|
connected_device = self.sources['iPod']
|
||||||
device = self.iTunes.sources[connected_device]
|
device = self.iTunes.sources[connected_device]
|
||||||
|
if device.playlists() is not None:
|
||||||
dev_books = None
|
dev_books = None
|
||||||
for pl in device.playlists():
|
for pl in device.playlists():
|
||||||
if pl.special_kind() == appscript.k.Books:
|
if pl.special_kind() == appscript.k.Books:
|
||||||
@ -2187,7 +2186,7 @@ class ITUNES(DriverBase):
|
|||||||
pythoncom.CoInitialize()
|
pythoncom.CoInitialize()
|
||||||
connected_device = self.sources['iPod']
|
connected_device = self.sources['iPod']
|
||||||
device = self.iTunes.sources.ItemByName(connected_device)
|
device = self.iTunes.sources.ItemByName(connected_device)
|
||||||
|
if device.Playlists is not None:
|
||||||
dev_books = None
|
dev_books = None
|
||||||
for pl in device.Playlists:
|
for pl in device.Playlists:
|
||||||
if pl.Kind == self.PlaylistKind.index('User') and \
|
if pl.Kind == self.PlaylistKind.index('User') and \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user