wip: addon for academic-earth
#1
here is my addon for academic earth:
http://hyper.homeftp.net/xbmc/plugin.vid...-earth.zip

some of the course videos are not hosted on ae (they are on the schools website -- e.g. mit's open-course-ware). i havent found a way to scape those yet.

thanks,
Reply
#2
You know that there is already a (good) Academic Earth Add-on in the official repository?
My GitHub. My Add-ons:
Image
Reply
#3
it doesnt work for me.
also, learning a lot about python, xbmc, youtube internals so this hasnt been a waste of my time.
thanks,
Reply
#4
In regard to the official Academic Earth plugin, it's not working for me either. It needs fixing. The webpage may have changed or something.

Your code is having an error when I can find a video to play.

Code:
15:03:20 T:4867248128   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnboundLocalError'>
                                            Error Contents: local variable 's2' referenced before assignment
                                            Traceback (most recent call last):
                                              File "/Users/xyz/Library/Application Support/XBMC/addons/plugin.video.schneidz-academic-earth/default.py", line 196, in <module>
                                                playvid(url)
                                              File "/Users/xyz/Library/Application Support/XBMC/addons/plugin.video.schneidz-academic-earth/default.py", line 76, in playvid
                                                s1 = re.search('url=(http.+?)\\\\', s2)
                                            UnboundLocalError: local variable 's2' referenced before assignment
                                            -->End of Python script error report<--
15:03:20 T:4867248128    INFO: Python script stopped

If I indent your playvid(url) function from:
Code:
def playvid(url):
html=urllib2.urlopen(url).read().replace(",","\\\n")
for line in html.split("\n"):
     if "itag=22" in line:
        s2 = line
s1 = re.search('url=(http.+?)\\\\', s2)
sig = re.search('sig=(.+?)\\\\', s2)
yturl = s1.groups() + sig.groups()
yturl = str(tuple(yturl))
yturl = yturl.replace("', '","&signature=")
yturl = yturl.replace("%3A",":")
yturl = yturl.replace("%2F","/")
yturl = yturl.replace("%3F","?")
yturl = yturl.replace("%3D","=")
yturl = yturl.replace("%252C","%2C")
yturl = yturl.replace("%26","&")
yturl = yturl.replace("%253A",":")
yturl = yturl.replace("('","\"")
yturl = yturl.replace("')","\"")
yturl = yturl.replace('"','')
print "\n yturl.replace = " + yturl
xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(yturl)

to:

Code:
def playvid(url):
html=urllib2.urlopen(url).read().replace(",","\\\n")
for line in html.split("\n"):
     if "itag=22" in line:
        s2 = line
        s1 = re.search('url=(http.+?)\\\\', s2)
        sig = re.search('sig=(.+?)\\\\', s2)
        yturl = s1.groups() + sig.groups()
        yturl = str(tuple(yturl))
        yturl = yturl.replace("', '","&signature=")
        yturl = yturl.replace("%3A",":")
        yturl = yturl.replace("%2F","/")
        yturl = yturl.replace("%3F","?")
        yturl = yturl.replace("%3D","=")
        yturl = yturl.replace("%252C","%2C")
        yturl = yturl.replace("%26","&")
        yturl = yturl.replace("%253A",":")
        yturl = yturl.replace("('","\"")
        yturl = yturl.replace("')","\"")
        yturl = yturl.replace('"','')
        print "\n yturl.replace = " + yturl
        xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(yturl)

Then the video plays, but if I stop the video or let it play to the end, then playback of the same video in a continuous loop.
At that point I have to kill XBMC process. It has to do with how you call the xbmc.Player. There is an indirect way to play a resolved url which opens the player for you without a direct call.
Reply
#5
not exactly sure how to prevent auto-looping (pressing stop/back numerous times usually prevents it from reloading the same video).

can you point me to some source code that would illustrate the direct/indeirect call ?


edit:
oh wait you mite be talking about calling the youtube addon; i tried it but had the same problem so i decided hardcod parsing of the the youtube page for some reason.
Reply
#6
Link to another forum with an example. Nice is you can follow the code progress with comments.
Reply

Logout Mark Read Team Forum Stats Members Help
wip: addon for academic-earth0