Exemple #1
0
def dialogServiceTemporarilyUnavailable():
    '''Dialog to be shown when Qobuz is not available (Maintenance)
    '''
    dialog = xbmcgui.Dialog()
    dialog.ok('Qobuz Service Temporay Unavailable',
              'Qobuz service are down :/', 'Check it later')
    xbmcplugin.endOfDirectory(
        handle=int(sys.argv[1]),
        succeeded=False,
        updateListing=True,
        cacheToDisc=False)
    return False
Exemple #2
0
def dialogLoginFailure():
    '''Dialog to be shown when we can't login into Qobuz
    '''
    dialog = xbmcgui.Dialog()
    if dialog.yesno(lang(30010), lang(30036), lang(30042)):
        qobuz.addon.openSettings()
        xbmcplugin.endOfDirectory(
            handle=int(sys.argv[1]),
            succeeded=False,
            updateListing=True,
            cacheToDisc=False)
    else:
        xbmc.executebuiltin('ActivateWindow(home)')
        return False
def XL_Live(ID=''):	
	PLog('XL_Live:')
	title = 'TagesschauXL Live'
	li = xbmcgui.ListItem()
	li = home(li, ID='TagesschauXL')									# Home-Button
		
	# json-Seiten ermittelt mit chrome-dev-tools von 
	# 	tagesschau.de/multimedia/livestreams/index.htm,
	#	tagesschau.de/multimedia/livestreams/livestream1/index.html (int.)
	path = "http://www.tagesschau.de/multimedia/livestreams/livestream-3-105~mediajson.json"
	if ID == "international":
		path = "http://www.tagesschau.de/multimedia/livestreams/livestream-1-101~mediajson.json"
	page, msg = get_page(path=path)
	PLog(page[:100])	

	if page == '':	
		msg1 = "Fehler in XL_Live:"
		msg2 = msg
		msg3 = "Fallback zu ARD_m3u8 (s. Log)" 
		MyDialog(msg1, msg2, msg3)
		PLog(msg3)
		url_m3u8=''
	else:
		streams = blockextract('_stream":', page)
		for stream in streams:
			url_m3u8 = stringextract('_stream": "', '"', stream)
			if "master.m3u8" in url_m3u8:
				break

	if url_m3u8 == '':
		url_m3u8 = ARD_m3u8	
	
	thumb = stringextract('xl": "', '"', page)
	if thumb == '':
		thumb = ICON_LIVE
	if thumb.startswith('http') == False:
		thumb = BASE_URL + thumb
			
	PLog('url_m3u8: '+ url_m3u8); PLog('thumb: ' + thumb)	
	if SETTINGS.getSetting('pref_video_direct') == 'true': # or Merk == 'true':	# Sofortstart
		PLog('Sofortstart: ' + title)
		PlayVideo(url=url_m3u8, title=title, thumb=thumb, Plot=title)
		return
	
	li = Parseplaylist(li, url_m3u8, thumb, geoblock='', descr=title,  sub_path='')	
		
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)	
def search_page():
    """Display a search dialog, then the results"""

    kb = xbmc.Keyboard()
    kb.doModal()
    if kb.isConfirmed():
        # Enable more viewtypes
        xbmcplugin.setContent(addon_handle, 'videos')

        search_string = kb.getText()
        url = 'https://data.jw-api.org/search/query?'
        query = urlencode({
            'q': search_string,
            'lang': global_lang,
            'limit': 24
        })

        try:
            token = addon.getSetting(SettingID.TOKEN)
            if not token:
                raise RuntimeError

            headers = {'Authorization': 'Bearer ' + token}
            data = get_json(Request(url + query, headers=headers),
                            catch_401=False)

        except (HTTPError, RuntimeError):
            # Get and save new token
            log('requesting new authentication token from jw.org',
                xbmc.LOGINFO)
            token_url = 'https://tv.jw.org/tokens/web.jwt'
            token = urlopen(token_url).read().decode('utf-8')
            if not token:
                raise RuntimeError('failed to get search authentication token')

            addon.setSetting(SettingID.TOKEN, token)

            headers = {'Authorization': 'Bearer ' + token}
            data = get_json(Request(url + query, headers=headers))

        for hd in data['hits']:
            media = Media()
            media.parse_hits(hd)
            if media.url:
                media.add_item_in_kodi()

        xbmcplugin.endOfDirectory(addon_handle)
