Exemplo n.º 1
0
    def play(self, quality=None):
        self.playable = True

        try:
            if not self.properties.get('ForceResume', False) and sys.argv[3] == 'resume:true':
                self.properties.pop('ResumeTime', None)
                self.properties.pop('TotalTime', None)
        except:
            pass

        quality_player.parse(self, quality=quality, geolock=self.geolock)

        li     = self.get_li()
        handle = _handle()

        if self.play_next:
            data = {'playing_file': self.path, 'time': 0, 'next_file': None, 'show_dialog': True}
            data.update(self.play_next)

            if data['next_file']:
                data['next_file'] = router.add_url_args(data['next_file'], _play=1)

            set_kodi_string('_slyguy_play_next', json.dumps(data))

        if self.callback:
            data = {'type': 'interval', 'playing_file': self.path, 'interval': 0, 'callback': None}
            data.update(self.callback)
            set_kodi_string('_slyguy_play_callback', json.dumps(data))

        if handle > 0:
            xbmcplugin.setResolvedUrl(handle, True, li)
        else:
            xbmc.Player().play(self.path, li)
Exemplo n.º 2
0
 def playVideo(self, url, opt='live'):
     url = decodeString(url)
     log('playVideo, url = %s, opt = %s' % (url, opt))
     liz = xbmcgui.ListItem(path=url)
     liz.setProperty('IsPlayable', 'true')
     liz.setProperty('IsInternetStream', 'true')
     xbmcplugin.setResolvedUrl(ROUTER.handle, True, liz)
Exemplo n.º 3
0
 def playLive(self, id, opt='live'):
     log('playLive, id = %s, opt = %s' % (id, opt))
     if id == 'NEXT_SHOW':
         found = False
         liz = xbmcgui.ListItem()
         notificationDialog(LANGUAGE(30029), time=4000)
     else:
         found = True
         liz = self.resolveURL(id, opt)
         url = liz.getPath()
         if url.endswith('?deviceType='):
             url = url.replace(
                 'deviceType=',
                 'deviceType=&deviceMake=&deviceModel=&&deviceVersion=unknown&appVersion=unknown&deviceDNT=0&userId=&advertisingId=&app_name=&appName=&buildVersion=&appStoreUrl=&architecture=&includeExtendedEvents=false'
             )  #todo lazy fix replace
         if 'sid' not in url:
             url = url.replace(
                 'deviceModel=&',
                 'deviceModel=&' + LANGUAGE(30022) % (getUUID()))
         url = url.replace('deviceType=&', 'deviceType=web&').replace(
             'deviceMake=&', 'deviceMake=Chrome&').replace(
                 'deviceModel=&', 'deviceModel=Chrome&').replace(
                     'appName=&', 'appName=web&')  #todo replace with regex!
         log('playVideo, url = %s' % url)
         liz.setPath(url)
         if 'm3u8' in liz.getPath().lower() and inputstreamhelper.Helper(
                 'hls').check_inputstream():
             inputstream = getInputStream()
             liz.setProperty('inputstream', inputstream)
             liz.setProperty('%s.manifest_type' % (inputstream), 'hls')
             liz.setMimeType('application/vnd.apple.mpegurl')
     xbmcplugin.setResolvedUrl(ROUTER.handle, found, liz)
Exemplo n.º 4
0
 def _playDummyVid():
     dummy_video = OSPJoin(g.PLUGIN_PATH, 'resources', 'dummy.avi')
     xbmcplugin.setResolvedUrl(g.pluginhandle, True,
                               xbmcgui.ListItem(path=dummy_video))
     Log('Playing Dummy Video', Log.DEBUG)
     xbmc.Player().stop()
     return
Exemplo n.º 5
0
    def play_video(self, item_id, title, video_url):
        """
        Play a video by the provided path.
        """
        #

        if not video_url:
            raise ValueError('Missing video URL for {}'.format(item_id))

        logger.debug('Playing video: {}'.format(video_url))
        # Create a playable item with a path to play.

        play_item = xbmcgui.ListItem(label=title, path=video_url)

        header = self._get_headers()

        play_item.setProperty('inputstreamaddon', 'inputstream.adaptive')

        if (video_url.find('mpd') != -1):
            play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd')
            play_item.setMimeType('application/dash+xml')
        else:
            play_item.setProperty('inputstream.adaptive.manifest_type', 'hls')
            play_item.setMimeType('application/vnd.apple.mpegurl')

        play_item.setContentLookup(False)
        play_item.setProperty("inputstream.adaptive.stream_headers",
                              urllib_parse.urlencode(header))
        #
        #play_item.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha')
        #play_item.setProperty('inputstream.adaptive.license_key', licURL)

        # Pass the item to the Kodi player.
        xbmcplugin.setResolvedUrl(self.handle, True, listitem=play_item)
