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:
GRiker 2013-03-03 06:35:38 -08:00
parent 9fa3a1b558
commit 88c150fd2e

View File

@ -20,8 +20,7 @@ from calibre.utils.config import config_dir, dynamic, prefs
from calibre.utils.date import now, parse_date
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):
@ -862,7 +861,6 @@ class ITUNES(DriverBase):
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
'''
if self.iTunes is None:
raise OpenFeedback(self.ITUNES_SANDBOX_LOCKOUT_MESSAGE)
@ -2157,6 +2155,7 @@ class ITUNES(DriverBase):
if 'iPod' in self.sources:
connected_device = self.sources['iPod']
device = self.iTunes.sources[connected_device]
if device.playlists() is not None:
dev_books = None
for pl in device.playlists():
if pl.special_kind() == appscript.k.Books:
@ -2187,7 +2186,7 @@ class ITUNES(DriverBase):
pythoncom.CoInitialize()
connected_device = self.sources['iPod']
device = self.iTunes.sources.ItemByName(connected_device)
if device.Playlists is not None:
dev_books = None
for pl in device.Playlists:
if pl.Kind == self.PlaylistKind.index('User') and \