From this, you should at least be able to fill all of your menus from here on out. You may have specific questions if you get a hard tag, but from there site, it didn’t look too difficult. Check out another photo’s plugin to see how they handle their adding the actual photos once you get down to the actual content you want to show.
damn. not for me :S
NameError: global name ‘ItemPage’ is not defined
ItemPage is what you are calling your next function. Basically you’ve told Plex wherer to go, but it doesn’t exist yet. start out with just a
def ItemPage(sender,pageUrl)
Log(“Success!”)
Then start filling it in with the stuff you learned from MainMenu(). As a note, you are passing pageUrl (a variable) to ItemPage. In the same way you used
pageUrl= DEVIANTART_CATEGORIES
before, now you can use
pageUrl=pageUrl
and you can start parsing that page.
nevermind, menu is filled. i also done the itempage now.
next would be the subsubmenu, and then the rss links.
thanks so far!
i’ll get back to you if i fail.
Glad to see you are figuring out. Let us know how it goes.
ok……
now.…
main menu gets me to itemmenu. there, you should have another submenu.
like this f.ex.
Digital Art-> 3D Art -> Abstract
the only problem is that in the “subsubmenu”, the class is also called “expanded selected”. how do i tell it to use the right one? the second one that is
<ul id="categories_art_digitalart_3d"> <li><a style="padding-left:20px;" href="http://browse.deviantart.com">All Categories</a></li> <li> <ul id="facetMenu-Category_list"><br />
<li><a style="padding-left:30px;" class="expanded selected" href="http://browse.deviantart.com/digitalart/">Digital Art</a></li><br />
<li><a style="padding-left:40px;" class="expanded selected" href="http://browse.deviantart.com/digitalart/3d/">3-Dimensional Art</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/abstract/">Abstract</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/characters/">Characters</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/objects/">Objects</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/scenes/">Scenes</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/unsorted/">Unsorted</a></li><br />
<li><a style="padding-left:50px;" href="http://browse.deviantart.com/digitalart/3d/vehicles/">Vehicles</a></li><br />
my lines so far:
# PMS plugin framework<br />
import re, string, datetime<br />
from PMS import *<br />
<br />
##################################################################################################ABC<br />
PLUGIN_PREFIX = "/photos/deviantart"<br />
<br />
DEVIANTART_URL = "http://www.deviantart.com/"<br />
DEVIANTART_CATEGORIES = "http://www.deviantart.com"<br />
<br />
DEVIANTART_FEED = "feed://backend.deviantart.com/rss.xml"<br />
DEBUG = False<br />
abcart ="art-default.png"<br />
abcthumb ="icon-default.png"<br />
<br />
####################################################################################################<br />
<br />
def Start():<br />
Plugin.AddPrefixHandler(PLUGIN_PREFIX, MainMenu, "Deviantart","icon-default.jpg", "art-default.jpg")<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
<br />
MediaContainer.art =R(abcart)<br />
DirectoryItem.thumb =R(abcthumb)<br />
<br />
####################################################################################################<br />
#def MainMenu():<br />
# dir = MediaContainer(mediaType='items') <br />
# dir.Append(Function(DirectoryItem(all_shows, "Categories"), pageUrl = DEVIANTART_CATEGORIES))<br />
# return dir<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
pageUrl= DEVIANTART_CATEGORIES<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'))<br />
for item in content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
def ItemPage(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="expanded selected"]/li/a'))<br />
for item in content.xpath('//div[@class="expanded selected"]/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage2, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
def ItemPage2(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="expanded selected"]/li/a/li/a'))<br />
for item in content.xpath('//div[@class="expanded selected"]/li/a/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage2, title), pageUrl = titleUrl))<br />
return dir<br />
ok figured this out, too.
the menu’s are finished.
# PMS plugin framework<br />
import re, string, datetime<br />
from PMS import *<br />
<br />
##################################################################################################ABC<br />
PLUGIN_PREFIX = "/photos/deviantart"<br />
<br />
DEVIANTART_URL = "http://www.deviantart.com/"<br />
DEVIANTART_CATEGORIES = "http://www.deviantart.com"<br />
<br />
DEVIANTART_FEED = "feed://backend.deviantart.com/rss.xml"<br />
DEBUG = False<br />
abcart ="art-default.png"<br />
abcthumb ="icon-default.png"<br />
<br />
####################################################################################################<br />
<br />
def Start():<br />
Plugin.AddPrefixHandler(PLUGIN_PREFIX, MainMenu, "Deviantart","icon-default.jpg", "art-default.jpg")<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
<br />
MediaContainer.art =R(abcart)<br />
DirectoryItem.thumb =R(abcthumb)<br />
<br />
####################################################################################################<br />
#def MainMenu():<br />
# dir = MediaContainer(mediaType='items') <br />
# dir.Append(Function(DirectoryItem(all_shows, "Categories"), pageUrl = DEVIANTART_CATEGORIES))<br />
# return dir<br />
<br />
####################################################################################################<br />
def MainMenu():<br />
pageUrl= DEVIANTART_CATEGORIES<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'))<br />
for item in content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
def ItemPage(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'))<br />
for item in content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage2, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
def ItemPage2(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'))<br />
for item in content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(ItemPage3, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
def ItemPage3(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a/'))<br />
for item in content.xpath('//div[@class="sliding-menu "]/ul/li/ul/li/a/'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(PhotoPage, title), pageUrl = titleUrl))<br />
return dir<br />
####################################################################################################<br />
now to the most important bit. every (sub)category has its own rss page.
how do i create a link there?
the website sourcecode bit is (for example):
<link rel="alternate" type="application/rss+xml" title="deviantART: Newest Classic Portraits" href="http://backend.deviantart.com/rss.xml?q=in%3Aphotography%2Fpeople%2Fportraits+sort%3Atime&type=deviation&offset=0" /><script type="text/javascript"><br />
seems you’re progressing nicely pooploser. keep it up! 
yea but i am stuck now, so close before the main thing 
First, let’s talk about how Plex handles functions. Once you call
content = XML.ElementFromURL(pageUrl, True)
within ItemPage, you are essentially navigating to the pageUrl page.You are no longer on the page that you parsed with MainMenu(). So, when trying to figure out what code you need in ItemPage function, examine the source code for the new page. For the case of “Digital Art”, this would be http://browse.devian…om/digitalart/.
Now, let’s talk definitions. Earlier I mentioned
Log(content.xpath('//div[@class="expanded selected"]/li/a'))
In the webpage you are now searching, [http://browse.devian...com/digitalart/](http://browse.deviantart.com/digitalart/) , there is no
oh dear, this is lots lol……
glad you’re still here.
i managed to get the main menu to work, and what you wrote just now looks VERY promising.
however, would i write the last bit? i thought of using the rss page.
or your idea, using super_img as the main image.
####################################################################################################<br />
def ImagePage(sender, pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, True)<br />
Log(content.xpath('//div[@type="type="application/rss+xml"]'))<br />
for item in content.xpath('//div[@class="tt-a"]/span'):<br />
Log(item)<br />
title=item.text <br />
titleUrl = item.get('href') <br />
<br />
Log(title)<br />
Log(titleUrl)<br />
dir.Append(Function(DirectoryItem(PhotoPage, title), pageUrl = titleUrl))<br />
return dir<br />
EDIT: i was hoping to use the rss feed. as it gives you up to 60 images. but there the quality isn't as good as the super_img.
if there is an easy way to make a login work, lets use the super_img within the source, because not all pictures are available for non members.
or as a workaround, for the rss you don't need a login, but the quality is slightly lower.
your thoughts?
When you set the pageUrl in ItemPage(), you can either continue to parse the page you are looking on, or you can grab the rss feed url and then parse the rss feed page. Example
<br />
def ItemPage(sender,pageUrl):<br />
dir = MediaContainer(title2=sender.itemTitle)<br />
Log("Success!")<br />
pageUrl= pageUrl<br />
dir = MediaContainer(mediaType='items')<br />
content = XML.ElementFromURL(pageUrl, isHTML=True)<br />
i=0<br />
for item in content.xpath('//link[@type="application/rss+xml"]'):<br />
rssfeed=item.get('href')<br />
content2=XML.ElementFromURL(rssfeed,isHTML=False)<br />
for item2 in content2:<br />
Log("Success!")<br />
return dir<br />
<br />
Now this rssfeed uses namespaces and I have no good experience with this. Google and other plugins that use namespaces should help.
I have to go plaw throu Snowmeggedon to work, so I can help you later. Once again, google and other plugins are VERY usefule.
i have to laugh at myself for knowing this little. thanks SO much for your help.
i’ll try a lil more, and maybe some other kind people will also join in a little. thanks!
edit: it’s probably right in front of my eyes, but i haven’t got a clue how to make it list the rss feed next.
any books/websites you recommend someone wanting to learn go to? Any that you used?
What part are you having trouble with? Are you able to at least parse the information and have it show up in your log correctly, or are you having trouble making it display in a menu correctly?
i’m not even sure what “parse” means here lol.
the menus itself are working. not even sure how to interpret the log… sorry :rolleyes:
Larding is what you did for your menus. You took their info and stored it to variables. You also said you could see output in your log before. What are you trying to do, are you trying to display the pics now? What is it you want your plugin to do?
i seem to receive the response from the right rss website, f.ex.:
2/2/11 6:14:02 PM [0x0-0x59059].com.plexapp.plexmediaserver[796] 18:14:02.275294: com.plexapp.plugins.abc : (Framework) Received gzipped response from http://backend.deviantart.com/rss.xml?q=boost%3Apopular+in%3Aphotography%2Fjournalism%2Fperforming+max_age%3A8h&type=deviation&offset=0
(the plugin is still called abc for now lol)…
but then, the menu appears empty…
i wanna display those pictures in the plugin, yes. 
For right now, see if you can grab all of the pertinent info from the rss feed. Use Log(variable name) and check your log in Console the same way you have been. If you can grab all of the info, then we’ll work on displaying it properly when I have Plex in front of me.