Exemplo n.º 6
0
def play(cat, channel_id):
    channels = TV.get_category_channel_by_id(cat, channel_id, cache_time)
    if channels.count() > 1:
        dialog = xbmcgui.Dialog()
        ret = dialog.select(
            "Choose Stream",
            [json.loads(c.relayer).get("fallbackUrl").split("?")[0] for c in channels],
        )
        if ret >= 0:
            channel = channels[ret]
        else:
            xbmcplugin.setResolvedUrl(plugin.handle, False, ListItem())
    else:
        channel = channels[0]

    if channel:
        title = channel.name
        image = channel.img
        stream = TV.get_stream_cast(channel.relayer)
        stream[1]["verifypeer"] = "false"
        li = ListItem(title, path=xbmc_curl_encode(stream))
        li.setArt({"thumb": image, "icon": image})
        li.setContentLookup(False)
        li.setMimeType("application/vnd.apple.mpegurl")
        xbmcplugin.setResolvedUrl(plugin.handle, True, li)
Exemplo n.º 7
0
 def playLive(self, id, opt='live'):
     log('playLive, id = %s, opt = %s' % (id, opt))
     if id == 'NEXT_SHOW':
         found = False
         liz = xbmcgui.ListItem(LANGUAGE(30029))
         notificationDialog(LANGUAGE(30012), time=4000)
     else:
         found = True
         liz = self.resolveURL(id, opt)
         url = liz.getPath()
         log('playLive, url = %s' % (url))
         if 'm3u8' in url.lower() and inputstreamhelper.Helper(
                 'hls').check_inputstream():
             if REAL_SETTINGS.getSettingBool('Enable_Timeshift'):
                 log('playLive, timeshift enabled')
                 liz.setProperty('inputstream', 'inputstream.ffmpegdirect')
                 liz.setProperty('inputstream.ffmpegdirect.stream_mode',
                                 'timeshift')
             else:
                 liz.setProperty('inputstream', 'inputstream.adaptive')
                 liz.setProperty('inputstream.adaptive.manifest_type',
                                 'hls')
         elif url.endswith('?format=ts'):
             log('playLive, TS-MPEG enabled')
             liz.setProperty('inputstream.adaptive.mime_type',
                             'vnd.apple.mpegurl')
     xbmcplugin.setResolvedUrl(ROUTER.handle, found, liz)
def play_vod():
    mytv.update_vod_channels()
    image_headers = {"User-Agent": mytv.user_agent}
    channel = int(plugin.args["channel"][0])
    stream_list = mytv.get_vodstreams_by_channel_id(channel)
    if stream_list.count() > 1:
        select_list = []
        for stream in stream_list:
            select_list.append(stream.quality)
        dialog = xbmcgui.Dialog()
        ret = dialog.select("Choose Stream", select_list)
        # if not
        selected_stream = stream_list[ret]
    else:
        selected_stream = stream_list[0]

    resolved_stream = mytv.resolve_stream(selected_stream)
    image = xbmc_curl_encode(
        (selected_stream.vodchannel.image_path, image_headers))
    title = selected_stream.vodchannel.name
    li = ListItem(title, path=xbmc_curl_encode(resolved_stream))
    li.setArt({"thumb": image, "icon": image})
    if "playlist.m3u8" in resolved_stream[0]:
        li.setContentLookup(False)
        li.setMimeType("application/vnd.apple.mpegurl")
        if addon.getSetting("inputstream") == "true":
            if sys.version_info[0] == 2:
                li.setProperty("inputstreamaddon", "inputstream.adaptive")
            else:
                li.setProperty("inputstream", "inputstream.adaptive")
            li.setProperty("inputstream.adaptive.manifest_type", "hls")
            li.setProperty("inputstream.adaptive.stream_headers",
                           urlencode(resolved_stream[1]))
    xbmcplugin.setResolvedUrl(plugin.handle, True, li)