Exemple #5
0
def Kika_Live():
	PLog('Kika_Live:')
	li = xbmcgui.ListItem()
	li = home(li, ID='Kinderprogramme')			# Home-Button
	
	import resources.lib.EPG as EPG
	zdf_streamlinks = ardundzdf.get_ZDFstreamlinks()
	# Zeile zdf_streamlinks: "webtitle|href|thumb|tagline"
	for line in zdf_streamlinks:
		webtitle, href, thumb, tagline = line.split('|')
		# Bsp.: "ZDFneo " in "ZDFneo Livestream":
		if up_low('KiKA ') in up_low(webtitle): 	# Sender mit Blank!
			m3u8link = href
			break
	if m3u8link == '':
		PLog('%s: Streamlink fehlt' % 'KiKA ')
	
	ID = 'KIKA'
	title = 'KIKA TV-Live'
	Merk = ''
	
	rec = EPG.EPG(ID=ID, mode='OnlyNow')		# Daten holen - nur aktuelle Sendung
	PLog(rec)	# bei Bedarf
	if len(rec) == 0:							# EPG-Satz leer?
		title = 'EPG nicht gefunden'
		summ = ''
		tagline = ''
	else:	
		href=rec[1]; img=rec[2]; sname=rec[3]; stime=rec[4]; summ=rec[5]; vonbis=rec[6]
		if img.find('http') == -1:	# Werbebilder today.de hier ohne http://
			img = R('tv-kika.png')
		title 	= sname.replace('JETZT', ID)		# JETZT durch Sender ersetzen
		# sctime 	= "[COLOR red] %s [/COLOR]" % stime			# Darstellung verschlechtert
		# sname 	= sname.replace(stime, sctime)
		tagline = 'Zeit: ' + vonbis
				
	title = unescape(title); title = repl_json_chars(title)
	summ = unescape(summ); summ = repl_json_chars(summ)
	PLog("title: " + title); PLog(summ)
	title=py2_encode(title); m3u8link=py2_encode(m3u8link);
	img=py2_encode(img); summ=py2_encode(summ);			
	fparams="&fparams={'path': '%s', 'title': '%s', 'thumb': '%s', 'descr': '%s', 'Merk': '%s'}" %\
		(quote(m3u8link), quote(title), quote(img), quote_plus(summ), Merk)
	addDir(li=li, label=title, action="dirList", dirID="ardundzdf.SenderLiveResolution", fanart=R('tv-EPG-all.png'), 
		thumb=img, fparams=fparams, summary=summ, tagline=tagline)

	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
def list_channels(cat):
    list_items = []
    for item in RB.get_category_by_id(int(cat)).videos:
        li = ListItem(item.title)
        li.setProperty("IsPlayable", "true")
        li.setInfo(type="Video",
                   infoLabels={
                       "Title": item.title,
                       "mediatype": "video"
                   })
        image = xbmc_curl_encode(RB.resolve_logo(item.logo_url))
        li.setArt({"thumb": image, "icon": image})
        url = plugin.url_for(play, c_id=item.video_id)
        list_items.append((url, li, False))
    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    xbmcplugin.setContent(plugin.handle, "videos")
    xbmcplugin.endOfDirectory(plugin.handle)
def Main_phoenix():
	PLog('Main_phoenix:')
	
	li = xbmcgui.ListItem()
	liICON_TVLIVE = home(li, ID=NAME)			# Home-Button

	title="Suche auf phoenix"
	tag = "Suche Themen, Sendungen und Videos in phoenix"
	fparams="&fparams={}" 
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.phoenix_Search", fanart=R(ICON_PHOENIX), 
		thumb=ICON_SEARCH, fparams=fparams, tagline=tag)
	# ------------------------------------------------------
			
	tag='[B][COLOR red]Phoenix Livestream[/COLOR][/B]'
	title,subtitle,vorspann,descr,href = get_live_data()
	title = '[B][COLOR red]LIVE: %s[/COLOR][/B]' % title
	
	summ = descr
	if subtitle:
		summ = '%s\n%s' % (subtitle, summ)
	if vorspann:
		summ = '%s\n%s' % (vorspann, summ)
		
	title=py2_encode(title); href=py2_encode(href); tag=py2_encode(tag);
	PLog(title); PLog(subtitle); PLog(vorspann); PLog(descr); PLog(href)
	fparams="&fparams={'href': '%s', 'title': '%s', 'Plot': '%s'}" % (quote(href), quote(title), quote(tag))
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.phoenix_Live", fanart=R(ICON_PHOENIX),
		thumb=ICON_TVLIVE, fparams=fparams, tagline=tag, summary=summ)
	# ------------------------------------------------------
	title="Themen: Rubriken (alle)"
	fparams="&fparams={'ID': 'Rubriken'}" 
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.Themen", fanart=R(ICON_PHOENIX), 
		thumb=ICON_RUBRIKEN, fparams=fparams)
	
	title="Themen: Dossiers (alle)"
	fparams="&fparams={'ID': 'Dossiers'}" 
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.Themen", fanart=R(ICON_PHOENIX), 
		thumb=ICON_DOSSIERS, fparams=fparams)
	
	title="Sendungen"
	fparams="&fparams={'ID': 'Sendungen'}" 
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.Themen", fanart=R(ICON_PHOENIX), 
		thumb=ICON_SENDUNGEN, fparams=fparams)
	

	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)	
Exemple #8
0
def process_seasons(context, url, rating_key=None, library=False):
    xbmcplugin.setContent(get_handle(), 'seasons')

    if not url.startswith(('http', 'file')) and rating_key:
        # Get URL, XML and parse
        server = context.plex_network.get_server_from_uuid(url)
        url = server.get_url_location(
        ) + '/library/metadata/%s/children' % str(rating_key)
    else:
        server = context.plex_network.get_server_from_url(url)

    tree = get_xml(context, url)
    if tree is None:
        return

    will_flatten = False
    if context.settings.flatten_seasons() == '1':
        # check for a single season
        if int(tree.get('size', 0)) == 1:
            LOG.debug('Flattening single season show')
            will_flatten = True

    all_season_disabled = context.settings.all_season_disabled()

    items = []
    append_item = items.append
    # For all the directory tags
    seasons = tree.getiterator('Directory')
    for season in seasons:

        if will_flatten:
            url = server.get_url_location() + season.get('key')
            process_episodes(context, url)
            return

        if all_season_disabled and season.get('index') is None:
            continue

        item = Item(server, url, tree, season)
        append_item(create_season_item(context, item, library=library))

    if items:
        xbmcplugin.addDirectoryItems(get_handle(), items, len(items))

    xbmcplugin.endOfDirectory(get_handle(),
                              cacheToDisc=context.settings.cache_directory())
