def cover(video_type, video_id, title, year): filename = video_id + '.jpg' filename_none = video_id + '.none' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(utility.cover_cache_dir() + filename_none) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) content = search.tmdb(video_type, title, year) if content['total_results'] > 0: content = content['results'][0] try: cover_url = utility.picture_url + content['poster_path'] content_jpg = connect.load_site(cover_url) file_handler = open(cover_file, 'wb') file_handler.write(content_jpg) file_handler.close() except Exception: file_handler = open(cover_file_none, 'wb') file_handler.write('') file_handler.close() pass try: fanart_url = utility.picture_url + content['backdrop_path'] content_jpg = connect.load_site(fanart_url) file_handler = open(fanart_file, 'wb') file_handler.write(content_jpg) file_handler.close() except Exception: pass
def cover(video_type, video_id, title, year): filename = utility.clean_filename(video_id) + '.jpg' filename_none = utility.clean_filename(video_id) + '.none' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(utility.cover_cache_dir() + filename_none) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) content = search.tmdb(video_type, title, year) if content['total_results'] > 0: content = content['results'][0] try: cover_url = utility.picture_url + content['poster_path'] content_jpg = connect.load_site(cover_url) file_handler = open(cover_file, 'wb') file_handler.write(content_jpg) file_handler.close() except Exception: file_handler = open(cover_file_none, 'wb') file_handler.write('') file_handler.close() pass try: fanart_url = utility.picture_url + content['backdrop_path'] content_jpg = connect.load_site(fanart_url) file_handler = open(fanart_file, 'wb') file_handler.write(content_jpg) file_handler.close() except Exception: pass
def trailer(video_type, title): content = search.tmdb(video_type, title) if content['total_results'] > 0: content = content['results'][0] tmdb_id = content['id'] content = search.trailer(video_type, tmdb_id) else: generic_utility.notification(generic_utility.get_string(30305)) content = None return content
def trailer(video_type, title): import search content = search.tmdb(video_type, title) if content["total_results"] > 0: content = content["results"][0] tmdb_id = content["id"] content = search.trailer(video_type, tmdb_id) else: generic_utility.notification(generic_utility.get_string(30305)) content = None return content
def cover_and_fanart(video_type, video_id, title, year): content = search.tmdb(video_type, title, year) if content['total_results'] > 0: content = content['results'][0] poster_path = content['poster_path'] if poster_path: cover_url = generic_utility.picture_url + poster_path cover(video_id, cover_url) backdrop_path = content['backdrop_path'] if backdrop_path: fanart_url = generic_utility.picture_url + backdrop_path fanart(video_id, fanart_url)
def cover_and_fanart(video_type, video_id, title, year): import search content = search.tmdb(video_type, title, year) if content["total_results"] > 0: content = content["results"][0] poster_path = content["poster_path"] if poster_path: cover_url = generic_utility.picture_url + poster_path cover(video_id, cover_url) backdrop_path = content["backdrop_path"] if backdrop_path: fanart_url = generic_utility.picture_url + backdrop_path fanart(video_id, fanart_url)