Exemplo n.º 9
0
 def _display_dialog(self):
     use_extended_dialog = False
     try:
         json_mappings = json.loads(self.SETTINGS['mappings'])
     except ValueError:
         json_mappings = {}
     if json_mappings and self.SETTINGS['harmonycontrol']:
         for item in json_mappings:
             thematch = json_mappings.get(item, {}).get('match', '')
             self.LW.log(['checking for %s in %s' % (thematch, self.TITLE)])
             self.LW.log(
                 ['checking for %s in %s' % (thematch, self.MESSAGE)])
             if thematch.lower() in self.TITLE.lower() or thematch.lower(
             ) in self.MESSAGE.lower():
                 self.LW.log(['found match'])
                 activity, cmds = self._get_mapping_details(
                     json_mappings, item)
                 self.MESSAGE = '%s\n%s' % (
                     self.MESSAGE, self.SETTINGS['ADDONLANGUAGE'](32303))
                 use_extended_dialog = True
                 break
     if use_extended_dialog:
         if self.DIALOG.yesno(self.TITLE, self.MESSAGE):
             self._run_activity(activity, cmds)
     else:
         self.DIALOG.ok(self.TITLE, self.MESSAGE)
     pluginhandle = int(sys.argv[1])
     xbmcplugin.setContent(pluginhandle, 'files')
     play_item = xbmcgui.ListItem(path=os.path.join(
         self.SETTINGS['ADDONPATH'], 'resources', 'blank.mp4'))
     xbmcplugin.setResolvedUrl(pluginhandle, True, listitem=play_item)
Exemplo n.º 10
0
 def play_item(self, item, name, context):
     path = item.ManifestUrl
     resolved = True if path else False
     listitem = xbmcgui.ListItem()
     listitem.setContentLookup(False)
     listitem.setMimeType('application/dash+xml')
     listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
     listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
     listitem.setProperty('inputstream.adaptive.manifest_update_parameter',
                          'full')
     listitem.setProperty('inputstream.adaptive.max_bandwidth',
                          self.plugin.max_bw)
     listitem.setProperty('inputstream.adaptive.license_type',
                          'com.widevine.alpha')
     listitem.setProperty(
         'inputstream.adaptive.license_key',
         '{0}&{1}&_widevineChallenge=B{{SSM}}|||JBlicense'.format(
             item.LaUrl, item.LaUrlAuthParam))
     if context and resolved:
         listitem.setInfo('video', {'Title': name})
         xbmc.Player().play(path, listitem)
     else:
         listitem.setPath(path)
         xbmcplugin.setResolvedUrl(self.plugin.addon_handle, resolved,
                                   listitem)
Exemplo n.º 11
0
def _failed_playback():
    handle = _handle()
    xbmcplugin.setResolvedUrl(handle, False, Item(path='http://').get_li())
    xbmcplugin.endOfDirectory(handle,
                              succeeded=True,
                              updateListing=False,
                              cacheToDisc=False)
Exemplo n.º 12
0
def get_stream(id):
    url = '/details/media/%s/US?format=json' % id
    json_source = json_request(url)
    stream_url = ''
    stream_480_url = ''
    for stream in json_source['MediaURLs']:
        if 'Widevine_DASH' in stream['Type']:            
            stream_url = stream['DRMPath']
        if any(t in stream['Type'] for t in ['480p_1mbps.mp4', '480p.mp4']):
            stream_480_url = stream['Path']

    headers = 'User-Agent='+UA_WEB
    listitem = xbmcgui.ListItem()
    lic_url = 'https://license-wv.crackle.com/raw/license/widevine/%s/us' % id
    license_key = '%s|%s&Content-Type=application/octet-stream|R{SSM}|' % (lic_url,headers)
    if 'mpd' in stream_url:
        is_helper = inputstreamhelper.Helper('mpd', drm='widevine')
        if not is_helper.check_inputstream():
            sys.exit()
        listitem.setPath(stream_url)
        listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
        listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
        listitem.setProperty('inputstream.adaptive.stream_headers', 'User-Agent=%s' % UA_WEB)
        listitem.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha')
        listitem.setProperty('inputstream.adaptive.license_key', license_key)
        listitem.setMimeType('application/dash+xml')
        listitem.setContentLookup(False)
    else:
        stream_url = stream_480_url + "|" + headers
        listitem.setPath(stream_url)

    xbmcplugin.setResolvedUrl(addon_handle, True, listitem)