Exemple #9
0
def books_page():
    """Display all cached books"""

    items = [PublicationItem(result)
             for result in cache.publ.select(PublicationData(lang=global_language))
             if result.pub not in ('g', 'w', 'wp', 'ws', 'nwt', 'bi12')
             if result.failed is None]

    for b in sorted(items, key=lambda x: x.title):
        b.add_item_in_kodi()

    MenuItem(
        url=request_to_self(M.ADD_BOOKS),
        title=S.ADD_MORE
    ).add_item_in_kodi()

    xbmcplugin.endOfDirectory(addon_handle)
Exemple #10
0
def manage_libraries():

    directory(translate(33098),
              "plugin://plugin.video.jellyfin/?mode=refreshboxsets", False)
    directory(translate(33154), "plugin://plugin.video.jellyfin/?mode=addlibs",
              False)
    directory(translate(33139),
              "plugin://plugin.video.jellyfin/?mode=updatelibs", False)
    directory(translate(33140),
              "plugin://plugin.video.jellyfin/?mode=repairlibs", False)
    directory(translate(33184),
              "plugin://plugin.video.jellyfin/?mode=removelibs", False)
    directory(translate(33060),
              "plugin://plugin.video.jellyfin/?mode=thememedia", False)

    xbmcplugin.setContent(PROCESS_HANDLE, 'files')
    xbmcplugin.endOfDirectory(PROCESS_HANDLE)
 def end_of_directory(self, forceStatus=None):
     if self.seen_nodes:
         self.seen_nodes = {}
     success = True
     if forceStatus is not None:
         success = forceStatus
     if not self.put_item_ok or self.total_put == 0:
         success = False
     if not self.asList:
         xbmcplugin.setContent(
             handle=self.handle, content=self.content_type)
         xbmcplugin.endOfDirectory(
             handle=self.handle,
             succeeded=success,
             updateListing=False,
             cacheToDisc=success)
     return self.total_put
Exemple #12
0
def INDEXP(url):
    html = get_html(url)
    match = re.compile(r'video">.+?href="([^"]+)[^>]+>([^<]+).+?url'
                       r'''\('([^']+).+?time">([^<]+)''',
                       re.DOTALL).findall(html)
    if match:
        for gurl, name, thumbnail, duration in match:
            name = '%s (%s)' % (name, duration)
            gurl = 'https://fantasti.cc%s' % gurl
            addLink(name, gurl, 4, thumbnail)
    nextpg = re.compile(r'class="next\s*".+?href="([^"]+)',
                        re.DOTALL).findall(html)
    if nextpg:
        mode = 3
        fixedNext = '%s%s' % (url.split('?')[0], nextpg[0])
        addDir('Next Page', fixedNext, mode, default_image)
    xbmcplugin.endOfDirectory(pluginhandle)
def endScript(message=None,
              loglevel=2,
              closedir=True,
              update_listing=False,
              update_dir=False):
    if message:
        log(message, loglevel)
    if closedir:
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_LABEL)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.endOfDirectory(handle=HANDLE,
                                  succeeded=True,
                                  updateListing=update_listing)
    if update_dir:
        refresh()
    sys.exit()
