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 = ""
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 = ""