def play(url, pathId=""): xbmc.log("Playing...") if pathId != "": xbmc.log("PathID: " + pathId) raiplay = RaiPlay() url = raiplay.getVideoUrl(pathId) # Handle RAI relinker if url[:53] == "http://mediapolis.rai.it/relinker/relinkerServlet.htm" or \ url[:56] == "http://mediapolisvod.rai.it/relinker/relinkerServlet.htm" or \ url[:58] == "http://mediapolisevent.rai.it/relinker/relinkerServlet.htm": xbmc.log("Relinker URL: " + url) relinker = Relinker() url = relinker.getURL(url) # Add the server to the URL if missing if url !="" and url.find("://") == -1: url = raiplay.baseUrl + url xbmc.log("Media URL: " + url) # It seems that all .ram files I found are not working # because upstream file is no longer present if url[-4:].lower() == ".ram": dialog = xbmcgui.Dialog() dialog.ok("Errore", "I file RealAudio (.ram) non sono supportati.") return # Play the item item=xbmcgui.ListItem(path=url + '|User-Agent=' + urllib.quote_plus(Relinker.UserAgent)) xbmcplugin.setResolvedUrl(handle=handle, succeeded=True, listitem=item)
def play(url, uniquename="", pathId=""): # Retrieve the file URL if missing if uniquename != "": xbmc.log("Uniquename: " + uniquename) ondemand = OnDemand() (url, mediatype) = ondemand.getMediaUrl(uniquename) if pathId != "": xbmc.log("PathID: " + pathId) ondemand = OnDemand() url = ondemand.getVideoUrl(pathId) # Handle RAI relinker if url[:53] == "http://mediapolis.rai.it/relinker/relinkerServlet.htm" or \ url[:56] == "http://mediapolisvod.rai.it/relinker/relinkerServlet.htm" or \ url[:58] == "http://mediapolisevent.rai.it/relinker/relinkerServlet.htm": xbmc.log("Relinker URL: " + url) relinker = Relinker() url = relinker.getURL(url) # Add the server to the URL if missing if url != "" and url.find("://") == -1: url = ondemand.baseUrl + url xbmc.log("Media URL: " + url) # It seems that all .ram files I found are not working # because upstream file is no longer present if url[-4:].lower() == ".ram": dialog = xbmcgui.Dialog() dialog.ok("Errore", "I file RealAudio (.ram) non sono supportati.") return # Play the item item = xbmcgui.ListItem(path=url) xbmcplugin.setResolvedUrl(handle=handle, succeeded=True, listitem=item)
def play(title, url, thumbailUrl="", uniquename="", mediatype="RaiTv Media Video Item"): # Retrieve the file URL if missing if uniquename != "": ondemand = OnDemand() (url, mediatype) = ondemand.getMediaUrl(uniquename) # Handle RAI relinker if url[:53] == "http://mediapolis.rai.it/relinker/relinkerServlet.htm" or \ url[:56] == "http://mediapolisvod.rai.it/relinker/relinkerServlet.htm": relinker = Relinker() url = relinker.getURL(url) # Add the server to the URL if missing if url != "" and url.find("://") == -1: url = ondemand.baseUrl + url print "Playing URL: %s" % url # It seems that all .ram files I found are not working # because upstream file is no longer present if url[-4:].lower() == ".ram": dialog = xbmcgui.Dialog() dialog.ok("Errore", "I file RealAudio (.ram) non sono supportati.") return # Play the item item = xbmcgui.ListItem(title, thumbnailImage=thumbailUrl) if mediatype == "RaiTv Media Video Item": item.setInfo(type="Video", infoLabels={"Title": title}) elif mediatype == "RaiTv Media Audio Item": item.setInfo(type="Audio", infoLabels={"Title": title}) xbmc.Player().play(url, item)
def play(url, pathId="", srt=[]): xbmc.log("Playing...") if pathId != "": xbmc.log("PathID: " + pathId) # Ugly hack if pathId[:7] == "/audio/": raiplayradio = RaiPlayRadio() metadata = raiplayradio.getAudioMetadata(pathId) url = metadata["contentUrl"] srtUrl = "" else: raiplay = RaiPlay() xbmc.log("Url: " + raiplay.getUrl(pathId)) metadata = raiplay.getVideoMetadata(pathId) url = metadata["content_url"] srtUrl = metadata["subtitles"] if srtUrl != "": xbmc.log("SRT URL: " + srtUrl) srt.append(srtUrl) # Handle RAI relinker if url[:53] == "http://mediapolis.rai.it/relinker/relinkerServlet.htm" or \ url[:56] == "http://mediapolisvod.rai.it/relinker/relinkerServlet.htm" or \ url[:58] == "http://mediapolisevent.rai.it/relinker/relinkerServlet.htm": xbmc.log("Relinker URL: " + url) relinker = Relinker() url = relinker.getURL(url) # Add the server to the URL if missing if url[0] == "/": url = raiplay.baseUrl[:-1] + url xbmc.log("Media URL: " + url) # Play the item try: item = xbmcgui.ListItem(path=url + '|User-Agent=' + urllib.quote_plus(Relinker.UserAgent)) except: item = xbmcgui.ListItem(path=url + '|User-Agent=' + urllib.parse.quote_plus(Relinker.UserAgent)) if len(srt) > 0: item.setSubtitles(srt) xbmcplugin.setResolvedUrl(handle=handle, succeeded=True, listitem=item)