def scanPList(key, outFile): Log.Debug("******* Starting scanPList with an URL of: %s" %(key)) global bScanStatusCount global bScanStatusCountOf global bScanStatus bScanStatusCount = 0 try: # Get playlist type once more playListType = XML.ElementFromURL(key + '?X-Plex-Container-Start=0&X-Plex-Container-Size=0', timeout=float(PMSTIMEOUT)).get('playlistType') Log.Debug('Writing headers for Playlist Export') output.createHeader(outFile, 'playlist', playListType) iCount = bScanStatusCount Log.Debug('Starting to fetch the list of items in this section') myRow = {} if playListType == 'video': playListItems = XML.ElementFromURL(key, timeout=float(PMSTIMEOUT)).xpath('//Video') elif playListType == 'audio': playListItems = XML.ElementFromURL(key, timeout=float(PMSTIMEOUT)).xpath('//Track') elif playListType == 'photo': playListItems = XML.ElementFromURL(key, timeout=float(PMSTIMEOUT)).xpath('//Photo') for playListItem in playListItems: playlists.getPlayListInfo(playListItem, myRow, playListType) output.writerow(myRow) output.closefile() except: Log.Critical("Detected an exception in scanPList") bScanStatus = 99 raise # Dumps the error so you can see what the problem is message = 'All done' oc = ObjectContainer(title1='Playlists', no_cache=True, message=message) oc.add(DirectoryObject(key=Callback(MainMenu), title="Go to the Main Menu")) Log.Debug("******* Ending scanPListDB ***********") return oc
def scanPList(key, playListType, myCSVFile): Log.Debug("******* Starting scanPList with an URL of: %s" %(key)) global bScanStatusCount global bScanStatusCountOf global bScanStatus bScanStatusCount = 0 try: mySepChar = Prefs['Seperator'] Log.Debug('Writing headers for Playlist Export') csvfile = io.open(myCSVFile,'wb') csvwriter = csv.DictWriter(csvfile, fieldnames=playlists.getPlayListHeader(playListType, Prefs['PlayList_Level']), delimiter=Prefs['Delimiter'], quoting=csv.QUOTE_NONNUMERIC) csvwriter.writeheader() iCount = bScanStatusCount Log.Debug('Starting to fetch the list of items in this section') myRow = {} if playListType == 'video': playListItems = XML.ElementFromURL(key, timeout=float(consts.PMSTIMEOUT)).xpath('//Video') elif playListType == 'audio': playListItems = XML.ElementFromURL(key, timeout=float(consts.PMSTIMEOUT)).xpath('//Track') elif playListType == 'photo': playListItems = XML.ElementFromURL(key, timeout=float(consts.PMSTIMEOUT)).xpath('//Photo') for playListItem in playListItems: playlists.getPlayListInfo(playListItem, myRow, playListType) csvwriter.writerow(myRow) except: Log.Critical("Detected an exception in scanPList") bScanStatus = 99 raise # Dumps the error so you can see what the problem is message = 'All done' oc = ObjectContainer(title1='Playlists', no_cache=True, message=message) oc.add(DirectoryObject(key=Callback(MainMenu), title="Go to the Main Menu")) Log.Debug("******* Ending scanPListDB ***********") return oc
def scanPList(key, playListType, myCSVFile): Log.Debug("******* Starting scanPList with an URL of: %s" %(key)) global bScanStatusCount global bScanStatusCountOf global bScanStatus bScanStatusCount = 0 try: mySepChar = Prefs['Seperator'] Log.Debug('Writing headers for Playlist Export') csvfile = io.open(myCSVFile,'wb') csvwriter = csv.DictWriter(csvfile, fieldnames=playlists.getPlayListHeader(playListType, Prefs['PlayList_Level']), delimiter=Prefs['Delimiter'], quoting=csv.QUOTE_NONNUMERIC) csvwriter.writeheader() iCount = bScanStatusCount Log.Debug('Starting to fetch the list of items in this section') myRow = {} if playListType == 'video': playListItems = XML.ElementFromURL(key).xpath('//Video') elif playListType == 'audio': playListItems = XML.ElementFromURL(key).xpath('//Track') elif playListType == 'photo': playListItems = XML.ElementFromURL(key).xpath('//Photo') for playListItem in playListItems: playlists.getPlayListInfo(playListItem, myRow, playListType) csvwriter.writerow(myRow) except: Log.Critical("Detected an exception in scanPList") bScanStatus = 99 raise # Dumps the error so you can see what the problem is message = 'All done' oc = ObjectContainer(title1='Playlists', no_cache=True, message=message) oc.add(DirectoryObject(key=Callback(MainMenu), title="Go to the Main Menu")) Log.Debug("******* Ending scanPListDB ***********") return oc