Exemple #14
0
def Themen(ID):							# Untermenüs zu ID
	PLog('Themen, ID: ' + ID)
		
	if ID == 'Rubriken':
		url = 'https://www.phoenix.de/response/template/rubrik_overview_json'
	if ID == 'Dossiers':
		url = 'https://www.phoenix.de/response/template/dossier_overview_json'
	if ID == 'Sendungen':
		url = 'https://www.phoenix.de/response/template/sendungseite_overview_json'
		
	page, msg = get_page(path=url)	
	if page == '':						
		msg1 = 'Fehler in Themen: %s' % ID
		msg2 = msg
		MyDialog(msg1, msg2, '')
		return 
	PLog(len(page))
	
	jsonObject = json.loads(page)
	search_cnt = jsonObject["content"]['hits']
	
	li = xbmcgui.ListItem()
	li = home(li, ID='phoenix')			# Home-Button
	
	items = jsonObject["content"]['items']
	PLog(len(items))
	for item in items:
		# img 	=  BASE_PHOENIX + item["icon"]		# diese svg-Grafik in Plex nicht darstellbar
		img 	=  BASE_PHOENIX + item["bild_m"]	
		url 	= BASE_PHOENIX + item["link"]		# Bsp. ../russland-r-252413.html
		title 	= item["titel"]
		typ		= item["typ"]
		
		title = cleanhtml(title); title = mystrip(title);
		title = repl_json_chars(title)
	
		PLog('Satz2:')
		PLog(url); PLog(img); PLog(title)
		url=py2_encode(url); title=py2_encode(title);
		fparams="&fparams={'path': '%s', 'title': '%s', 'ID': '%s'}" %\
			(quote(url), quote(title), ID)
		addDir(li=li, label=title, action="dirList", dirID="resources.lib.phoenix.ThemenListe", fanart=img, 
			thumb=img, fparams=fparams)
	
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #15
0
def top_level_page():
    """The main menu"""

    if addon.getSetting(SettingID.STARTUP_MSG) == 'true':
        dialog = xbmcgui.Dialog()
        try:
            dialog.textviewer(S.THEO_WARN, S.DISCLAIMER)  # Kodi v16
        except AttributeError:
            dialog.ok(S.THEO_WARN, S.DISCLAIMER)
        addon.setSetting(SettingID.STARTUP_MSG, 'false')

    # Auto set language, if it has never been set and Kodi is configured for something else then English
    isolang = xbmc.getLanguage(xbmc.ISO_639_1)
    if not addon.getSetting(SettingID.LANG_HIST) and isolang != 'en':
        try:
            # Search for matching language, save setting (and update translations)
            language_dialog(preselect=isolang)
            # Reload for this instance
            global global_language
            global_language = addon.getSetting(SettingID.LANG) or 'E'
        except StopIteration:
            # No suitable language was found, just write something to history, so this check won't run again
            addon.setSetting(SettingID.LANG_HIST, 'E')

    fanart = os.path.join(addon.getAddonInfo('path'), addon.getAddonInfo('fanart'))

    MenuItem(
        url=request_to_self(M.BIBLE),
        title=T.BIBLE or S.BIBLE,
        icon=ICON_BIBLE,
        fanart=fanart
    ).add_item_in_kodi()
    MenuItem(
        url=request_to_self(M.MAGAZINES),
        title=T.MAGAZINES or S.MAGAZINES,
        icon=ICON_WATCHTOWER,
        fanart=fanart
    ).add_item_in_kodi()
    MenuItem(
        url=request_to_self(M.BOOKS),
        title=T.BOOKS or S.BOOKS,
        icon=ICON_BOOKS,
        fanart=fanart
    ).add_item_in_kodi()
    xbmcplugin.endOfDirectory(addon_handle)
    def play_with_fshare_code():
        xbmcplugin.setPluginCategory(plugin.handle, 'Fshare Code')

        list_item = xbmcgui.ListItem(
            label=
            "Enter code: https://fshare.vn/file/[COLOR orange][B]%s[/B][/COLOR]"
            % "XXXXXXXXXX", )
        xbmcplugin.addDirectoryItem(plugin.handle,
                                    plugin.url_for(
                                        app.playing_with_fshare_code),
                                    list_item,
                                    isFolder=True)

        xbmcplugin.addDirectoryItem(
            plugin.handle, plugin.url_for(app.clear_with_fshare_code),
            xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" %
                             "Clear all..."), True)

        # Support to save search history
        items: dict = helper.get_last_fshare_movie()
        for item in items.values():
            url = plugin.url_for(app.play,
                                 query=json.dumps({
                                     'item': item,
                                     'direct': 1
                                 }))
            txt = '[%s] %s' % (item.get('size'), item.get('title'))
            list_item = xbmcgui.ListItem(label=txt)

            if item.get('is_folder') == True:
                url = plugin.url_for(app.show_fshare_folder,
                                     query=json.dumps({
                                         'item': item,
                                         'movie_item': item
                                     }))
                list_item.setProperty("IsPlayable", "false")
                xbmcplugin.addDirectoryItem(plugin.handle, url, list_item,
                                            True)
            else:
                list_item.setProperty("IsPlayable", "true")
                list_item.setInfo('video', {'title': item.get('title')})
                xbmcplugin.addDirectoryItem(plugin.handle, url, list_item,
                                            False)

        xbmcplugin.endOfDirectory(plugin.handle)
