philiptzou / play2wifi

Automatically exported from code.google.com/p/play2wifi
0 stars 0 forks source link

Youtube Playback #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
   youtube playback is solved. XBMC or xbmc-send don't handle correctly long-url sent by iThing. I've patched playMedia function in play2wifi with:

    def playMedia(self, data):
        sub1 = 'Content-Location: '
        sub2 = '\nStart-Position: '
        location = data.split(sub1)[-1].split(sub2)[0]
        self.__mylogger.debug("Found the following Media to play: "+location)
        if location.find("googlevideo") > 0:
            url_data = urllib.urlencode(dict("url"=location))
            ret = urllib.urlopen("http://tinyurl.com/api-create.php", data=url_data).read().strip()
            subprocess.call(["xbmc-send", "-a", "PlayMedia("+ret+")"], cwd="./", stdout=open("/dev/null", 'w'))
        else:
            subprocess.call(["xbmc-send", "-a", "PlayMedia("+location+")"], cwd="./", stdout=open("/dev/null", 'w'))

creating a tinyurl on-the-fly and works. I think that you can change the 
condition (location.find("googlevideo")) and check the url length OR create a 
local playlist file and then playback this file with PlayMedia function.

Bye,
Angelo

Original issue reported on code.google.com by angel...@gmail.com on 4 Jan 2011 at 11:41

GoogleCodeExporter commented 9 years ago
Ops, "url" without quotes.

Original comment by angel...@gmail.com on 5 Jan 2011 at 7:34

GoogleCodeExporter commented 9 years ago
thx for the patch, i will commit it.

Original comment by andreas.ruppen on 30 Jan 2011 at 9:45