match = re.search('url *: *(.*?),', tmdbPath) tmdbPath = match.group().replace(",", "").replace( "url: u", "").replace("url: ", "") if tmdbPath.startswith('http'): requestDownload(tmdbPath, MovieFilePath) FanMovieDownload = False except Exception, e: self.logDebug('DownloadArt, tmdbAPI Failed!') pass if FanMovieDownload == True: self.logDebug('DownloadArt, Fanart.TV') try: arttype = arttype.replace('graphical', 'banner').replace( 'folder', 'poster').replace('fanart', 'landscape') fan = str(fanarttv.get_image_list_Movie(id)) file_detail = re.compile("{(.*?)}", re.DOTALL).findall(fan) pref_language = fanarttv.get_abbrev( REAL_SETTINGS.getSetting('limit_preferred_language')) for f in file_detail: languages = re.search("'language' *: *(.*?),", f) art_types = re.search("'art_type' *: *(.*?),", f) fanPaths = re.search("'url' *: *(.*?),", f) if languages and len(languages.group(1)) > 0: language = (languages.group(1)).replace( "u'", '').replace("'", '') if language == pref_language: if art_types and len(art_types.group(1)) > 0: art_type = art_types.group(1).replace(
tmdbPath = match.group().replace(",", "").replace("url: u", "").replace("url: ", "") resource = urllib.urlopen(tmdbPath) output = FileAccess.open(MovieFilePath, 'w') output.write(resource.read()) output.close() return MovieFilePath except Exception,e: FanMovieDownload = True print ('tmdbAPI Failed!') pass else: FanMovieDownload = True if FanMovieDownload == True: ArtType = ArtType.replace('folder', 'poster').replace('fanart', 'moviefanart') fan = fanarttv.get_image_list_Movie(id) try: data = str(fan).replace("[", "").replace("]", "").replace("'", "") data = data.split('}, {') fanPath = str([s for s in data if ArtType in s]).split("', 'art_type: ")[0] match = re.search("url *: *(.*?),", fanPath) fanPath = match.group().replace(",", "").replace("url: u", "").replace("url: ", "") resource = urllib.urlopen(fanPath) output = FileAccess.open(MovieFilePath, 'w') output.write(resource.read()) output.close() return MovieFilePath except Exception,e: print ('FanMovieDownload Failed!') pass
resource = urllib.urlopen(tmdbPath) output = FileAccess.open(MovieFilePath, 'w') output.write(resource.read()) output.close() return MovieFilePath except Exception, e: FanMovieDownload = True print('tmdbAPI Failed!') pass else: FanMovieDownload = True if FanMovieDownload == True: ArtType = ArtType.replace('folder', 'poster').replace( 'fanart', 'moviefanart') fan = fanarttv.get_image_list_Movie(id) print('fan = ' + str(fan)) try: data = str(fan).replace("[", "").replace("]", "").replace("'", "") data = data.split('}, {') fanPath = str([s for s in data if ArtType in s]).split("', 'art_type: ")[0] print('fanPath = ' + fanPath) match = re.search("url *: *(.*?),", fanPath) fanPath = match.group().replace(",", "").replace( "url: u", "").replace("url: ", "") print('fanPath = ' + fanPath) resource = urllib.urlopen(fanPath) output = FileAccess.open(MovieFilePath, 'w')