def getShowOnly(myMedia, myRow, level): prefsLevel = Prefs['TV_Level'] if prefsLevel in ['Show Only 1', 'Show Only 2', 'Show Only 3']: for key, value in tvfields.Show_1: element = myMedia.get(value[1:]) if element == None: element = 'N/A' element = misc.WrapStr(misc.fixCRLF(element).encode('utf8')) if key == 'MetaDB Link': myRow[key] = misc.metaDBLink(element) elif key in myRow: myRow[key] = myRow[key] + Prefs['Seperator'] + element else: myRow[key] = element if prefsLevel in ['Show Only 2', 'Show Only 3']: for key, value in tvfields.Show_2: myRow[key] = misc.GetArrayAsString(myMedia, value, default = consts.DEFAULT) # Additional call needed for level 3 if prefsLevel in ['Show Only 3']: directURL = misc.GetLoopBack() + '/library/metadata/' + myRow['Media ID'] directMedia = XML.ElementFromURL(directURL, timeout=float(consts.PMSTIMEOUT)) for key, value in tvfields.Show_3: if key == 'MetaDB Link': myRow[key] = misc.metaDBLink(str(directMedia.xpath('//Directory/@guid'))) else: myRow[key] = misc.GetArrayAsString(directMedia, value, default = consts.DEFAULT) return myRow
def getShowOnly(myMedia, myRow, level): ''' Export TV Show info only ''' if level: prefsLevel = level else: prefsLevel = Prefs['TV_Level'] if prefsLevel in ['Show Only 1', 'Show Only 2', 'Show Only 3']: for key, value in tvfields.Show_1: element = myMedia.get(value[1:]) if element is None: element = consts.DEFAULT element = misc.WrapStr(misc.fixCRLF(element).encode('utf8')) if key == 'MetaDB Link': myRow[key] = misc.metaDBLink(element) # Is it a dateStamp? elif value[1:] in tvfields.dateTimeFields: myRow[key] = misc.ConvertDateStamp(element) elif key in myRow: myRow[key] = myRow[key] + Prefs['Seperator'] + element else: myRow[key] = element if prefsLevel in ['Show Only 2', 'Show Only 3']: for key, value in tvfields.Show_2: myRow[key] = misc.GetArrayAsString(myMedia, value, default=consts.DEFAULT) # Additional call needed for level 3 if prefsLevel in ['Show Only 3']: directURL = misc.GetLoopBack() + '/library/metadata/' + \ myRow['Media ID'] directMedia = XML.ElementFromURL(directURL, timeout=float(consts.PMSTIMEOUT)) for key, value in tvfields.Show_3: if key == 'MetaDB Link': try: myRow[key] = misc.metaDBLink( str(directMedia.xpath('//Directory/@guid'))) except Exception, e: myRow[key] = consts.DEFAULT pass elif key == 'Delete Item Watched after days': try: deleteDays = directMedia.xpath( '//Directory/@autoDeletionItemPolicyWatchedLibrary') if deleteDays == ['100']: deleteDays = 'Next Refresh' elif deleteDays == []: deleteDays = 'Never' elif deleteDays == ['0']: deleteDays = 'Never' elif deleteDays == ['1']: deleteDays = '1 Day' elif deleteDays == ['7']: deleteDays = '7 Days' myRow[key] = deleteDays except Exception, e: myRow[key] = consts.DEFAULT pass
myRow[key] = ''.join( ('https://www.imdb.com/title/', directMedia.xpath(value)[0].split("//")[1])) elif key == 'TMDB Link': if mediaType == 'movie': myRow[key] = ''.join( ('https://www.themoviedb.org/movie/', directMedia.xpath(value)[0].split("//")[1])) else: myRow[key] = ''.join( ('https://www.themoviedb.org/tv/', directMedia.xpath(value)[0].split("//")[1])) elif key == 'TVDB Link': myRow[key] = ''.join( ('This should not show up', directMedia.xpath(value)[0].split("//")[1])) else: myRow[key] = directMedia.xpath(value)[0].split("//")[1] except Exception, e: myRow[key] = consts.DEFAULT pass else: try: myRow[key] = misc.GetArrayAsString(directMedia, value, default=consts.DEFAULT) except Exception, e: myRow[key] = consts.DEFAULT pass return myRow