def load_tmdb_cover_fanart(title, video_id, video_type_temp, year): year_temp = year title_temp = title if ' - ' in title_temp: title_temp = title_temp[title_temp.index(' - '):] filename = video_id + '.jpg' filename_none = video_id + '.none' cover_file = xbmc.translatePath(generic_utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(generic_utility.cover_cache_dir() + filename_none) if not (xbmcvfs.exists(cover_file) or xbmcvfs.exists(cover_file_none)): generic_utility.log('Downloading cover art. type: %s, video_id: %s, title: %s, year: %s' % (video_type_temp, video_id, title_temp, year_temp), xbmc.LOGDEBUG) get.cover_and_fanart(video_type_temp, video_id, title_temp, year_temp)
def cover(video_id, cover_url): filename = video_id + '.jpg' filename_none = video_id + '.none' cover_file = xbmc.translatePath(generic_utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(generic_utility.cover_cache_dir() + filename_none) try: content_jpg = connect.load_other_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