well i got it showing titles, kind of. ( im fudging the title text with the url text because i dont know the xpath call out to grab just the text from the href )
but i get this error now, and Im not sure how to rearrange the url.
im not sure i understand they “unknown url” response.
is it because the dir.append is “webvideoitem” is it starting to look for the player info? i didnt think it was on that page yet.
Sent command: GET /video/vbs2/:/function/VideoPage/KGRwMApTJ3dhdGNoVXJsJwpwMQpTJy93YXRjaC9iYWxscy1kZWVwJwpwMgpzUydzZW5kZXInCnAzCmNjb3B5X3JlZwpfcmVjb25zdHJ1Y3RvcgpwNAooY1BNUy5PYmplY3RzCkl0ZW1JbmZvUmVjb3JkCnA1CmNfX2J1aWx0aW5fXwpvYmplY3QKcDYKTnRwNwpScDgKKGRwOQpTJ2l0ZW1UaXRsZScKcDEwClMnL3dhdGNoL2JhbGxzLWRlZXAnCnAxMQpzUyd0aXRsZTEnCnAxMgpOc1MndGl0bGUyJwpwMTMKUydTaG93cycKcDE0CnNTJ2FydCcKcDE1Ck5zYnMu<br />
User-Agent: Plex Firefox/2.0.0.11<br />
Host: localhost:32400<br />
Accept: */*<br />
Connection: keep-alive<br />
X-Plex-Language: en<br />
X-Plex-Version: 0.8.5-f4b13b5<br />
<br />
21:05:46.878938: com.plexapp.plugins.vbs : (Framework) Handling request : /video/vbs2/:/function/VideoPage/KGRwMApTJ3dhdGNoVXJsJwpwMQpTJy93YXRjaC9iYWxscy1kZWVwJwpwMgpzUydzZW5kZXInCnAzCmNjb3B5X3JlZwpfcmVjb25zdHJ1Y3RvcgpwNAooY1BNUy5PYmplY3RzCkl0ZW1JbmZvUmVjb3JkCnA1CmNfX2J1aWx0aW5fXwpvYmplY3QKcDYKTnRwNwpScDgKKGRwOQpTJ2l0ZW1UaXRsZScKcDEwClMnL3dhdGNoL2JhbGxzLWRlZXAnCnAxMQpzUyd0aXRsZTEnCnAxMgpOc1MndGl0bGUyJwpwMTMKUydTaG93cycKcDE0CnNTJ2FydCcKcDE1Ck5zYnMu<br />
21:05:46.879359: com.plexapp.plugins.vbs : (Framework) Calling named function 'VideoPage'<br />
21:05:46.880828: com.plexapp.plugins.vbs : (Framework) An exception happened:<br />
Traceback (most recent call last):<br />
File "/Users/sethreid70/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/1/Python/PMS/Plugin.py", line 640, in __call<br />
return function(*args, **kwargs)<br />
File "/Users/sethreid70/Library/Application Support/Plex Media Server/Plug-ins/VBS.bundle/Contents/Code/__init__.py", line 60, in VideoPage<br />
content = XML.ElementFromURL(watchUrl, True)<br />
File "/Users/sethreid70/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/1/Python/PMS/XML.py", line 23, in ElementFromURL<br />
return ElementFromString(HTTP.Request(url, values, headers, cacheTime, autoUpdate, encoding, errors), isHTML)<br />
File "/Users/sethreid70/Library/Application Support/Plex Media Server/Plug-ins/Framework.bundle/Contents/Resources/Versions/1/Python/PMS/HTTP.py", line 133, in Request<br />
f = urllib2.urlopen(request)<br />
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 124, in urlopen<br />
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 373, in open<br />
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 244, in get_type<br />
ValueError: unknown url type: /watch/balls-deep<br />
<br />
21:05:46.880942: com.plexapp.plugins.vbs : (Framework) Request not handled by plug-in<br />
Reading 0 bytes in the body, code is 404<br />
21:05:49.401337: com.plexapp.plugins.vbs : (Framework) Saved shared HTTP data<br />
this is the current code, I changed the episode list tag because the "all show list" was on a different directory than the pages the videos were actually on.
/shows/all vs /watch/XXXX
but i noticed the show list is also on the /watch page so that populates still. im trying to like add the base url to the titleUrl to make the full url. as retarded as that sounds. but i cant seem to get the code working.
# PMS plugin framework<br />
from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *<br />
<br />
####################################################################################################<br />
<br />
VBS_PREFIX = "/video/vbs2"<br />
<br />
VBS_URL = "http://www.vbs.tv"<br />
VBS_WATCH_URL = "http://www.vbs.tv/shows/label/All/"<br />
VBS_IMAGE_THUMB_URL = "http://assets.vbs.tv/%s_small.jpg"<br />
CACHE_INTERVAL = 3600<br />
DEBUG = True<br />
ART = 'art-default.png'<br />
ICON = 'icon-default.png'<br />
<br />
####################################################################################################<br />
<br />
def Start():<br />
Plugin.AddPrefixHandler(VBS_PREFIX, MainMenu, L("VBS"), VBS_IMAGE_THUMB_URL)<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
dir = MediaContainer(mediaType='video')<br />
dir.Append(<br />
Function(<br />
DirectoryItem(<br />
all_shows,<br />
title="Shows",<br />
summary="Browse Show List"<br />
),<br />
watchUrl = VBS_WATCH_URL<br />
)<br />
)<br />
return dir<br />
<br />
####################################################################################################<br />
def all_shows(sender, watchUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(watchUrl, True)<br />
for item in content.xpath('//ul[@class="covers covers-wide"]/li'):<br />
titleUrl = item.xpath("./h4/a")[0].get('href')<br />
Log(titleUrl)<br />
image = item.xpath(".//img")[0].get('src')<br />
Log(image)<br />
title = item.xpath("./h4/a")[0].text<br />
Log(title)<br />
dir.Append(Function(DirectoryItem(VideoPage, title, thumb=image), watchUrl = titleUrl))<br />
return dir <br />
<br />
####################################################################################################<br />
def VideoPage(sender, watchUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(watchUrl, True)<br />
for item2 in content.xpath('//div[@id="shows-dd"]//a/@href'):<br />
vidUrl = item2.xpath("a")[0].get('href')<br />
if vidUrl.count("http://") == 0:<br />
vidUrl=VBS_WATCH_URL+vidUrl <br />
Log(vidUrl)<br />
thumb2 = item2.xpath("a/img")[0].get('src')<br />
title2 = item2.xpath("a")[0].get('href')<br />
Log(title2)<br />
dir.Append(WebVideoItem(vidUrl, title=title2, thumb=thumb2))<br />
return dir
**** edit ****
added Dbl_a's code for all_shows
works great, i had some code working also, but yours is cleaner. thanks.
still producing that error, so it has to be in the videoPage()
the watchUrl is not quite what i said it was anymore, since i had to change it back to use dbl_a's code. and i am really burnt on this right now. so im going to take a break right now.
but thats some progress, to see it populate the list 2 hours ago, was great. and now with images etc. awesomer.