but here we go again. im stuck.
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 />
00:35:59.650654: com.plexapp.plugins.mtv2 : (Framework) Handling request : /video/Mtv2/:/function/VideoPageShows2/KGRwMApTJ3ZpZGVvVXJsJwpwMQpTJ2h0dHA6Ly93d3cubXR2LmNvbS8vc2hvd3MvcGFya291ci9zZXJpZXMuamh0bWwnCnAyCnNTJ3NlbmRlcicKcDMKY2NvcHlfcmVnCl9yZWNvbnN0cnVjdG9yCnA0CihjUE1TLk9iamVjdHMKSXRlbUluZm9SZWNvcmQKcDUKY19fYnVpbHRpbl9fCm9iamVjdApwNgpOdHA3ClJwOAooZHA5ClMnaXRlbVRpdGxlJwpwMTAKUyJNVFYncyBVbHRpbWF0ZSBQYXJrb3VyIENoYWxsZW5nZSIKcDExCnNTJ3RpdGxlMScKcDEyClMnU2hvd3MnCnAxMwpzUyd0aXRsZTInCnAxNApTJ1Nob3dzJwpwMTUKc1MnYXJ0JwpwMTYKUycvdmlkZW8vTXR2Mi86L3Jlc291cmNlcy9hcnQtZGVmYXVsdC5qcGcnCnAxNwpzYnMu<br />
00:35:59.651564: com.plexapp.plugins.mtv2 : (Framework) Calling named function 'VideoPageShows2'<br />
00:35:59.688375: com.plexapp.plugins.mtv2 : (Framework) HTTPError when requesting 'http://www.mtv.com//shows/parkour/series.jhtml'<br />
00:35:59.688708: com.plexapp.plugins.mtv2 : (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/Mtv2.bundle/Contents/Code/__init__.py", line 57, in VideoPageShows2<br />
for item2 in content.xpath('//li[@class="list-title"]//a'):<br />
AttributeError: 'NoneType' object has no attribute 'xpath'<br />
nonetype object has no attribute 'xpath'..... hmm, what? xpath is just specific to my code, but what is "nonetype"?
I checked my xpath code with the firefox plugin, its ok. i even changed it a bit and broke it to check. its very similar to the menu before it. so im not sure why its causing such an issue.
this is the current code that is causing the issue
def VideoPageShows2(sender, videoUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(videoUrl, True)<br />
for item2 in content.xpath('//li[@class="list-title"]//a'):<br />
vidUrl = item2.xpath(".")[0].get('href')<br />
vidUrl = MTV_ROOT+vidUrl <br />
Log(vidUrl)<br />
title2 = item2.xpath(".")[0].get('href')<br />
Log(title2)<br />
dir.Append(WebVideoItem(vidUrl, title=title2))<br />
return dir
full code if needed
# PMS plugin framework<br />
from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *<br />
<br />
####################################################################################################<br />
<br />
MTV_PLUGIN_PREFIX = "/video/Mtv2"<br />
MTV_ROOT = "http://www.mtv.com/"<br />
MTV_MUSIC = "http://www.mtv.com/music/videos/"<br />
MTV_SHOWS = "http://www.mtv.com/ontv/"<br />
MTV_MOVIES = "http://www.mtv.com/movies"<br />
MTV_NEWS = "http://www.mtv.com/news/"<br />
<br />
####################################################################################################<br />
def Start():<br />
Plugin.AddPrefixHandler(MTV_PLUGIN_PREFIX, MainMenu, "MTV Shows", "icon-default.png", "art-default.jpg")<br />
Plugin.AddViewGroup("Details", viewMode="InfoList", mediaType="items")<br />
MediaContainer.art = R('art-default.jpg')<br />
MediaContainer.title1 = 'Shows'<br />
DirectoryItem.thumb=R("icon-default.png")<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
dir = MediaContainer(mediaType='video') <br />
dir.Append(Function(DirectoryItem(VideoPageMusic, "Music"), pageUrl = MTV_MUSIC))<br />
dir.Append(Function(DirectoryItem(VideoPageShows, "Shows"), pageUrl = MTV_SHOWS))<br />
return dir<br />
<br />
####################################################################################################<br />
def VideoPageMusic(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(pageUrl, True)<br />
for item in content.xpath('//div[@class="mdl"]//ol/li/div'):<br />
link = MTV_ROOT + item.xpath("a")[0].get('href')<br />
image = MTV_ROOT + item.xpath("a/img")[0].get('src')<br />
title = str(item.xpath("a")[0].xpath("child::node()")[3])<br />
dir.Append(DirectoryItem(link, title=title, thumb=image))<br />
return dir<br />
<br />
####################################################################################################<br />
def VideoPageShows(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(pageUrl, True)<br />
for item in content.xpath('//ul[@class="centerCol wide"]//a'):<br />
videoUrl = item.xpath(".")[0].get('href')<br />
Log(videoUrl)<br />
title = item.xpath(".")[0].text<br />
Log(title)<br />
dir.Append(Function(DirectoryItem(VideoPageShows2, title), videoUrl = MTV_ROOT+videoUrl))<br />
return dir<br />
<br />
####################################################################################################<br />
def VideoPageShows2(sender, videoUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
content = XML.ElementFromURL(videoUrl, True)<br />
for item2 in content.xpath('//li[@class="list-title"]//a'):<br />
vidUrl = item2.xpath(".")[0].get('href')<br />
vidUrl = MTV_ROOT+vidUrl <br />
Log(vidUrl)<br />
title2 = item2.xpath(".")[0].get('href')<br />
Log(title2)<br />
dir.Append(WebVideoItem(vidUrl, title=title2))<br />
return dir
yes i have more menu items listed at the beginning, but they arent called in the code. i will get to those later.