Exemplo n.º 13
0
def playvid(videourl, name, download=None):
    if download == 1:
        downloadVideo(videourl, name)
    else:
        iconimage = xbmc.getInfoImage("ListItem.Thumb")
        subject = xbmc.getInfoLabel("ListItem.Plot")
        listitem = xbmcgui.ListItem(name)
        listitem.setArt({'thumb': iconimage, 'icon': "DefaultVideo.png", 'poster': iconimage})
        listitem.setInfo('video', {'Title': name, 'Genre': 'P**n', 'plot': subject, 'plotoutline': subject})

        if videourl.startswith('is://') or '.mpd' in videourl:
            videourl = videourl[5:] if videourl.startswith('is://') else videourl
            if PY2:
                listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
            else:
                listitem.setProperty('inputstream', 'inputstream.adaptive')
            if '|' in videourl:
                videourl, strhdr = videourl.split('|')
                listitem.setProperty('inputstream.adaptive.stream_headers', strhdr)
            if '.m3u8' in videourl:
                listitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
                listitem.setMimeType('application/vnd.apple.mpegstream_url')
            elif '.mpd' in videourl:
                listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
                listitem.setMimeType('application/dash+xml')
            elif '.ism' in videourl:
                listitem.setProperty('inputstream.adaptive.manifest_type', 'ism')
                listitem.setMimeType('application/vnd.ms-sstr+xml')
            listitem.setContentLookup(False)

        if int(sys.argv[1]) == -1:
            xbmc.Player().play(videourl, listitem)
        else:
            listitem.setPath(str(videourl))
            xbmcplugin.setResolvedUrl(addon_handle, True, listitem)
Exemplo n.º 14
0
    def playVOD(self, id):
        log('playVOD, id = %s' % id)
        data = self.getClips(id)[0]
        if not data: return
        name = data.get('name', '')
        epdur = (data.get('duration', 0) // 1000)
        url = (data.get('url', '')
               or data.get('sources', [])[0].get('file', ''))
        liz = xbmcgui.ListItem(name)
        liz.setPath(url)
        liz.setInfo(type="Video",
                    infoLabels={
                        "mediatype": "video",
                        "label": name,
                        "title": name,
                        "duration": epdur
                    })
        liz.setArt({
            'thumb': data.get('thumbnail', ICON),
            'fanart': data.get('thumbnail', FANART)
        })
        liz.setProperty("IsPlayable", "true")
        liz.setProperty('IsInternetStream', 'true')

        if 'm3u8' in url.lower() and inputstreamhelper.Helper(
                'hls').check_inputstream():
            inputstream = getInputStream()
            liz.setProperty('inputstream', inputstream)
            liz.setProperty('%s.manifest_type' % (inputstream), 'hls')
            liz.setProperty('http-reconnect', 'true')
            liz.setMimeType('application/vnd.apple.mpegurl')
        xbmcplugin.setResolvedUrl(ROUTER.handle, True, liz)
Exemplo n.º 15
0
def resolve(name, url, iconimage, description):
    xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}'.format(urllib.quote_plus(client.agent()))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        url = base_url + url if url.startswith('/') else url
        info = client.request(url, headers=headers)
        head = client.parseDOM(info, 'title')[0].encode('utf-8')
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''\,url:['"](.+?)['"]\}''', info, re.DOTALL)[0]
        link += '|User-Agent={}&Referer={}'.format(
            urllib.quote_plus(client.agent()), urllib.quote_plus(url))
        liz = xbmcgui.ListItem(head, iconImage=ICON, thumbnailImage=poster)

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(link))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
Exemplo n.º 16
0
 def play(self, item, quality=0):
     if quality == 7:  # inputstream.adaptive
         if not Helper("hls").check_inputstream():
             return False
         item.setProperty("inputstreamaddon", "inputstream.adaptive")
         item.setProperty("inputstream.adaptive.manifest_type", "hls")
     xbmcplugin.setResolvedUrl(self.handle, True, item)
     return True