def Kika_VideosBeliebt(): 
	PLog('Kika_VideosBeliebt:')
	li = xbmcgui.ListItem()
	li = home(li, ID='Kinderprogramme')			# Home-Button
	
	path = 'https://www.kika.de/videos/allevideos/allevideos-buendelgruppen100.html'
	page, msg = get_page(path)	
	if page == '':	
		msg1 = "Fehler in Kika_VideosBeliebt:"
		msg2 = msg
		xbmcgui.Dialog().ok(ADDON_NAME, msg1, msg2, '')	
		return li
	PLog(len(page))	
	buendel = blockextract('teaser teaserIdent', page)	
	PLog(len(buendel))
	
	for s in 	buendel:			
		# PLog(s[0:40])		# bei Bedarf
		href =  BASE_KIKA + stringextract('href=\"', '\"', s)
		img = stringextract('<noscript>', '</noscript>', s).strip()		# Bildinfo separieren
		img_alt = stringextract('alt=\"', '\"', img)	
		img_src = stringextract('src="', '"', img)
		if img_src.startswith('http') == False:
			img_src = BASE_KIKA + img_src
		
		dachzeile = stringextract('<h4 class=\"headline\">', '</h4>', s)		
		headline = stringextract('page=artikel\">', '</a>', dachzeile).strip()	
		stitle = headline
		
		stitle = unescape(stitle); stitle = repl_json_chars(stitle)	
		img_alt = unescape(img_alt); 	
		
		PLog('Satz:')
		PLog(href);PLog(stitle);PLog(img_alt);PLog(img_src)
		href=py2_encode(href); stitle=py2_encode(stitle); img_src=py2_encode(img_src);
		
		if 'KiKA LIVE' in stitle:										# s. Main_KIKA
			continue
		else:				
			fparams="&fparams={'path': '%s', 'title': '%s', 'thumb': '%s'}" %\
				(quote(href), quote(stitle), quote(img_src))
			addDir(li=li, label=stitle, action="dirList", dirID="resources.lib.childs.Kika_Videos", fanart=img_src, 
				thumb=img_src, fparams=fparams, tagline=img_alt)
		
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #18
0
def process_photos(context, url, tree=None):
    server = context.plex_network.get_server_from_url(url)

    tree = get_xml(context, url, tree)
    if tree is None:
        return

    content_counter = {
        'photo': 0,
        'track': 0,
        'video': 0,
    }
    items = []
    append_item = items.append

    branches = tree.getiterator()
    for branch in branches:
        item = Item(server, url, tree, branch)
        tag = branch.tag.lower()
        if tag == 'photo':
            append_item(create_photo_item(context, item))
        elif tag == 'directory':
            append_item(create_directory_item(context, item))
        elif tag == 'track':  # mixed content photo playlist
            append_item(create_track_item(context, item))
        elif tag == 'video':  # mixed content photo playlist
            append_item(create_movie_item(context, item))

        if isinstance(content_counter.get(tag), int):
            content_counter[tag] += 1

    if items:
        content_type = 'images'
        if context.settings.mixed_content_type() == 'majority':
            majority = max(content_counter, key=content_counter.get)
            if majority == 'track':
                content_type = 'songs'
            elif majority == 'video':
                content_type = 'movies'

        xbmcplugin.setContent(get_handle(), content_type)
        xbmcplugin.addDirectoryItems(get_handle(), items, len(items))

    xbmcplugin.endOfDirectory(get_handle(),
                              cacheToDisc=context.settings.cache_directory())
Exemple #19
0
def ShowSingleBandwidth(title, url_m3u8, thumb,
                        descr):  # .m3u8 -> einzelne Auflösungen
    PLog('ShowSingleBandwidth:')

    playlist = loadPage(url_m3u8)
    if playlist.startswith('Fehler'):
        msg1 = playlist
        msg2 = url_m3u8
        MyDialog(msg1, msg2, '')

    li = xbmcgui.ListItem()
    li = Parseplaylist(li,
                       playlist=playlist,
                       title=title,
                       thumb=thumb,
                       descr=descr)

    xbmcplugin.endOfDirectory(HANDLE)
Exemple #20
0
        def decorated_function(*args, **kwargs):
            item = f(*args, **kwargs)

            pattern = kwargs.get(ROUTE_AUTOPLAY_TAG, None)

            if pattern is not None and isinstance(item, Folder):
                _autoplay(item, pattern)
            elif isinstance(item, Folder):
                item.display()
            elif isinstance(item, Item):
                item.play(quality=kwargs.get(QUALITY_TAG))
            elif isinstance(item, Redirect):
                if _handle() > 0:
                    xbmcplugin.endOfDirectory(_handle(), succeeded=True, updateListing=True, cacheToDisc=True)
                    
                gui.redirect(item.location)
            else:
                resolve()
Exemple #21
0
def router(paramstring):
    """
    Dispatch plugin functions depending on the call paramstring

    :param paramstring: URL-encoded plugin call parameters
    :type paramstring: str
    """
    # Get plugin call params
    if PY2:
        paramstring = urlparse.unquote(paramstring).decode('utf-8')
    params = dict(urlparse.parse_qsl(paramstring))
    if params['action'] in ('search', 'manualsearch'):
        # Search and display subs.
        search_subs(params)
    elif params['action'] == 'download':
        download_subs(params['link'], params['ref'],
                      urlparse.unquote(params['filename']))
    xbmcplugin.endOfDirectory(handle)
Exemple #22
0
def root():
    mytv.update_live_channels()
    list_items = []
    for category in mytv.get_live_categories():
        li = ListItem(category.cat_name, offscreen=True)
        url = plugin.url_for(list_channels, cat=category.cat_id)
        list_items.append((url, li, True))

    li = ListItem("[VOD]", offscreen=True)
    url = plugin.url_for(vod)
    list_items.append((url, li, True))

    li = ListItem("[Live]", offscreen=True)
    url = plugin.url_for(list_live)
    list_items.append((url, li, True))

    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    xbmcplugin.endOfDirectory(plugin.handle)
Exemple #23
0
def router(paramstring):
    """
    Dispatch plugin functions depending on the call paramstring

    :param paramstring: URL-encoded plugin call parameters
    :type paramstring: str
    """
    # Get plugin call params
    params = dict(urlparse.parse_qsl(paramstring))
    if params['action'] in ('search', 'manualsearch'):
        # Search and display subs.
        search_subs(params)
    elif params['action'] == 'download':
        download_subs(
            params['link'], params['ref'],
            urlparse.unquote_plus(params['filename'])
        )
    xbmcplugin.endOfDirectory(handle)
