Exemplo n.º 1
0
def play(params):
    plugintools.log("dandb.play "+repr(params))

    #plugintools.set_view(plugintools.LIST)

    try:
        url = params.get("url")
        plugintools.log("dandb.play url="+repr(url))

        if url=="":
            return

        from urlresolver.types import HostedMediaFile
        hosted_media_file = HostedMediaFile(url=url)
        plugintools.log("dandb.play hosted_media_file="+repr(hosted_media_file))

        try:
            media_url = hosted_media_file.resolve()
            plugintools.log("dandb.play media_url="+repr(media_url))

            if media_url:
                #plugintools.add_item( action="playable", title="Play this video from "+hosted_media_file.get_host()+"", url=media_url, isPlayable=True, folder=False )
                plugintools.play_resolved_url( media_url )    
            else:
                plugintools.play_resolved_url( url )    
        except:
            import traceback
            plugintools.log(traceback.format_exc())
            #plugintools.add_item( action="play", title="Error while getting access to video", isPlayable=True, folder=False )
            plugintools.message("D&B TV","Error while getting access to video")

    except urllib2.URLError,e:
        #plugintools.add_item( action="play", title="Error reading data, please try again", isPlayable=True, folder=False )
        plugintools.message("D&B TV","Connection error while getting access to video")
        body = ""
Exemplo n.º 2
0
def play(params):
    plugintools.log("movie4k.play "+repr(params))

    #plugintools.set_view(plugintools.LIST)

    try:
        body,response_headers = read_body_and_headers(params.get("url"))
        plugintools.log("movie4k.play body="+repr(body))

        url = plugintools.find_single_match(body,'<a target="_blank" href="([^"]+)">')
        plugintools.log("movie4k.play url="+repr(url))

        if url=="":
            url = plugintools.find_single_match(body,'<iframe.*?src="([^"]+)"')

        if url!="":
            if url.startswith("http://www.nowvideo.sx/video/"):
                url = url.replace("http://www.nowvideo.sx/video/","http://embed.nowvideo.eu/embed.php?v=")+"&width=600&height=480"

            from urlresolver.types import HostedMediaFile
            hosted_media_file = HostedMediaFile(url=url)
            plugintools.log("movie4k.play hosted_media_file="+repr(hosted_media_file))

            try:
                media_url = hosted_media_file.resolve()
                plugintools.log("movie4k.play media_url="+repr(media_url))

                if media_url:
                    plugintools.add_item( action="playable", title="Play this video from [B]"+hosted_media_file.get_host()+"[/B] ["+get_filename_from_url(media_url)[-4:]+"]", url=media_url, isPlayable=True, folder=False )
                else:
                    plugintools.add_item( action="play", title="This video is not playable", isPlayable=True, folder=False )
            except:
                plugintools.add_item( action="play", title="This hoster is not working at this moment", isPlayable=True, folder=False )
                plugintools.add_item( action="play", title="Please select other option", isPlayable=True, folder=False )

        else:
            plugintools.add_item( action="play", title="No valid links found", isPlayable=True, folder=False )

    except urllib2.URLError,e:
        plugintools.add_item( action="play", title="Error reading data from movie4k.to, please try again", isPlayable=True, folder=False )
        body = ""
Exemplo n.º 3
0
def resolveURL(url, label):
    try:
        media_source = HostedMediaFile(url)
        print "Resolving %s" % url
        file_url = media_source.resolve()
        if file_url:
            media_labels = media_source.get_media_labels()
            if not media_labels.get("title", ""):
                media_labels["title"] = label
            li = xbmcgui.ListItem(label=media_labels["title"], path=file_url)
            li.setProperty("IsPlayable", "true")
            # li.setThumbnailImage(media_labels['icon'])
            return (li, file_url)
        else:
            xbmc.log("%s: Non playable URL" % (addon_id), xbmc.LOGNOTICE)
            # xbmcplugin.setResolvedUrl(addon_handle, succeeded=False, listitem=li)
    except KeyError:
        xbmc.log("%s: Missing URL" % (addon_id), xbmc.LOGNOTICE)
    except:
        xbmc.log("%s: Unhandled exception %s" % (addon_id, sys.exc_info()[0]), xbmc.LOGNOTICE)
    return (None, "")