def _json(url):
    with closing(urllib_request.urlopen(url)) as response:
        if response.code == 300:
            raise PlayerException(response.info().getheader('Location'))
        elif response.code == 301:
            raise RedirectException(response.info().getheader('Location'))
        elif 302 <= response.code <= 307:
            pause_current_playing_file_avoiding_doubling_request()

            _infoLabels = InfoLabels(getInfoLabels())
            if 'mediatype' not in _infoLabels or not _infoLabels['mediatype']:
                _infoLabels['mediatype'] = 'episode'
                _infoLabels['dbtype'] = 'episode'

            if PLATFORM['kodi'] >= 19:
                item = xbmcgui.ListItem(
                    path=response.geturl(),
                    label=_infoLabels["label"],
                    label2=_infoLabels["label2"]
                )
            else:
                item = xbmcgui.ListItem(
                    path=response.geturl(),
                    label=_infoLabels["label"],
                    label2=_infoLabels["label2"],
                    thumbnailImage=_infoLabels["thumbnail"]
                )

            item.setArt({
                "thumb": _infoLabels["artthumb"],
                "poster": _infoLabels["artposter"],
                "tvshowposter": _infoLabels["arttvshowposter"],
                "banner": _infoLabels["artbanner"],
                "fanart": _infoLabels["artfanart"],
                "clearart": _infoLabels["artclearart"],
                "clearlogo": _infoLabels["artclearlogo"],
                "landscape": _infoLabels["artlandscape"],
                "icon": _infoLabels["articon"]
            })

            if 'castmembers' in _infoLabels:
                if PLATFORM['kodi'] >= 17:
                    item.setCast(_infoLabels['castmembers'])
                del _infoLabels['castmembers']

            _infoLabels = normalize_labels(_infoLabels)

            item.setInfo(type='Video', infoLabels=_infoLabels)
            xbmcplugin.setResolvedUrl(HANDLE, True, item)
            return

        payload = to_unicode(response.read())

        try:
            if payload:
                return json.loads(payload)
        except:
            raise Exception(payload)
Exemplo n.º 18
0
    def play(self, **kwargs):
        self.playable = True

        quality = kwargs.get(QUALITY_TAG, self.quality)
        is_live = ROUTE_LIVE_TAG in kwargs

        if quality is None:
            quality = settings.getEnum('default_quality',
                                       QUALITY_TYPES,
                                       default=QUALITY_ASK)
            if quality == QUALITY_CUSTOM:
                quality = int(settings.getFloat('max_bandwidth') * 1000000)
        else:
            quality = int(quality)

        self.proxy_data['quality'] = quality

        if self.resume_from is not None and self.resume_from < 0:
            self.play_skips.append({'to': int(self.resume_from)})
            self.resume_from = 1

        li = self.get_li()
        handle = _handle()

        if self.play_next:
            data = {
                'playing_file': self.path,
                'time': 0,
                'next_file': None,
                'show_dialog': True
            }
            data.update(self.play_next)

            if data['next_file']:
                data['next_file'] = router.add_url_args(data['next_file'],
                                                        _play=1)

            set_kodi_string('_slyguy_play_next', json.dumps(data))

        if self.play_skips:
            data = {'playing_file': self.path, 'skips': self.play_skips}
            set_kodi_string('_slyguy_play_skips', json.dumps(data))

        if self.callback:
            data = {
                'type': 'interval',
                'playing_file': self.path,
                'interval': 0,
                'callback': None
            }
            data.update(self.callback)
            set_kodi_string('_slyguy_play_callback', json.dumps(data))

        if handle > 0:
            xbmcplugin.setResolvedUrl(handle, True, li)
        else:
            xbmc.Player().play(self.path, li)