def run(context):
    context.plex_network = plex.Plex(context.settings, load=True)
    content_type = context.params.get('content_type')
    server_list = context.plex_network.get_server_list()

    items = []
    LOG.debug('Using list of %s servers: %s' % (len(server_list), server_list))
    for server in server_list:
        sections = server.get_sections()
        for section in sections:
            if section.content_type() == content_type:
                items += _list_content(context, server, int(section.get_key()))

    if items:
        xbmcplugin.setContent(get_handle(), content_type)
        xbmcplugin.addDirectoryItems(get_handle(), items, len(items))

    xbmcplugin.endOfDirectory(get_handle(), cacheToDisc=False)
def Archiv(path, ID, img):  # 30 Tage - ähnlich Verpasst
    PLog('Archiv:')
    PLog(ID)

    li = xbmcgui.ListItem()
    li = home(li, ID='TagesschauXL')  # Home-Button

    wlist = range(0, 30)  # Abstand 1 Tage
    now = datetime.datetime.now()
    for nr in wlist:
        rdate = now - datetime.timedelta(days=nr)
        iDate = rdate.strftime("%d.%m.%Y")  # Formate s. man strftime (3)
        SendDate = rdate.strftime("%Y%m%d")  # ARD-Archiv-Format
        iWeekday = rdate.strftime("%A")
        punkte = '.'
        if nr == 0:
            iWeekday = 'Heute'
        if nr == 1:
            iWeekday = 'Gestern'
        iWeekday = transl_wtag(iWeekday)

        ipath = BASE_URL + '/multimedia/video/videoarchiv2~_date-%s.htm' % (
            SendDate)
        PLog(ipath)
        PLog(iDate)
        PLog(iWeekday)
        title = "%s | %s" % (iDate, iWeekday)
        PLog(title)

        ID = 'ARD_Archiv_Day'
        title = py2_encode(title)
        ipath = py2_encode(ipath)
        img = py2_encode(img)
        fparams="&fparams={'title': '%s','path': '%s', 'ID': '%s','img': '%s'}"  %\
         (quote(title), quote(ipath), ID, quote(img))
        addDir(li=li,
               label=title,
               action="dirList",
               dirID="resources.lib.TagesschauXL.menu_hub",
               fanart=ICON_MAINXL,
               thumb=GIT_CAL,
               fparams=fparams)

    xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #26
0
def Kikaninchen_Videos(path):
	PLog('Kikaninchen_Videos')
	li = xbmcgui.ListItem()
	li = home(li, ID='Kinderprogramme')			# Home-Button
	
	page, msg = get_page(path)	
	if page == '':	
		msg1 = "Fehler in Kikaninchen_Videos:"
		msg2 = msg
		MyDialog(msg1, msg2, '')	
		return li
		
	videos =  blockextract('class="av-playerContainer"', page)	# 16 pro Seite
	PLog(len(videos))
	mediatype='' 		
	if SETTINGS.getSetting('pref_video_direct') == 'true': # Kennz. Video für Sofortstart 
		mediatype='video'
	
	for s in videos:					 # stringextract('', '', s)
		href = ref = stringextract('dataURL:\'', '\'}', s)					# Link Videodetails  (..avCustom.xml)
		PLog(href);   # PLog(s);   # Bei Bedarf
		img = stringextract('<noscript>', '</noscript>', s).strip()			# Bildinfo separieren
		img_alt = stringextract('alt="', '"', img)	
		img_alt = unescape(img_alt)	
		img_src = stringextract('src="', '"', img)
		if img_src.startswith('http') == False:
			img_src = BASE_KIKA + img_src
		stitle = stringextract('title="', '"', s)
		stitle = unescape(stitle)	
		duration = stringextract('icon-duration">', '</span>', s)	
		tagline = duration + ' Minuten'	
		
		stitle = repl_json_chars(stitle)
		img_alt = repl_json_chars(img_alt);
		
		PLog(href); PLog(stitle); PLog(img_src); PLog(img_alt)
		href=py2_encode(href); 		
		href=py2_encode(href); stitle=py2_encode(stitle); img_src=py2_encode(img_src); img_alt=py2_encode(img_alt);
		fparams="&fparams={'path': '%s', 'title': '%s', 'thumb': '%s', 'summ': '%s', 'duration': '%s'}" %\
			(quote(href), quote(stitle), quote(img_src), quote(img_alt), quote(duration))
		addDir(li=li, label=stitle, action="dirList", dirID="resources.lib.childs.Kika_SingleBeitrag", fanart=img_src, 
			thumb=img_src, fparams=fparams, tagline=tagline, mediatype=mediatype)
	
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #27
0
def Tonschnipsel():
    PLog('Tonschnipsel')
    li = xbmcgui.ListItem()
    li = home(li, ID='Kinderprogramme')  # Home-Button

    mp3_links = [
        'kikaninchen = http://www.kikaninchen.de/kikaninchen/teaseraudio320-play.mp3',
        'Gitarre = http://www.kikaninchen.de/static_kkn/global/clickons/sounds/Gitarre_1.mp3',
        'Trompetenaffe =  http://www.kikaninchen.de/static_kkn/global/clickons/sounds/Trompetenaffe.mp3',
        'Frosch winkt = http://www.kikaninchen.de/static_kkn/global/clickons/sounds/Froschwinkt2_01.mp3?1493048916578',
        'Malfrosch =  http://www.kikaninchen.de/static_kkn/global/clickons/sounds/malfrosch1.mp3?1493048916578',
        'Grunz =  http://www.kikaninchen.de/static_kkn/global/clickons/sounds/grunz.mp3?1492871718285',
        'Huhu = http://www.kikaninchen.de/static_kkn/global/clickons/sounds/huhu.mp3?1493022362691',
        'Schnippel = http://www.kikaninchen.de/static_kkn/global/clickons/sounds/schnippel.mp3?1493022362691',
        'Klacker = http://www.kikaninchen.de/static_kkn/global/clickons/sounds/dices.mp3?1492868784119',
        #Kurzlieder von http://www.kikaninchen.de/kikaninchen/lieder/liederkikaninchen100.json:
        'Lieder	= http://www.kikaninchen.de/kikaninchen/lieder/teaseraudio288-play.mp3',
        'La, la, la = http://www.kikaninchen.de/kikaninchen/lieder/hilfeaudio104-play.mp3',
        'Haha, toll - so viele lustige Lieder = http://www.kikaninchen.de/kikaninchen/lieder/hilfeaudio106-play.mp3',
        'Höre dir Lieder an und singe mit! = http://www.kikaninchen.de/kikaninchen/lieder/hilfeaudio102-play.mp3',
        'Ja, lass uns singen und dazu tanzen! = http://www.kikaninchen.de/kikaninchen/lieder/hilfeaudio100-play.mp3',
    ]
    PLog(len(mp3_links))

    for link in mp3_links:
        title = link.split('=')[0].strip()
        url = link.split('=')[1].strip()

        PLog(url)
        PLog(title)
        thumb = R('radio-podcasts.png')
        fparams = "&fparams={'url': '%s', 'title': '%s', 'thumb': '%s', 'Plot': ''}" % (
            quote(url), quote(title), quote(thumb))
        addDir(li=li,
               label=title,
               action="dirList",
               dirID="PlayAudio",
               fanart=thumb,
               thumb=thumb,
               fparams=fparams,
               summary=title,
               mediatype='music')

    xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #28
