def playVideoList(videos_ids):
	# Displaying progress dialog
	pDialog = xbmcgui.DialogProgress();
	pDialog.create(_(30002), _(30003)); # pDialog.create("Fetching videos", "Loading episode parts...")

	if (ga["enabled"]):
		tracker.send("event", "Usage", "Play Video", "episode", screenName="Play Screen");

	xbmcPlaylist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO);
	xbmcPlaylist.clear();
	
	pDialogCount = 0;
	pDialogLength = len(videos_ids);
	for video_id in videos_ids:
		pDialogCount = pDialogCount + 1;
		pDialog.update(int(90*pDialogCount/float(pDialogLength)), _(30004).format(str(pDialogCount),str(pDialogLength)));
		
		iframe = network.fetchUrl(urls["video"].replace("$videoId", video_id));
		video = parseMediaInfo(iframe);
		
		if ("error" in video and video["error"] == True):
			xbmc.log("["+_(30006)+"]: Unable to find video for ID "+video_id, 0);
		
			# taking note from the amount of errors the SBT API may throw
			if (ga["enabled"]):
				tracker.send("event", "Usage", "error", screenName="Play Screen");
		
			# do nothing
			toaster = xbmcgui.Dialog();
			try:
				toaster.notification(_(30006), _(30103), xbmcgui.NOTIFICATION_WARNING, 3000);
			except AttributeError:
				toaster.ok(_(30006), _(30103));
			pass
		else:
			addon.setWatched(video_id, True);
			video_thumb = getVideoThumbnail(video);
			xbmcVideo = getXbmcVideoFromVideo(video, video_thumb);
			if (xbmcVideo != None):
				xbmcPlaylist.add(xbmcVideo["url"], xbmcVideo["listitem"]);
					
	# Closing progress dialog
	pDialog.update(100, _(30005));
	pDialog.close();
	if (addon.getSetting("useUnblockBrazil") == "true"):
		# first we cheat XMBC into saving the correct cookie from Unblock Brazil website
		xbmc.Player().play(unblockBrazilHome);
		# then we pass the redirected video url for XBMC
	
	xbmc.Player().play(xbmcPlaylist);
	xbmc.executebuiltin("Container.Refresh");
def playVideo(video_id):
    # log("video url: "+urls["video"].replace("$videoId", video_id));
    iframe = network.fetchUrl(urls["video"].replace("$videoId", video_id))
    video = parseMediaInfo(iframe)

    if (ga["enabled"]):
        tracker.send("event",
                     "Usage",
                     "Play Video",
                     "unique",
                     screenName="Play Screen")
        if (useWebProxy):
            tracker.send("event",
                         "Web Proxy",
                         proxyServer["host"],
                         "unique",
                         screenName="Play Screen")

    # Sambatech url never gave an error, so we are skipping error recovery for this part
    # log("video: "+json.dumps(video));
    if (video is None or ("error" in video and video["error"] == True)):
        xbmc.log("[" + _(30006) + "]: Unable to find video for ID " + video_id,
                 0)

        # taking note from the amount of errors the SBT API may throw
        if (ga["enabled"]):
            tracker.send("event", "Usage", "error", screenName="Play Screen")

        # do nothing
        toaster = xbmcgui.Dialog()
        try:
            toaster.notification(_(30006), _(30103),
                                 xbmcgui.NOTIFICATION_WARNING, 3000)
        except AttributeError:
            toaster.ok(_(30006), _(30103))
        pass
    else:
        addon.setWatched(video_id, True)
        video_thumb = getVideoThumbnail(video)
        xbmcVideo = getXbmcVideoFromVideo(video, video_thumb)
        if (xbmcVideo != None):
            if (useWebProxy):
                # first we cheat XMBC into saving the correct cookie from Unblock Brazil website
                xbmc.Player().play(proxyServer["home"])
                # then we pass the redirected video url for XBMC

            xbmc.Player().play(xbmcVideo["url"], xbmcVideo["listitem"])

    xbmc.executebuiltin("Container.Refresh")
def playVideo(video_id):
	log("video url: "+urls["video"].replace("$videoId", video_id));
	iframe = network.fetchUrl(urls["video"].replace("$videoId", video_id));
	video = parseMediaInfo(iframe);
	
	if (ga["enabled"]):
		tracker.send("event", "Usage", "Play Video", "unique", screenName="Play Screen");
	
	# Sambatech url never gave an error, so we are skipping error recovery for this part
	log("video: "+json.dumps(video));
	if ("error" in video and video["error"] == True):
		xbmc.log("["+_(30006)+"]: Unable to find video for ID "+video_id, 0);
		
		# taking note from the amount of errors the SBT API may throw
		if (ga["enabled"]):
			tracker.send("event", "Usage", "error", screenName="Play Screen");
		
		# do nothing
		toaster = xbmcgui.Dialog();
		try:
			toaster.notification(_(30006), _(30103), xbmcgui.NOTIFICATION_WARNING, 3000);
		except AttributeError:
			toaster.ok(_(30006), _(30103));
		pass
	else:
		addon.setWatched(video_id, True);
		video_thumb = getVideoThumbnail(video);
		xbmcVideo = getXbmcVideoFromVideo(video, video_thumb);
		if (xbmcVideo != None):
			if (addon.getSetting("useUnblockBrazil") == "true"):
				# first we cheat XMBC into saving the correct cookie from Unblock Brazil website
				xbmc.Player().play(unblockBrazilHome);
				# then we pass the redirected video url for XBMC
		
			xbmc.Player().play(xbmcVideo["url"], xbmcVideo["listitem"]);
	
	xbmc.executebuiltin("Container.Refresh");