Exemplo n.º 4
0
def resolveURL(url, label):
    try:
        media_source = HostedMediaFile(url)
        print "Resolving %s" % url
        file_url = media_source.resolve()
        if file_url:
            media_labels = media_source.get_media_labels()
            if not media_labels.get('title', ''):
                media_labels['title'] = label
            li = xbmcgui.ListItem(label=media_labels['title'], path=file_url)
            li.setProperty('IsPlayable', 'true')
            # li.setThumbnailImage(media_labels['icon'])
            return (li, file_url)
        else:
            xbmc.log("%s: Non playable URL" % (addon_id), xbmc.LOGNOTICE)
            # xbmcplugin.setResolvedUrl(addon_handle, succeeded=False, listitem=li)
    except KeyError:
        xbmc.log("%s: Missing URL" % (addon_id), xbmc.LOGNOTICE)
    except:
        xbmc.log("%s: Unhandled exception %s" % (addon_id, sys.exc_info()[0]),
                 xbmc.LOGNOTICE)
    return (None, '')
    def getHoster(self, sHosterFileName):
        """
        interfaces urlresolver to find supported hoster..

        :param sHosterFileName: str, link to media as scraped from page
        :returns str: the hostname of the hoster or False
        """
        if sHosterFileName != '':
            source = [HostedMediaFile(url=sHosterFileName)]
            valid_sources = urlresolver.filter_source_list(source)
            if valid_sources:
                return valid_sources[0].get_host()
        return False
Exemplo n.º 6
0
def play(params):
    plugintools.log("movie4k.play " + repr(params))

    #plugintools.set_view(plugintools.LIST)

    try:
        body, response_headers = read_body_and_headers(params.get("url"))
        plugintools.log("movie4k.play body=" + repr(body))

        url = plugintools.find_single_match(
            body, '<a target="_blank" href="([^"]+)">')
        plugintools.log("movie4k.play url=" + repr(url))

        if url == "":
            url = plugintools.find_single_match(body,
                                                '<iframe.*?src="([^"]+)"')

        if url != "":
            if url.startswith("http://www.nowvideo.sx/video/"):
                url = url.replace("http://www.nowvideo.sx/video/",
                                  "http://embed.nowvideo.eu/embed.php?v="
                                  ) + "&width=600&height=480"

            from urlresolver.types import HostedMediaFile
            hosted_media_file = HostedMediaFile(url=url)
            plugintools.log("movie4k.play hosted_media_file=" +
                            repr(hosted_media_file))

            try:
                media_url = hosted_media_file.resolve()
                plugintools.log("movie4k.play media_url=" + repr(media_url))

                if media_url:
                    plugintools.add_item(
                        action="playable",
                        title="Play this video from [B]" +
                        hosted_media_file.get_host() + "[/B] [" +
                        get_filename_from_url(media_url)[-4:] + "]",
                        url=media_url,
                        isPlayable=True,
                        folder=False)
                else:
                    plugintools.add_item(action="play",
                                         title="This video is not playable",
                                         isPlayable=True,
                                         folder=False)
            except:
                plugintools.add_item(
                    action="play",
                    title="This hoster is not working at this moment",
                    isPlayable=True,
                    folder=False)
                plugintools.add_item(action="play",
                                     title="Please select other option",
                                     isPlayable=True,
                                     folder=False)

        else:
            plugintools.add_item(action="play",
                                 title="No valid links found",
                                 isPlayable=True,
                                 folder=False)

    except urllib2.URLError, e:
        plugintools.add_item(
            action="play",
            title="Error reading data from movie4k.to, please try again",
            isPlayable=True,
            folder=False)
        body = ""