def list_index(): import xbmc import xbmcaddon import os.path from resources.lib.functions import translate addon_path = xbmc.translatePath( xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode( 'utf-8') add_folder( translate(30001), os.path.join(addon_path, 'resources', 'media', 'highlights.png'), 'mode=highlights&site=index') add_folder(translate(30002), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=plus7') add_folder(translate(30003), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=epg') add_folder(translate(30004), os.path.join(addon_path, 'resources', 'media', 'livetv.png'), 'mode=live-tv') add_folder('Arte Concert', os.path.join(addon_path, 'resources', 'media', 'concert.png'), 'mode=concert') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_tv_dates(language='de'): import xbmc import xbmcaddon import os.path import datetime addon_path = xbmc.translatePath( xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode( 'utf-8') weekdays = (translate(30020), translate(30021), translate(30022), translate(30023), translate(30024), translate(30025), translate(30026)) date = datetime.datetime.now() today = date yesterday = date + datetime.timedelta(days=-1) tomorrow = date + datetime.timedelta(days=1) add_folder(translate(30027), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + yesterday.strftime('%Y-%m-%d')) add_folder(translate(30028), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + today.strftime('%Y-%m-%d')) add_folder(translate(30029), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + tomorrow.strftime('%Y-%m-%d')) date += datetime.timedelta(days=1) for day in range(20): date += datetime.timedelta(days=1) weekday = weekdays[date.weekday()] add_folder('%s, %s' % (weekday, date.strftime('%d.%m.')), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + date.strftime('%Y-%m-%d')) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_index(): import xbmc import xbmcaddon import os.path from resources.lib.functions import translate addon_path = xbmc.translatePath(xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode('utf-8') add_folder(translate(30001), os.path.join(addon_path, 'resources', 'media', 'highlights.png'), 'mode=highlights&site=index') add_folder(translate(30002), os.path.join(addon_path, 'resources', 'media', 'plus7.png') , 'mode=plus7') add_folder(translate(30003), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=epg') add_folder(translate(30004), os.path.join(addon_path, 'resources', 'media', 'livetv.png'), 'mode=live-tv') add_folder('Arte Concert', os.path.join(addon_path, 'resources', 'media', 'concert.png'), 'mode=concert') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_index(): addon_path = xbmc.translatePath(xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode('utf-8') add_folder(translate(30001), os.path.join(addon_path, 'resources', 'media', 'highlights.png'), 'mode=highlights&site=index') add_folder(translate(30002), os.path.join(addon_path, 'resources', 'media', 'plus7.png') , 'mode=plus7') add_folder(translate(30003), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=epg') add_folder(translate(30004), os.path.join(addon_path, 'resources', 'media', 'livetv.png'), 'mode=live-tv') #add_folder('INFO', os.path.join(addon_path, 'resources', 'media', 'info.png'), '') #add_folder('FUTURE', os.path.join(addon_path, 'resources', 'media', 'future.png'), '') #add_folder('CREATIVE', os.path.join(addon_path, 'resources', 'media', 'creative.png'), '') #add_folder('CONCERT', os.path.join(addon_path, 'resources', 'media', 'concert.png'), '') #add_folder('CINEMA', os.path.join(addon_path, 'resources', 'media', 'cinema.png'), '') #add_folder(translate(30005), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=plus7-search') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def play_livestream(language = 'de'): try: api_url = 'http://www.arte.tv/papi/tvguide/videos/livestream/player/%s/' % language[0].upper() try: json_data = urllib2.urlopen(api_url).read() stream_data = json.loads(json_data)['videoJsonPlayer'] except: return -1 # no network title = stream_data['VTI'] try: subtitle = stream_data['VSU'] except: subtitle = '' if subtitle: sep = ' - ' else: subtitle = sep = '' try: desc = stream_data['VDE'] except: desc = '' thumb = stream_data['VTU']['IUR'] try: duration_in_seconds = stream_data['BDS'] except: duration_in_seconds = 0 stream_url = stream_data['VSR']['M3U8_HQ']['url'] try: player_url = stream_data['videoPlayerUrl'] # for playing video from beginning if wished except: player_url = '' bitrate = stream_data['VSR']['M3U8_HQ']['bitrate'] height = stream_data['VSR']['M3U8_HQ']['height'] width = stream_data['VSR']['M3U8_HQ']['width'] item = xbmcgui.ListItem('[B][COLOR fffa481c]LIVE[/COLOR] %s[/B]%s%s' % (title, sep, subtitle), thumbnailImage=thumb) item.setInfo(type='Video', infoLabels={ 'Title' : '%s%s%s' % (title, sep, subtitle), 'Plot' : desc, } ) item.addStreamInfo('video', { 'duration' : duration_in_seconds, 'aspect' : float(width) / height, 'width' : width, 'height' : height, } ) item.addStreamInfo('audio', {'language' : language}) item.setProperty('IsPlayable', 'true') item.setProperty('fanart_image', thumb) if player_url: # add option 'Play from beginning' to context menu import urllib item.addContextMenuItems( [(translate(30014), 'xbmc.RunPlugin(plugin://plugin.video.arte_tv/?mode=play-video&stream=%s&title=%s&thumb=%s)' % (player_url, urllib.quote_plus(title.encode('utf8')), urllib.quote_plus(thumb.encode('utf8')))) ] ) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=stream_url, listitem=item) xbmcplugin.endOfDirectory(int(sys.argv[1])) return True except: return False
def list_index(): import xbmc import xbmcaddon import os.path addon_path = xbmc.translatePath( xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode( 'utf-8') add_folder(translate(30006), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos&recommended=1') add_folder(translate(30007), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos&sort=VIEWS') add_folder(translate(30008), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos') add_folder(translate(30009), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos&sort=LAST_CHANCE') add_folder(translate(30010), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-clusters') add_folder(translate(30011), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-channels') #add_folder(translate(30005), os.path.join(addon_path, 'resources', 'media', 'plus7.png'),'mode=plus7-search&scope=plus7') add_folder(translate(30005), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=plus7-search') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_index(): import xbmc import os.path addon_path = xbmc.translatePath(xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode('utf-8') add_folder(translate(30006), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'highlights', 'recommended') #add_folder(translate(30013), os.path.join(addon_path, 'resources', 'media', 'plus7.png') , 'highlights', 'tv') add_folder('ARTE INFO', os.path.join(addon_path, 'resources', 'media', 'info.png'), 'highlights', 'info') add_folder('ARTE FUTURE', os.path.join(addon_path, 'resources', 'media', 'future.png'), 'highlights', 'future') add_folder('ARTE CREATIVE', os.path.join(addon_path, 'resources', 'media', 'creative.png'), 'highlights', 'creative') add_folder('ARTE CONCERT', os.path.join(addon_path, 'resources', 'media', 'concert.png'), 'highlights', 'concert') add_folder('ARTE CINEMA', os.path.join(addon_path, 'resources', 'media', 'cinema.png'), 'highlights', 'cinema') #add_folder('CULTURE TOUCH', os.path.join(addon_path, 'resources', 'media', 'ctouch.jpg'), 'highlights', 'ctouch') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_index(): import xbmc import xbmcaddon import os.path addon_path = xbmc.translatePath(xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode('utf-8') add_folder(translate(30006), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos&recommended=1') add_folder(translate(30007), os.path.join(addon_path, 'resources', 'media', 'plus7.png') , 'mode=list-videos&sort=VIEWS') add_folder(translate(30008), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos') add_folder(translate(30009), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-videos&sort=LAST_CHANCE') add_folder(translate(30010), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-clusters') add_folder(translate(30011), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-channels') add_folder(translate(30005), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=plus7-search&scope=plus7') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_tv_dates(language = 'de'): import xbmc import xbmcaddon import os.path import datetime addon_path = xbmc.translatePath(xbmcaddon.Addon('plugin.video.arte_tv').getAddonInfo('path')).decode('utf-8') weekdays = (translate(30020), translate(30021), translate(30022), translate(30023), translate(30024), translate(30025), translate(30026)) date = datetime.datetime.now() today = date yesterday = date + datetime.timedelta(days=-1) tomorrow = date + datetime.timedelta(days=1) add_folder(translate(30027), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + yesterday.strftime('%Y-%m-%d')) add_folder(translate(30028), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + today.strftime('%Y-%m-%d')) add_folder(translate(30029), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + tomorrow.strftime('%Y-%m-%d')) date += datetime.timedelta(days=1) for day in range(20): date += datetime.timedelta(days=1) weekday = weekdays[date.weekday()] add_folder('%s, %s' % (weekday, date.strftime('%d.%m.')), os.path.join(addon_path, 'resources', 'media', 'plus7.png'), 'mode=list-tv-guide&date=' + date.strftime('%Y-%m-%d')) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def list_videos( language='de', category='ALL', cluster='ALL', detail_level='L3', sort='AIRDATE_DESC', limit=0, offset=0, recommended=-1, current_page=0, thumb_as_fanart=True ): language_code = language[0].upper() url = 'http://www.arte.tv/papi/tvguide/videos/plus7/program/%s/%s/%s/%s/%i/%s/%i/%i/DE_FR.json' % ( language_code, detail_level, category, cluster, recommended, sort, limit, offset) try: json_data = urllib2.urlopen(url).read() videos = json.loads(json_data)['program%sList' % language.upper()] except: return -1 # no network item_added = False for video in videos: try: rating = video['mediaRating' + language_code] duration_in_seconds = video['VDO']['videoDurationSeconds'] json_stream_url = video['VDO']['videoStreamUrl'] thumb = video['VDO']['VTU']['IUR'] if thumb_as_fanart: fanart = thumb else: fanart = video['VDO']['VTU']['original'] title = video['TIT'] try: subtitle = video['STL'] sep = ' - ' except: subtitle = sep = '' try: genre = video['GEN'] except: genre = '' year = video['VDO']['productionYear'] try: desc = video['DLO'].replace(' ' * 6, '') except: desc = video['DTE'] try: director = video['VDO']['director'] except: director = '' cast_and_role = [] try: cast = video['CCW'] for entry in cast: try: cast_and_role.append((entry['CNA'], entry['CRO'])) except: try: cast_and_role.append((entry['CNA'], entry['CTY'])) except: pass except: pass try: short_desc = video['VDO']['V7T'] except: short_desc = '' try: studio = video['POR'] except: studio = '' try: country = video['PCT'] except: country = '' link = sys.argv[0] + '?stream=' + urllib.quote_plus(json_stream_url) + '&mode=play-video' item = xbmcgui.ListItem('[B]%s[/B]%s%s' % (title, sep, subtitle), iconImage='', thumbnailImage=thumb) item.setInfo(type='Video', infoLabels={ 'Title': '%s%s%s' % (title, sep, subtitle), 'Plot': desc, 'PlotOutline': short_desc, 'Mpaa': rating, 'Genre': genre, 'Year': year, 'Director': director, 'CastAndRole': cast_and_role, 'Studio': studio, 'Country': country, } ) item.addStreamInfo('video', {'duration': duration_in_seconds}) item.addStreamInfo('audio', {'language': language}) item.setProperty('IsPlayable', 'true') item.setProperty('fanart_image', fanart) if xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item): item_added = True except: continue if len(videos) == limit: # most likely this page isn't the limit... link = '%s?mode=list-videos&page=%i&category=%s&cluster=%s&sort=%s&recommended=%i' % ( sys.argv[0], current_page + 1, category, cluster, sort, recommended) item = xbmcgui.ListItem('[B][COLOR fffa481c]%s (%i)[/COLOR][/B]' % (translate(30012), current_page + 2), iconImage='') xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item, isFolder=True) xbmcplugin.endOfDirectory(int(sys.argv[1])) return item_added
elif site == 'creative': list_highlight_videos( 'http://www.arte.tv/videofeed/CREATIVE/%s/most_recent.json', language, 'CREATIVE', bitrate) else: list_highlight_videos( 'http://www.arte.tv/videofeed/FUTURE/%s/most_recent.json', language, 'FUTURE', bitrate) elif mode == 'plus7': from resources.lib.plus7 import list_index list_index() elif mode == 'plus7-search': import xbmc from resources.lib.plus7search import list_search_results scope = urllib.unquote_plus(params.get('scope', '')) keyboard = xbmc.Keyboard('', translate(30005)) keyboard.doModal() if keyboard.isConfirmed(): search_string = keyboard.getText() list_search_results(search_string, language, scope) elif mode == 'epg': from resources.lib.epg import list_tv_dates list_tv_dates() elif mode == 'list-tv-guide': from resources.lib.epg import list_tv_guide date = urllib.unquote_plus(params.get('date', '')) list_tv_guide(language, details, date) elif mode == 'live-tv': from resources.lib.livetv import play_livestream play_livestream(language) elif mode == 'play-video':
def list_concert_videos(language, site='', page=0, last_page=0, sort='latest'): # sort=lastchance from resources.lib.functions import translate url = 'http://concert.arte.tv%s?page=%i&sort=%s&type=videop' % ( urllib.unquote_plus(site) or '/%s/videos/all' % language, page, sort) try: html = urllib2.urlopen(url).read() except: return -1 items = html.split('<article') del items[0] item_added = False for item in items: try: current_index = 0 search_string = 'about="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: url = 'http://concert.arte.tv' + item[ start_index + len_search_string:end_index] current_index = end_index else: url = '' current_index += len_search_string else: url = '' ### search_string = 'title="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: title = item[start_index + len_search_string:end_index].replace( '&', '&').replace(''', "'").replace('"', '"') current_index = end_index else: title = '' current_index += len_search_string else: title = '' ### search_string = ' src="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: thumb = item[start_index + len_search_string:end_index] current_index = end_index else: thumb = '' current_index += len_search_string else: thumb = '' fanart = thumb thumb = thumb.replace('https:', 'http:').replace('alw_rectangle_376', 'alw_rectangle_456') fanart = fanart.replace('https:', 'http:').replace( '/styles/alw_rectangle_376/public', '') ### search_string = '<span class="date-container">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: date = item[start_index + len_search_string:end_index].replace( '\n', '').replace(' ', '') current_index = end_index else: date = '' current_index += len_search_string else: date = '' ### search_string = '<span class="time-container">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: duration = item[start_index + len_search_string:end_index].replace( '\n', '').replace(' ', '').replace('"', '') current_index = end_index else: duration = '' current_index += len_search_string else: duration = '' if len(duration) == 8 and duration.count(':') == 2: try: hours = int(duration[:2]) minutes = int(duration[3:5]) seconds = int(duration[6:]) duration_in_seconds = hours * 3600 + minutes * 60 + seconds except: duration_in_seconds = 0 else: duration_in_seconds = 0 ### search_string = 'property="content:encoded">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</', start_index + len_search_string) if end_index > -1: desc = item[start_index + len_search_string:end_index].replace( '\n ', '').replace('&', '&').replace( ''', "'").replace('"', '"') if date: desc = '%s\n%s' % (date, desc) current_index = end_index else: desc = '' current_index += len_search_string else: desc = '' ### search_string = '<span class="tag video-genre">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: genre = item[start_index + len_search_string:end_index] current_index = end_index else: genre = '' current_index += len_search_string else: genre = '' ### link = sys.argv[0] + '?mode=play-video&page=' + urllib.quote_plus( url) item = xbmcgui.ListItem('%s' % title, iconImage='', thumbnailImage=thumb) item.setInfo(type='Video', infoLabels={ 'Title': title, 'Plot': desc, 'Genre': genre }) item.addStreamInfo('video', {'duration': duration_in_seconds}) item.addStreamInfo('audio', {'language': language}) item.setProperty('IsPlayable', 'true') item.setProperty('fanart_image', fanart) if xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item): item_added = True except: continue if len(items) in (8, 12): # most likely next page available... link = '%s?mode=list-concert-videos&site=%s&page=%i&sort=%s' % ( sys.argv[0], site, page + 1, sort) item = xbmcgui.ListItem('[B][COLOR fffd8bc8]%s (%i)[/COLOR][/B]' % (translate(30012), page + 2), iconImage='') xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item, isFolder=True) xbmcplugin.endOfDirectory(int(sys.argv[1])) return item_added
list_highlight_videos('http://www.arte.tv/videofeed/CINEMA/%s/most_recent.json', language, 'CINEMA', bitrate) elif site == 'creative': list_highlight_videos('http://www.arte.tv/videofeed/CREATIVE/%s/most_recent.json', language, 'CREATIVE', bitrate) else: list_highlight_videos('http://www.arte.tv/videofeed/FUTURE/%s/most_recent.json', language, 'FUTURE', bitrate) elif mode == 'concert': from resources.lib.concert import list_collections, list_concert_index site = urllib.unquote_plus(params.get('site', '')) if site: list_collections(language, type = site) else: list_concert_index(language) elif mode == 'concert-search': import xbmc from resources.lib.concert import * keyboard = xbmc.Keyboard('', translate(30005)) keyboard.doModal() if keyboard.isConfirmed(): search_string = keyboard.getText() concert_search(language, search_string, page = 0) elif mode == 'list-concert-videos': from resources.lib.concert import * site = urllib.unquote_plus(params.get('site', '')) sort = urllib.unquote_plus(params.get('sort', '')) or 'latest' page = int(urllib.unquote_plus(params.get('page', '')) or 0) list_concert_videos(language, site, page, sort=sort) elif mode == 'plus7': from resources.lib.plus7 import list_index list_index() elif mode == 'plus7-search': import xbmc
def play_livestream(language='de'): try: api_url = 'http://www.arte.tv/papi/tvguide/videos/livestream/player/%s/' % language[ 0].upper() try: json_data = urllib2.urlopen(api_url).read() stream_data = json.loads(json_data)['videoJsonPlayer'] except: return -1 # no network title = stream_data['VTI'] try: subtitle = stream_data['VSU'] except: subtitle = '' if subtitle: sep = ' - ' else: subtitle = sep = '' try: desc = stream_data['VDE'] except: desc = '' thumb = stream_data['VTU']['IUR'] try: duration_in_seconds = stream_data['BDS'] except: duration_in_seconds = 0 stream_url = stream_data['VSR']['M3U8_HQ']['url'] try: player_url = stream_data[ 'videoPlayerUrl'] # for playing video from beginning if wished except: player_url = '' bitrate = stream_data['VSR']['M3U8_HQ']['bitrate'] height = stream_data['VSR']['M3U8_HQ']['height'] width = stream_data['VSR']['M3U8_HQ']['width'] item = xbmcgui.ListItem('[B][COLOR fffa481c]LIVE[/COLOR] %s[/B]%s%s' % (title, sep, subtitle), thumbnailImage=thumb) item.setInfo(type='Video', infoLabels={ 'Title': '%s%s%s' % (title, sep, subtitle), 'Plot': desc, }) item.addStreamInfo( 'video', { 'duration': duration_in_seconds, 'aspect': float(width) / height, 'width': width, 'height': height, }) item.addStreamInfo('audio', {'language': language}) item.setProperty('IsPlayable', 'true') item.setProperty('fanart_image', thumb) if player_url: # add option 'Play from beginning' to context menu import urllib item.addContextMenuItems([( translate(30014), 'xbmc.RunPlugin(plugin://plugin.video.arte_tv/?mode=play-video&stream=%s&title=%s&thumb=%s)' % (player_url, urllib.quote_plus(title.encode('utf8')), urllib.quote_plus(thumb.encode('utf8'))))]) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=stream_url, listitem=item) xbmcplugin.endOfDirectory(int(sys.argv[1])) return True except: return False
def list_concert_videos(language, site='', page=0, last_page=0, sort='latest'): # sort=lastchance from resources.lib.functions import translate url = 'http://concert.arte.tv%s?page=%i&sort=%s&type=videop' % (urllib.unquote_plus(site) or '/%s/videos/all' % language, page, sort) try: html = urllib2.urlopen(url).read() except: return -1 items = html.split('<article') del items[0] item_added = False for item in items: try: current_index = 0 search_string = 'about="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: url = 'http://concert.arte.tv' + item[start_index + len_search_string:end_index] current_index = end_index else: url = '' current_index += len_search_string else: url = '' ### search_string = 'title="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: title = item[start_index + len_search_string:end_index].replace('&', '&').replace(''', "'").replace('"', '"') current_index = end_index else: title = '' current_index += len_search_string else: title = '' ### search_string = ' src="' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('"', start_index + len_search_string) if end_index > -1: thumb = item[start_index + len_search_string:end_index] current_index = end_index else: thumb = '' current_index += len_search_string else: thumb = '' fanart = thumb thumb = thumb.replace('https:', 'http:').replace('alw_rectangle_376', 'alw_rectangle_456') fanart = fanart.replace('https:', 'http:').replace('/styles/alw_rectangle_376/public', '') ### search_string = '<span class="date-container">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: date = item[start_index + len_search_string:end_index].replace('\n', '').replace(' ', '') current_index = end_index else: date = '' current_index += len_search_string else: date = '' ### search_string = '<span class="time-container">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: duration = item[start_index + len_search_string:end_index].replace('\n', '').replace(' ', '').replace('"', '') current_index = end_index else: duration = '' current_index += len_search_string else: duration = '' if len(duration) == 8 and duration.count(':') == 2: try: hours = int(duration[:2]) minutes = int(duration[3:5]) seconds = int(duration[6:]) duration_in_seconds = hours * 3600 + minutes * 60 + seconds except: duration_in_seconds = 0 else: duration_in_seconds = 0 ### search_string = 'property="content:encoded">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</', start_index + len_search_string) if end_index > -1: desc = item[start_index + len_search_string:end_index].replace('\n ', '').replace('&', '&').replace(''', "'").replace('"', '"') if date: desc = '%s\n%s' % (date, desc) current_index = end_index else: desc = '' current_index += len_search_string else: desc = '' ### search_string = '<span class="tag video-genre">' len_search_string = len(search_string) start_index = item.find(search_string, current_index) if start_index > -1: end_index = item.find('</span>', start_index + len_search_string) if end_index > -1: genre = item[start_index + len_search_string:end_index] current_index = end_index else: genre = '' current_index += len_search_string else: genre = '' ### link = sys.argv[0] + '?mode=play-video&page=' + urllib.quote_plus(url) item = xbmcgui.ListItem('%s' % title, iconImage='', thumbnailImage=thumb) item.setInfo(type='Video', infoLabels={ 'Title': title, 'Plot': desc, 'Genre': genre }) item.addStreamInfo('video', {'duration': duration_in_seconds}) item.addStreamInfo('audio', {'language': language}) item.setProperty('IsPlayable', 'true') item.setProperty('fanart_image', fanart) if xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item): item_added = True except: continue if len(items) in (8, 12): # most likely next page available... link = '%s?mode=list-concert-videos&site=%s&page=%i&sort=%s' % (sys.argv[0], site, page + 1, sort) item = xbmcgui.ListItem('[B][COLOR fffd8bc8]%s (%i)[/COLOR][/B]' % (translate(30012), page + 2), iconImage='') xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=link, listitem=item, isFolder=True) xbmcplugin.endOfDirectory(int(sys.argv[1])) return item_added