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 season(name, url, mode, thumb, series_name, series_id): entries = [] filename = series_id + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) u = sys.argv[0] u += '?url=' + urllib.quote_plus(unicode(url)) u += '&mode=' + mode u += '&series_id=' + urllib.quote_plus(series_id) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={'title': name}) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) entries.append((utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_series_to_library&url=%s&name=%s&series_id=%s)' % ( utility.addon_id, urllib.quote_plus(unicode(url)), urllib.quote_plus(utility.encode(series_name.strip())), series_id))) list_item.addContextMenuItems(entries) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item
def video(name, url, mode, thumb, video_type='', description='', duration='', year='', mpaa='', director='', genre='', rating=0.0, playcount=0, remove=False): entries = [] filename = utility.clean_filename(url) + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) if xbmcvfs.exists(cover_file): thumb = cover_file u = sys.argv[0] u += '?url=' + urllib.quote_plus(url) u += '&mode=' + mode u += '&name=' + urllib.quote_plus(utility.encode(name)) u += '&thumb=' + urllib.quote_plus(thumb) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={'title': name, 'plot': description, 'duration': duration, 'year': int(year), 'mpaa': mpaa, 'director': director, 'genre': genre, 'rating': rating, 'playcount': playcount}) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) if video_type == 'tvshow': if utility.get_setting('browse_tv_shows') == 'true': entries.append((utility.get_string(30151), 'Container.Update(plugin://%s/?mode=play_video_main&url=%s&thumb=%s)' % ( utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(thumb)))) else: entries.append((utility.get_string(30152), 'Container.Update(plugin://%s/?mode=list_seasons&url=%s&thumb=%s)' % ( utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(thumb)))) if video_type != 'episode': entries.append((utility.get_string(30153), 'RunPlugin(plugin://%s/?mode=play_trailer&url=%s&type=%s)' % ( utility.addon_id, urllib.quote_plus(utility.encode(name)), video_type))) if remove: entries.append((utility.get_string(30154), 'RunPlugin(plugin://%s/?mode=remove_from_queue&url=%s)' % ( utility.addon_id, urllib.quote_plus(url)))) else: entries.append((utility.get_string(30155), 'RunPlugin(plugin://%s/?mode=add_to_queue&url=%s)' % ( utility.addon_id, urllib.quote_plus(url)))) entries.append((utility.get_string(30156), 'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=movie)' % ( utility.addon_id, urllib.quote_plus(utility.main_url + '/WiMovie/' + url)))) entries.append((utility.get_string(30157), 'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=tv)' % ( utility.addon_id, urllib.quote_plus(utility.main_url + '/WiMovie/' + url)))) if video_type == 'tvshow': entries.append((utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_series_to_library&url=&name=%s&series_id=%s)' % ( utility.addon_id, urllib.quote_plus(utility.encode(name.strip())), urllib.quote_plus(url)))) elif video_type == 'movie': entries.append((utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_movie_to_library&url=%s&name=%s)' % ( utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(utility.encode(name.strip())) + ' (' + unicode(year) + ')'))) list_item.addContextMenuItems(entries) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item
def season(name, url, mode, thumb, series_name, series_id): entries = [] filename = utility.clean_filename(series_id) + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) u = sys.argv[0] u += '?url=' + urllib.quote_plus(unicode(url)) u += '&mode=' + mode u += '&series_id=' + urllib.quote_plus(series_id) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={'title': name}) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) entries.append((utility.get_string( 30150 ), 'RunPlugin(plugin://%s/?mode=add_series_to_library&url=%s&name=%s&seriesID=%s)' % (utility.addon_id, urllib.quote_plus(unicode(url)), urllib.quote_plus(utility.encode( series_name.strip())), series_id))) list_item.addContextMenuItems(entries) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item
def episode(name, url, mode, thumb, description='', duration='', season_nr='', episode_nr='', series_id='', playcount=''): if duration: duration = unicode(int(duration) * 60) filename = utility.clean_filename(series_id) + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) u = sys.argv[0] u += '?url=' + urllib.quote_plus(unicode(url)) u += '&mode=' + mode u += '&series_id=' + urllib.quote_plus(series_id) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={ 'title': name, 'plot': description, 'duration': duration, 'season': season_nr, 'episode': episode_nr, 'playcount': playcount }) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item
def episode(name, url, mode, thumb, description='', duration='', season_nr='', episode_nr='', series_id='', playcount=0): filename = series_id + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) u = sys.argv[0] u += '?url=' + urllib.quote_plus(unicode(url)) u += '&mode=' + mode u += '&series_id=' + urllib.quote_plus(series_id) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={'title': name, 'plot': description, 'duration': duration, 'season': season_nr, 'episode': episode_nr, 'playcount': playcount}) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item
def video(video_id, title, thumb_url, is_episode, hide_movies, video_type, url): added = False year = '' mpaa = '' duration = '' description = '' director = '' genre = '' rating = 0.0 video_details = get.video_info(video_id) match = re.compile('<span class="title.*?>(.+?)</span', re.DOTALL).findall(video_details) if not title: title = match[0].strip() match = re.compile('<span class="year.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: year = match[0].partition('-')[0] if not thumb_url: match = re.compile('src="(.+?)"', re.DOTALL).findall(video_details) thumb_url = match[0].replace('/webp/', '/images/').replace('.webp', '.jpg') match = re.compile('<span class="mpaaRating.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: mpaa = match[0].strip() match = re.compile('<span class="duration.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: duration = match[0].lower() if duration.split(' ')[-1].startswith('min'): type = 'movie' video_type_temp = type duration = duration.split(' ')[0] else: video_type_temp = 'tv' if is_episode: type = 'episode' else: type = 'tvshow' duration = '' if utility.get_setting('use_tmdb') == 'true': year_temp = year title_temp = title if ' - ' in title_temp: title_temp = title_temp[title_temp.index(' - '):] if '-' in year_temp: year_temp = year_temp.split('-')[0] 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) if not (xbmcvfs.exists(cover_file) or xbmcvfs.exists(cover_file_none)): utility.log( 'Downloading cover art. type: %s, video_id: %s, title: %s, year: %s' % (video_type_temp, video_id, title_temp, year_temp)) get.cover(video_type_temp, video_id, title_temp, year_temp) match = re.compile('src=".+?">.*?<.*?>(.+?)<', re.DOTALL).findall(video_details) if match: description_temp = match[0] # replace all embedded unicode in unicode (Norwegian problem) description_temp = description_temp.replace('u2013', unicode('\u2013')).replace( 'u2026', unicode('\u2026')) description = utility.unescape(description_temp) match = re.compile('Director:</dt><dd>(.+?)<', re.DOTALL).findall(video_details) if match: director = match[0].strip() match = re.compile('<span class="genre.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: genre = match[0] match = re.compile('<span class="rating">(.+?)</span', re.DOTALL).findall(video_details) if len(match) > 0: rating = float(match[0]) title = utility.unescape(title) next_mode = 'play_video_main' if utility.get_setting('browse_tv_shows') == 'true' and type == 'tvshow': next_mode = 'list_seasons' if '/my-list' in url and video_type_temp == video_type: add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, remove=True) added = True elif type == 'movie' and hide_movies: pass elif video_type_temp == video_type or video_type == 'both': add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating) added = True return added
def video(video_id, title, thumb_url, is_episode, hide_movies, video_type, url): added = False director = '' genre = '' playcount = 0 video_details = get.video_info(video_id) match = json.loads(video_details)['value']['videos'][video_id] if not title: title = match['title'] year = match['releaseYear'] if not thumb_url: try: thumb_url = match['boxarts']['_665x375']['jpg']['url'] except Exception: try: thumb_url = match['boxarts']['_342x192']['jpg']['url'] except Exception: thumb_url = utility.addon_fanart() mpaa = match['maturity']['rating']['value'] duration = match['runtime'] offset = match['bookmarkPosition'] try: if (duration > 0 and float(offset) / float(duration)) >= 0.9: playcount = 1 except Exception: pass type = match['summary']['type'] if type == 'movie': video_type_temp = type else: video_type_temp = 'tv' if is_episode: type = 'episode' else: type = 'tvshow' duration = '' if utility.get_setting('use_tmdb') == 'true': 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(utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(utility.cover_cache_dir() + filename_none) if not (xbmcvfs.exists(cover_file) or xbmcvfs.exists(cover_file_none)): utility.log('Downloading cover art. type: %s, video_id: %s, title: %s, year: %s' % (video_type_temp, video_id, title_temp, year_temp)) get.cover(video_type_temp, video_id, title_temp, year_temp) description = match['details']['synopsis'] try: director = match['details']['directors'][0]['name'] except Exception: pass try: genre = match['details']['genres'][0]['name'] except Exception: pass rating = match['userRating']['average'] next_mode = 'play_video_main' if utility.get_setting('browse_tv_shows') == 'true' and type == 'tvshow': next_mode = 'list_seasons' if '/my-list' in url and video_type_temp == video_type: add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, playcount, remove=True) added = True elif type == 'movie' and hide_movies: pass elif video_type_temp == video_type or video_type == 'both': add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, playcount) added = True return added
def video(video_id, title, thumb_url, is_episode, hide_movies, video_type, url): added = False director = '' genre = '' playcount = 0 video_details = get.video_info(video_id) match = json.loads(video_details)['value']['videos'][video_id] if not title: title = match['title'] year = match['releaseYear'] if not thumb_url: try: thumb_url = match['boxarts']['_665x375']['jpg']['url'] except Exception: try: thumb_url = match['boxarts']['_342x192']['jpg']['url'] except Exception: thumb_url = utility.addon_fanart() mpaa = match['maturity']['rating']['value'] duration = match['runtime'] offset = match['bookmarkPosition'] try: if (duration > 0 and float(offset) / float(duration)) >= 0.9: playcount = 1 except Exception: pass type = match['summary']['type'] if type == 'movie': video_type_temp = type else: video_type_temp = 'tv' if is_episode: type = 'episode' else: type = 'tvshow' duration = '' if utility.get_setting('use_tmdb') == 'true': 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(utility.cover_cache_dir() + filename) cover_file_none = xbmc.translatePath(utility.cover_cache_dir() + filename_none) if not (xbmcvfs.exists(cover_file) or xbmcvfs.exists(cover_file_none)): utility.log( 'Downloading cover art. type: %s, video_id: %s, title: %s, year: %s' % (video_type_temp, video_id, title_temp, year_temp)) get.cover(video_type_temp, video_id, title_temp, year_temp) description = match['details']['synopsis'] try: director = match['details']['directors'][0]['name'] except Exception: pass try: genre = match['details']['genres'][0]['name'] except Exception: pass rating = match['userRating']['average'] next_mode = 'play_video_main' if utility.get_setting('browse_tv_shows') == 'true' and type == 'tvshow': next_mode = 'list_seasons' if '/my-list' in url and video_type_temp == video_type: add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, playcount, remove=True) added = True elif type == 'movie' and hide_movies: pass elif video_type_temp == video_type or video_type == 'both': add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, playcount) added = True return added
def video(video_id, title, thumb_url, is_episode, hide_movies, video_type, url): added = False year = '' mpaa = '' duration = '' description = '' director = '' genre = '' rating = 0.0 video_details = get.video_info(video_id) match = re.compile('<span class="title.*?>(.+?)</span', re.DOTALL).findall(video_details) if not title: title = match[0].strip() match = re.compile('<span class="year.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: year = match[0].partition('-')[0] if not thumb_url: match = re.compile('src="(.+?)"', re.DOTALL).findall(video_details) thumb_url = match[0].replace('/webp/', '/images/').replace('.webp', '.jpg') match = re.compile('<span class="mpaaRating.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: mpaa = match[0].strip() match = re.compile('<span class="duration.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: duration = match[0].lower() if duration.split(' ')[-1].startswith('min'): type = 'movie' video_type_temp = type duration = duration.split(' ')[0] else: video_type_temp = 'tv' if is_episode: type = 'episode' else: type = 'tvshow' duration = '' if utility.get_setting('use_tmdb') == 'true': year_temp = year title_temp = title if ' - ' in title_temp: title_temp = title_temp[title_temp.index(' - '):] if '-' in year_temp: year_temp = year_temp.split('-')[0] 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) if not (xbmcvfs.exists(cover_file) or xbmcvfs.exists(cover_file_none)): utility.log('Downloading cover art. type: %s, video_id: %s, title: %s, year: %s' % (video_type_temp, video_id, title_temp, year_temp)) get.cover(video_type_temp, video_id, title_temp, year_temp) match = re.compile('src=".+?">.*?<.*?>(.+?)<', re.DOTALL).findall(video_details) if match: description_temp = match[0] # replace all embedded unicode in unicode (Norwegian problem) description_temp = description_temp.replace('u2013', unicode('\u2013')).replace('u2026', unicode('\u2026')) description = utility.unescape(description_temp) match = re.compile('Director:</dt><dd>(.+?)<', re.DOTALL).findall(video_details) if match: director = match[0].strip() match = re.compile('<span class="genre.*?>(.+?)</span', re.DOTALL).findall(video_details) if match: genre = match[0] match = re.compile('<span class="rating">(.+?)</span', re.DOTALL).findall(video_details) if len(match) > 0: rating = float(match[0]) title = utility.unescape(title) next_mode = 'play_video_main' if utility.get_setting('browse_tv_shows') == 'true' and type == 'tvshow': next_mode = 'list_seasons' if '/my-list' in url and video_type_temp == video_type: add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating, remove=True) added = True elif type == 'movie' and hide_movies: pass elif video_type_temp == video_type or video_type == 'both': add.video(title, video_id, next_mode, thumb_url, type, description, duration, year, mpaa, director, genre, rating) added = True return added
def video(name, url, mode, thumb, video_type='', description='', duration='', year='', mpaa='', director='', genre='', rating=0.0, remove=False): entries = [] if duration: duration = unicode(int(duration) * 60) filename = utility.clean_filename(url) + '.jpg' cover_file = xbmc.translatePath(utility.cover_cache_dir() + filename) fanart_file = xbmc.translatePath(utility.fanart_cache_dir() + filename) if xbmcvfs.exists(cover_file): thumb = cover_file u = sys.argv[0] u += '?url=' + urllib.quote_plus(url) u += '&mode=' + mode u += '&name=' + urllib.quote_plus(utility.encode(name)) u += '&thumb=' + urllib.quote_plus(thumb) list_item = xbmcgui.ListItem(name) list_item.setArt({'icon': 'DefaultTVShows.png', 'thumb': thumb}) list_item.setInfo(type='video', infoLabels={ 'title': name, 'plot': description, 'duration': duration, 'year': int(year), 'mpaa': mpaa, 'director': director, 'genre': genre, 'rating': rating }) if xbmcvfs.exists(fanart_file): list_item.setProperty('fanart_image', fanart_file) elif xbmcvfs.exists(cover_file): list_item.setProperty('fanart_image', cover_file) else: list_item.setProperty('fanart_image', utility.addon_fanart()) if video_type == 'tvshow': if utility.get_setting('browse_tv_shows') == 'true': entries.append((utility.get_string( 30151 ), 'Container.Update(plugin://%s/?mode=play_video_main&url=%s&thumb=%s)' % (utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(thumb)))) else: entries.append((utility.get_string( 30152 ), 'Container.Update(plugin://%s/?mode=list_seasons&url=%s&thumb=%s)' % (utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(thumb)))) if video_type != 'episode': entries.append( (utility.get_string(30153), 'RunPlugin(plugin://%s/?mode=play_trailer&url=%s&type=%s)' % (utility.addon_id, urllib.quote_plus( utility.encode(name)), video_type))) if remove: entries.append( (utility.get_string(30154), 'RunPlugin(plugin://%s/?mode=remove_from_queue&url=%s)' % (utility.addon_id, urllib.quote_plus(url)))) else: entries.append( (utility.get_string(30155), 'RunPlugin(plugin://%s/?mode=add_to_queue&url=%s)' % (utility.addon_id, urllib.quote_plus(url)))) entries.append(( utility.get_string(30156), 'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=movie)' % (utility.addon_id, urllib.quote_plus(utility.main_url + '/WiMovie/' + url)))) entries.append( (utility.get_string(30157), 'Container.Update(plugin://%s/?mode=list_videos&url=%s&type=tv)' % (utility.addon_id, urllib.quote_plus(utility.main_url + '/WiMovie/' + url)))) if video_type == 'tvshow': entries.append( (utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_series_to_library&url=&name=%s' '&seriesID=%s)' % (utility.addon_id, urllib.quote_plus(utility.encode( name.strip())), urllib.quote_plus(url)))) elif video_type == 'movie': entries.append( (utility.get_string(30150), 'RunPlugin(plugin://%s/?mode=add_movie_to_library&url=%s&name=%s)' % (utility.addon_id, urllib.quote_plus(url), urllib.quote_plus(utility.encode(name.strip())) + ' (' + year + ')'))) list_item.addContextMenuItems(entries) directory_item = xbmcplugin.addDirectoryItem(handle=plugin_handle, url=u, listitem=list_item, isFolder=True) return directory_item