Exemplo n.º 19
0
def PlayVideo(url, title, thumb, Plot, sub_path=None, Merk='false'):
    PLog('PlayVideo:')
    PLog(url)
    PLog(title)
    PLog(Plot)
    PLog(sub_path)

    # Header-Check: Flickr gibt bei Fehlern HTML-Seite zurück
    #	Bsp.:  <h1>This page is private.</h1>
    #	OK: content-type': 'video/mp4'

    # Fehlervideo nicht benötigt (Zugriff nur auf öffentl. Inhalte)
    # 01.12.2019 Header-Check gelöscht, dto. in RequestUrl,
    #if 'text/html' in str(page):				# ffmpeg-erzeugtes Fehlerbild-mp4-Video (10 sec)
    #	PLog('Error: Textpage ' + url)
    #	url =  os.path.join("%s", 'PrivatePage720x640.mp4') % (RESOURCES_PATH)
    #	return PlayVideo(url, title, thumb, Plot)

    li = xbmcgui.ListItem(path=url)
    li.setArt({'thumb': thumb, 'icon': thumb})

    Plot = Plot.replace('||', '\n')  # || Code für LF (\n scheitert in router)
    infoLabels = {}
    infoLabels['title'] = title
    infoLabels['sorttitle'] = title
    #infoLabels['genre'] = genre
    #infoLabels['plot'] = Plot
    #infoLabels['plotoutline'] = Plot
    infoLabels['tvshowtitle'] = Plot
    infoLabels['tagline'] = Plot
    infoLabels['mediatype'] = 'video'
    li.setInfo(type="Video", infoLabels=infoLabels)

    # Abfrage: ist gewählter Eintrag als Video deklariert? - Falls ja,	# IsPlayable-Test
    #	erfolgt der Aufruf indirekt (setResolvedUrl). Falls nein,
    #	wird der Player direkt aufgerufen. Direkter Aufruf ohne IsPlayable-Eigenschaft
    #	verhindert Resume-Funktion.
    # Mit xbmc.Player() ist  die Unterscheidung Kodi V18/V17 nicht mehr erforderlich,
    #	xbmc.Player().updateInfoTag bei Kodi V18 entfällt.
    # Die Player-Varianten PlayMedia + XBMC.PlayMedia scheitern bei Kommas in Url.
    #
    IsPlayable = xbmc.getInfoLabel(
        'ListItem.Property(IsPlayable)')  # 'true' / 'false'
    PLog("IsPlayable: %s, Merk: %s" % (IsPlayable, Merk))
    PLog("kodi_version: " + KODI_VERSION)  # Debug
    # kodi_version = re.search('(\d+)', KODI_VERSION).group(0) # Major-Version reicht hier - entfällt

    #if Merk == 'true':										# entfällt bisher - erfordert
    #	xbmc.Player().play(url, li, windowed=False) 		# eigene Resumeverwaltung
    #	return

    if IsPlayable == 'true':  # true
        xbmcplugin.setResolvedUrl(HANDLE, True, li)  # indirekt
    else:  # false, None od. Blank
        xbmc.Player().play(url, li, windowed=False)  # direkter Start
    return
Exemplo n.º 20
0
 def playLive(self, id, opt='live'):
     log('playLive, id = %s, opt = %s' % (id, opt))
     if id == 'NEXT_SHOW':
         found = False
         liz = xbmcgui.ListItem(LANGUAGE(30029))
         notificationDialog(LANGUAGE(30029))
     else:
         found = True
         liz = self.resolveURL(id, opt)
     xbmcplugin.setResolvedUrl(ROUTER.handle, found, liz)
Exemplo n.º 21
0
def failed_playback():
    handle = _handle()
    xbmcplugin.setResolvedUrl(handle, False, Item(path='http').get_li())
    xbmcplugin.endOfDirectory(handle,
                              succeeded=True,
                              updateListing=False,
                              cacheToDisc=False)
    if KODI_VERSION < 18:
        xbmc.PlayList(xbmc.PLAYLIST_MUSIC).clear()
        xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
Exemplo n.º 22
0
 def play(self, item, manifest, mime=None):
     if not Helper(manifest).check_inputstream():
         return False
     item.setProperty("inputstreamaddon", "inputstream.adaptive")
     item.setProperty("inputstream.adaptive.manifest_type", manifest)
     if mime:
         item.setMimeType(mime)
         item.setContentLookup(False)
     xbmcplugin.setResolvedUrl(self.handle, True, item)
     return True
Exemplo n.º 23
0
    def play(self, quality=None):
        self.playable = True

        try:
            if not self.properties.get('ForceResume',
                                       False) and sys.argv[3] == 'resume:true':
                self.properties.pop('ResumeTime', None)
                self.properties.pop('TotalTime', None)
        except:
            pass

        if quality is None:
            quality = settings.getEnum('default_quality',
                                       QUALITY_TYPES,
                                       default=QUALITY_ASK)
            if quality == QUALITY_CUSTOM:
                quality = int(settings.getFloat('max_bandwidth') * 1000000)
        else:
            quality = int(quality)

        self.proxy_data['quality'] = quality

        li = self.get_li()
        handle = _handle()

        if self.play_next:
            data = {
                'playing_file': self.path,
                'time': 0,
                'next_file': None,
                'show_dialog': True
            }
            data.update(self.play_next)

            if data['next_file']:
                data['next_file'] = router.add_url_args(data['next_file'],
                                                        _play=1)

            set_kodi_string('_slyguy_play_next', json.dumps(data))

        if self.callback:
            data = {
                'type': 'interval',
                'playing_file': self.path,
                'interval': 0,
                'callback': None
            }
            data.update(self.callback)
            set_kodi_string('_slyguy_play_callback', json.dumps(data))

        if handle > 0:
            xbmcplugin.setResolvedUrl(handle, True, li)
        else:
            xbmc.Player().play(self.path, li)