Example #4
0
def playVideoList(videos_ids):
    # Displaying progress dialog
    pDialog = xbmcgui.DialogProgress()
    pDialog.create(_(30002), _(30003))
    # pDialog.create("Fetching videos", "Loading episode parts...")

    if (ga["enabled"]):
        tracker.send("event",
                     "Usage",
                     "Play Video",
                     "episode",
                     screenName="Play Screen")

    xbmcPlaylist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    xbmcPlaylist.clear()

    pDialogCount = 0
    pDialogLength = len(videos_ids)
    for video_id in videos_ids:
        pDialogCount = pDialogCount + 1
        pDialog.update(int(90 * pDialogCount / float(pDialogLength)),
                       _(30004).format(str(pDialogCount), str(pDialogLength)))

        iframe = network.fetchUrl(urls["video"].replace("$videoId", video_id))
        video = parseMediaInfo(iframe)

        if ("error" in video and video["error"] == True):
            xbmc.log(
                "[" + _(30006) + "]: Unable to find video for ID " + video_id,
                0)

            # taking note from the amount of errors the SBT API may throw
            if (ga["enabled"]):
                tracker.send("event",
                             "Usage",
                             "error",
                             screenName="Play Screen")

            # do nothing
            toaster = xbmcgui.Dialog()
            try:
                toaster.notification(_(30006), _(30103),
                                     xbmcgui.NOTIFICATION_WARNING, 3000)
            except AttributeError:
                toaster.ok(_(30006), _(30103))
            pass
        else:
            addon.setWatched(video_id, True)
            video_thumb = getVideoThumbnail(video)
            xbmcVideo = getXbmcVideoFromVideo(video, video_thumb)
            if (xbmcVideo != None):
                xbmcPlaylist.add(xbmcVideo["url"], xbmcVideo["listitem"])

    # Closing progress dialog
    pDialog.update(100, _(30005))
    pDialog.close()
    if (addon.getSetting("useUnblockBrazil") == "true"):
        # first we cheat XMBC into saving the correct cookie from Unblock Brazil website
        xbmc.Player().play(unblockBrazilHome)
        # then we pass the redirected video url for XBMC

    xbmc.Player().play(xbmcPlaylist)
    xbmc.executebuiltin("Container.Refresh")
Example #5
0
            else:
                tracker.set("clientId", addon.getSetting("uuid"))

        tracker.send("event", "Usage", "install", screenName="Welcome")
    elif (addon.getSetting("0.1.2") == ""):
        dialog = xbmcgui.Dialog()
        dialog.ok(_(30307), _(30308), _(30309), _(30310))
        addon.setSetting("0.1.2", "True")

    if (ga["enabled"]):
        tracker.send("screenview", screenName="Main Menu")

    xbmcplugin.setContent(addon_handle, 'tvshows')

    # displaying each tv show category from SBT Videos Website
    index = network.fetchUrl(urls["sbtvideos"])
    soup = BeautifulSoup(index)
    topmenu = soup.find(id="ContentTopMenu")
    if (topmenu):
        for li in topmenu.find_all("li"):
            if "boxSearch" not in li.get("class"):
                url = makeUrl({
                    "mode": "listprogram",
                    "rel": li.get("rel"),
                    "title": li.get_text().strip().encode("utf8")
                })
                li = xbmcgui.ListItem(
                    li.get_text().strip(),
                    iconImage=
                    "special://home/addons/plugin.video.sbtvideos/default-image.jpg"
                )
				tracker.set("clientId", addon.getSetting("uuid"));
			
		
		tracker.send("event", "Usage", "install", screenName="Welcome");
	elif (addon.getSetting("0.1.2") == ""):
		dialog = xbmcgui.Dialog();
		dialog.ok(_(30307), _(30308), _(30309), _(30310));
		addon.setSetting("0.1.2", "True");
		
	if (ga["enabled"]):
		tracker.send("screenview", screenName="Main Menu")

	xbmcplugin.setContent(addon_handle, 'tvshows');
	
	# displaying each tv show category from SBT Videos Website
	index = network.fetchUrl(urls["sbtvideos"]);
	soup = BeautifulSoup(index);
	topmenu = soup.find(id="ContentTopMenu");
	if (topmenu):
		for li in topmenu.find_all("li"):
			if "boxSearch" not in li.get("class"):
				url = makeUrl({"mode" : "listprogram", "rel" : li.get("rel"), "title" : li.get_text().strip().encode("utf8")});
				li = xbmcgui.ListItem(li.get_text().strip(), iconImage="special://home/addons/plugin.video.sbtvideos/default-image.jpg");
				li.setProperty('fanart_image', 'special://home/addons/plugin.video.sbtvideos/fanart.jpg');
				xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True);

	xbmcplugin.endOfDirectory(addon_handle);
elif (mode[0] == "listprogram"):
	from bs4 import BeautifulSoup;
	xbmcplugin.setContent(addon_handle, 'tvshows');
	rel = args.get("rel")[0];