0
def process_episodes(context, url, tree=None, rating_key=None, library=False):
    xbmcplugin.setContent(get_handle(), 'episodes')

    if not url.startswith(('http', 'file')) and rating_key:
        # Get URL, XML and parse
        server = context.plex_network.get_server_from_uuid(url)
        url = server.get_url_location(
        ) + '/library/metadata/%s/children' % str(rating_key)
    else:
        server = context.plex_network.get_server_from_url(url)

    tree = get_xml(context, url, tree)
    if tree is None:
        return

    if tree.get('mixedParents') == '1' or context.settings.episode_sort_method(
    ) == 'plex':
        xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_UNSORTED)
    else:
        xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_EPISODE)
        xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_UNSORTED)

    xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_DATE)
    xbmcplugin.addSortMethod(
        get_handle(), xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE)
    xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_DATEADDED)
    xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_VIDEO_RATING)
    xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.addSortMethod(get_handle(),
                             xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
    xbmcplugin.addSortMethod(get_handle(), xbmcplugin.SORT_METHOD_MPAA_RATING)

    items = []
    append_item = items.append
    episodes = tree.getiterator('Video')
    for episode in episodes:
        item = Item(server, url, tree, episode)
        append_item(create_episode_item(context, item, library=library))

    if items:
        xbmcplugin.addDirectoryItems(get_handle(), items, len(items))

    xbmcplugin.endOfDirectory(get_handle(),
                              cacheToDisc=context.settings.cache_directory())
Exemple #29
0
def Kikaninchen_Menu():
	PLog('Kikaninchen_Menu')
	li = xbmcgui.ListItem()
	li = home(li, ID='Kinderprogramme')			# Home-Button
	
	title='Kikaninchen Videos'
	fparams="&fparams={}"
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.childs.Kikaninchen_Videoseite", fanart=GIT_KANINCHEN, 
		thumb=GIT_KANINVIDEOS, tagline='für Kinder 3-6 Jahre', fparams=fparams)
	title='Kikaninchen Singen und Tanzen'
	fparams="&fparams={}"
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.childs.KikaninchenLieder", fanart=GIT_KANINCHEN, 
		thumb=GIT_KRAMLIEDER, tagline='für Kinder 3-6 Jahre', fparams=fparams)
	title='Kikaninchen Tonschnipsel'
	fparams="&fparams={}"
	addDir(li=li, label=title, action="dirList", dirID="resources.lib.childs.Tonschnipsel", fanart=GIT_KANINCHEN, 
		thumb=GIT_KRAMSCHNIPP, tagline='für Kinder 3-6 Jahre', fparams=fparams)
	
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #30
0
def KikaninchenLieder():	
	PLog('KikaninchenLieder')
	li = xbmcgui.ListItem()
	li = home(li, ID='Kinderprogramme')			# Home-Button
	
	path = 'https://www.kikaninchen.de/kikaninchen/lieder/liederkikaninchen100.json'	
	page, msg = get_page(path)	
	if page == '':	
		msg1 = "Fehler in Kikaninchen_Videos:"
		msg2 = msg
		MyDialog(msg1, msg2, '')	
		return li
			
	records = page.split('documentCanvasId')
	PLog(len(records))						
	
	mediatype='' 		
	if SETTINGS.getSetting('pref_video_direct') == 'true': # Kennz. Video für Sofortstart 
		mediatype='video'
	for rec in records:
		href = stringextract('avCustomUrl":"', '"', rec)
		if href == '':
			continue					
		img_src = stringextract('urlScheme":"', '**imageVariant**', rec)
		PLog(img_src)
		img_src = 'http://www.kikaninchen.de' + img_src + 'ident.jpg'		# ident = 800x800
		title = stringextract('title":"', '"', rec)
		altText =  stringextract('altText":"', '"', rec)
		titleText =  stringextract('titleText":"', '"', rec)
		summ = ''
		if altText:
			summ = altText
		if summ == '':
			summ = titleText
							
		PLog(href); PLog(title); PLog(img_src); PLog(summ)
		href=py2_encode(href); title=py2_encode(title); img_src=py2_encode(img_src); summ=py2_encode(summ);
		fparams="&fparams={'path': '%s', 'title': '%s', 'thumb': '%s', 'summ': '%s', 'duration': ''}" %\
			(quote(href), quote(title), quote(img_src), quote(summ))
		addDir(li=li, label=title, action="dirList", dirID="resources.lib.childs.Kika_SingleBeitrag", fanart=img_src, 
			thumb=img_src, fparams=fparams, tagline=summ, mediatype=mediatype)
	
	xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