Exemplo n.º 24
0
 def playLive(self, tunerkey, channel, opt='live'):
     log('playLive, channel = %s, opt = %s'%(channel,opt))
     self.setDevice(tunerkey)
     if channel == 'NEXT_SHOW': 
         found = False
         liz   = xbmcgui.ListItem(LANGUAGE(30029))
         notificationDialog(LANGUAGE(30029), time=4000)
     else:            
         found = True
         liz   = self.resolveURL(tunerkey,channel,opt)
     xbmcplugin.setResolvedUrl(ROUTER.handle, found, liz)
Exemplo n.º 25
0
 def playLive(self, id, epid=None, opt='live'):
     log('playLive, id = %s, epid = %s, opt = %s' % (id, epid, opt))
     #if opt == 'pvr', find epid.
     if id == 'NEXT_SHOW':
         found = False
         liz = xbmcgui.ListItem()
         notificationDialog(LANGUAGE(30029), time=4000)
     else:
         found = True
         liz = self.resolveURL(id, epid, opt)
         log('playLive, url = %s' % (liz.getPath()))
     xbmcplugin.setResolvedUrl(ROUTER.handle, found, liz)
Exemplo n.º 26
0
 def playVideo(self, name, uri):
     log('playVideo, uri = ' + uri)
     liz = self.buildListitem(uri)
     url = liz.getPath()
     log('playVideo, uri = %s, url = %s'%(uri,url))
     if url.startswith('upnp://'):
         xbmc.executebuiltin('PlayMedia(%s)'%url)
     else:
         if url.strip('/').endswith('.m3u8'):
             liz.setProperty('inputstreamaddon','inputstream.adaptive')
             liz.setProperty('inputstream.adaptive.manifest_type','hls')
         xbmcplugin.setResolvedUrl(int(self.sysARG[1]), True, liz)
def run(context, url, prefix=None, indirect=None, transcode=False):
    context.plex_network = plex.Plex(context.settings, load=True)

    server = context.plex_network.get_server_from_url(url)
    if 'node.plexapp.com' in url:
        server = get_master_server(context)

    session = None

    if indirect:
        # Probably should transcode this
        if url.startswith('http'):
            url = '/' + url.split('/', 3)[3]
            transcode = True

        url, session = server.get_universal_transcode(url)

    # if we have a plex URL, then this is a transcoding URL
    if 'plex://' in url:
        LOG.debug('found webkit video, pass to transcoder')
        if not prefix:
            prefix = 'system'
            url, session = server.get_universal_transcode(url)

        # Workaround for Kodi HLS request limit of 1024 byts
        if len(url) > 1000:
            LOG.debug('Kodi HLS limit detected, will pre-fetch m3u8 playlist')

            playlist = get_xml(context, url)

            if not playlist or '# EXTM3U' not in playlist:
                LOG.debug('Unable to get valid m3u8 playlist from transcoder')
                return

            server = context.plex_network.get_server_from_url(url)
            session = playlist.split()[-1]
            url = server.join_url(
                server.get_url_location(),
                'video/:/transcode/segmented/%s?t=1' % session)

    LOG.debug('URL to Play: %s ' % url)
    LOG.debug('Prefix is: %s' % prefix)

    # If this is an Apple movie trailer, add User Agent to allow access
    if 'trailers.apple.com' in url:
        url = url + '|User-Agent=QuickTime/7.6.9 (qtver=7.6.9;os=Windows NT 6.1Service Pack 1)'

    LOG.debug('Final URL is: %s' % url)
    xbmcplugin.setResolvedUrl(get_handle(), True, _list_item(url))

    _monitor_transcode(context, server, session, transcode)
    DATA_CACHE.delete_cache(True)
Exemplo n.º 28
0
    def resolve(self, li):
        if self.extern and not self.checkResume():
            xbmcplugin.setResolvedUrl(self._g.pluginhandle, True, xbmcgui.ListItem())
            xbmc.executebuiltin('Container.Refresh')
            return
        if self.resume:
            li.setProperty('resumetime', str(self.resume))
            li.setProperty('totaltime', '1')
            Log('Resuming Video at %s' % self.resume)

        xbmcplugin.setResolvedUrl(self._g.pluginhandle, True, li)
        self.running = True
        self.getTimes('Starting Playback')
