diff --git a/libpytunes/Library.py b/libpytunes/Library.py index 67748d6..8122c5f 100755 --- a/libpytunes/Library.py +++ b/libpytunes/Library.py @@ -25,10 +25,15 @@ def __init__(self, itunesxml, musicPathXML=None, musicPathSystem=None, filesOnly self.musicPathXML = musicPathXML self.musicPathSystem = musicPathSystem self.filesOnly = filesOnly - self.il = plistlib.readPlist(itunesxml) # Much better support of xml special characters + self.il = Library.plistLoad(self, itunesxml) # Much better support of xml special characters self.songs = {} self.getSongs() + def plistLoad(self, f): + with open(f, 'rb') as fp: + plst = plistlib.load(fp) + return plst + def getSongs(self): format = "%Y-%m-%d %H:%M:%S" for trackid, attributes in self.il['Tracks'].items():