Exemple #31
0
def list_live():
    live_data = mytv.get_live_events()
    list_items = []
    for day, events in live_data.items():
        for event in events:
            if len(event["channel_list"]) == 0:
                continue
            event_time = time_from_zone(datetime.utcfromtimestamp(int(event["start"])).strftime("%c"), "%Y-%m-%d %H:%M")
            title = "[{0}] {1}".format(event_time, event["title"])
            li = ListItem(title, offscreen=True)
            li.setProperty("IsPlayable", "true")
            li.setInfo(type="Video", infoLabels={"Title": title, "mediatype": "video"})
            url = plugin.url_for(event_resolve, title=event["title"].encode("utf-8"))
            list_items.append((url, li, False))

    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    xbmcplugin.setContent(plugin.handle, "videos")
    xbmcplugin.endOfDirectory(plugin.handle)
Exemple #32
0
def get_fanart(item_id, path, server_id=None):
    ''' Get extra fanart for listitems. This is called by skinhelper.
        Images are stored locally, due to the Kodi caching system.
    '''
    if not item_id and 'plugin.video.jellyfin' in path:
        item_id = path.split('/')[-2]

    if not item_id:
        return

    LOG.info("[ extra fanart ] %s", item_id)
    objects = Objects()
    list_li = []
    directory = xbmc.translatePath("special://thumbnails/jellyfin/%s/" %
                                   item_id)
    server = TheVoid('GetServerAddress', {'ServerId': server_id}).get()

    if not xbmcvfs.exists(directory):

        xbmcvfs.mkdirs(directory)
        item = TheVoid('GetItem', {'ServerId': server_id, 'Id': item_id}).get()
        obj = objects.map(item, 'Artwork')
        backdrops = api.API(item, server).get_all_artwork(obj)
        tags = obj['BackdropTags']

        for index, backdrop in enumerate(backdrops):

            tag = tags[index]
            fanart = os.path.join(directory, "fanart%s.jpg" % tag)
            li = xbmcgui.ListItem(tag, path=fanart)
            xbmcvfs.copy(backdrop, fanart)
            list_li.append((fanart, li, False))
    else:
        LOG.debug("cached backdrop found")
        dirs, files = xbmcvfs.listdir(directory)

        for file in files:
            fanart = os.path.join(directory, file)
            li = xbmcgui.ListItem(file, path=fanart)
            list_li.append((fanart, li, False))

    xbmcplugin.addDirectoryItems(int(sys.argv[1]), list_li, len(list_li))
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
Exemple #33
0
def root():
    categories = channel_list.get("categories_list")
    list_items = []

    li = ListItem("[Live]", offscreen=True)
    url = plugin.url_for(list_live)
    list_items.append((url, li, True))

    for c in categories:
        li = ListItem(c.get("cat_name"), offscreen=True)
        url = plugin.url_for(list_channels, cat=c.get("cat_id"))
        list_items.append((url, li, True))

    li = ListItem("[VOD]", offscreen=True)
    url = plugin.url_for(vod)
    list_items.append((url, li, True))

    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    xbmcplugin.endOfDirectory(plugin.handle)
Exemple #34
0
def Verpasst_load(path,
                  datum):  # 5 Tages-Abschnitte in 1 Datei, path -> DictID
    PLog('Verpasst_load:' + path)
    li = xbmcgui.ListItem()

    page = loadPage(path)
    if page.startswith('Fehler') or page == '':
        msg1 = 'Fehler beim Abruf von:'
        msg2 = path
        MyDialog(msg1, msg2, '')
        xbmcplugin.endOfDirectory(HANDLE)
    PLog(len(page))

    jsonObject = json.loads(page)
    path = path.split('/')[-1]  # Pfadende -> Dict-ID
    v = path
    Dict("store", v, jsonObject)
    li = PageMenu(li, jsonObject, DictID=path)
    xbmcplugin.endOfDirectory(HANDLE)