Exemplo n.º 29
0
def get_movie(s, mainurl, mainurlajax, headers=None):

    check_sorry_message = "Our servers are almost maxed"
    check_go_premium = "Go Premium"

    htm=s.get(mainurl, headers=headers, cookies=s.cookies).text

    if re.search(check_sorry_message, htm):
        xbmcgui.Dialog().ok(
            "Server Error",
            "Sorry. Einthusan servers are almost maxed. Please try again in 5 - 10 mins or upgrade to a Lifetime Premium account.",
        )
        return False

    if re.search(check_go_premium, htm):
        xbmcgui.Dialog().ok(
            "UltraHD Error",
            "Premium Membership Required for UltraHD Movies. Please add Premium Membership Login details in Addon Settings.",
        )
        return False

    lnk=re.findall('data-ejpingables=["\'](.*?)["\']',htm)[0]

    r=decodeEInth(lnk)
    jdata='{"EJOutcomes":"%s","NativeHLS":false}'%lnk

    gid=re.findall('data-pageid=["\'](.*?)["\']',htm)[0]

    gid=html.unescape(gid)

    postdata={'xEvent':'UIVideoPlayer.PingOutcome','xJson':jdata,'arcVersion':'3','appVersion':'59','gorilla.csrf.Token':gid}

    rdata=s.post(mainurlajax,headers=headers,data=postdata,cookies=s.cookies).text

    r=json.loads(rdata)["Data"]["EJLinks"]
    xbmc.log(base64.b64decode(str(decodeEInth(r))).decode('ascii'), level=xbmc.LOGINFO)
    lnk=json.loads(base64.b64decode(decodeEInth(r)).decode('ascii'))["HLSLink"]

    lnk = preferred_server(lnk, mainurl)

    xbmc.log(lnk, level=xbmc.LOGINFO)

    urlnew=lnk+('|'+einthusanRedirectUrl+'&Referer=%s&User-Agent=%s'%(mainurl,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'))
    # listitem = xbmcgui.ListItem( label = str(name), icon = "DefaultVideo.png", thumb = xbmc.getInfoImage( "ListItem.Thumb" ) )
    listitem = xbmcgui.ListItem(label = str(name))

    #listitem.setProperty('IsPlayable', 'true')
    listitem.setPath(urlnew)
    xbmcplugin.setResolvedUrl(_plugin_handle, True, listitem)

    s.close()
Exemplo n.º 30
0
def resolve(name, url, iconimage, description):
    # xbmc.log('URLLLL: {}'.format(url))
    if 'm3u8' in url:
        link = url
        link += '|User-Agent={}&Referer={}'.format(
            'iPad', quote_plus(headers['Referer']))
        liz = xbmcgui.ListItem(name, iconImage=ICON, thumbnailImage=iconimage)
    else:
        import requests
        url = base_url + url if url.startswith('/') else url
        # xbmc.log('URLLLL2: {}'.format(url))
        # cj = client.request(base_url, headers=headers, output='cookie')
        # xbmc.log('COOKIES: {}'.format(str(cj)))
        # headers['Cookie'] = cj
        info = requests.get(url, headers=headers).text
        info = six.ensure_str(info, encoding='utf-8')
        # xbmc.log('INFOOOO: {}'.format(info))
        head = client.parseDOM(info, 'title')[0]
        # title = client.parseDOM(info, 'meta', ret='content', attrs={'name': 'description'})[0].encode('utf-8')
        # name = '{0} - {1}'.format(head, title)
        poster = client.parseDOM(info,
                                 'meta',
                                 ret='content',
                                 attrs={'property': 'og:image'})[0]
        link = re.findall(r'''source:['"](.+?)['"]\,''', info, re.DOTALL)[0]
        link = "https://hd-auth.skylinewebcams.com/" + link.replace(
            'livee', 'live') if link.startswith('live') else link
        # xbmc.log('LINK: {}'.format(link))
        link += '|User-Agent=iPad&Referer={}'.format(BASEURL)
        if six.PY2:
            head = head.encode('utf-8')
            link = str(link)
        liz = xbmcgui.ListItem(head)
        liz.setArt({
            'icon': iconimage,
            'thumb': iconimage,
            'poster': poster,
            'fanart': fanart
        })

    try:
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(link)
        # control.player.play(link, liz)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog(
            "[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]",
            NAME, '')
Exemplo n.º 31
0
def setResolvedUrl(**ka):
    return xbmcplugin.setResolvedUrl(**ka)