what im trying to say is, im having a hard time making code like below work.
for item in content.xpath(’//div[@class=“mdl mdl-main”]//div[3]//li/div/a’):
i cant seem to filter my nodes far enough to get what i need. because thats the base for the 3 arguments its searching for. so that has to encompass all the arguments i want to find.
i always run into the issue of my nodes i CAN filter down enough never have ALL the data in it. ( i.e. url, image, description… i always find 2 but not 3 )
but ill check out the code. i feel like some how i have gone backwards. now the xpath is really confusing me.
You are able to do multiple main xpath searches.  I did it in my fox plugin.  here’s my code for the videos page.  It sounds very similar to what you are after.
def VideoPage(sender, pageUrl):<br />
    dir = MediaContainer(title2=sender.itemTitle)<br />
    Log("Hello")<br />
    Log(pageUrl)<br />
    content = XML.ElementFromURL(pageUrl, False)<br />
    for item2 in content.xpath('/rss/channel/item'):<br />
      Log("Hello2")<br />
      Log(item2)<br />
      vidUrl=item2.xpath("link")[0].text<br />
      Log(vidUrl)<br />
      thumb2 = item2.xpath("thumbnail")[0].text<br />
      title2 = item2.xpath("title")[0].text<br />
      <br />
      content2 = XML.ElementFromURL(vidUrl,True)<br />
      publisherId = content2.xpath('//div[@id="player"]//object/param[@name="publisherID"]')[0].get("value")<br />
      Log(publisherId)<br />
      videoId = content2.xpath('//div[@id="player"]//object/param[@name="@videoPlayer"]')[0].get("value")<br />
      playerId = content2.xpath('//div[@id="player"]//object/param[@name="playerID"]')[0].get("value")<br />
      truevidUrl="http://x.brightcove.com/plex/video.php?publisherId=" + publisherId + "%s&playerId=" + playerId + "%s&videoId=" + videoId + "%s"<br />
      dir.Append(WebVideoItem(truevidUrl, title=title2, thumb=thumb2))<br />
    return dir<br />
THATS EXACTLY IT!
sorry it took so long to explain what i was trying to say.
thanks!
I integrated the code from Dbl_A
and decided to put this one on hold for a bit. the functionality is there, it works now. and is somewhat organized ( thanks Dbl_A )
but it has some quarks, the music video swf player is a different size as the tv show version, so the pause play coordinates arent right.
im surprised it will play really. even with no width and height designation.
but yeah. here is my current code. its very similar to Dbl_A. and the only real different it seems between mine and Dbl_A mtv shows plugin mentioned earlier. is that the early version only showed current episodes. and I wanted the back seasons also.
# 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("List", viewMode="InfoList", mediaType="items")<br />
  MediaContainer.art = R('art-default.jpg')<br />
  MediaContainer.title1 = 'Mtv Videos'<br />
  MediaContainer.title2 = 'Shows'<br />
  DirectoryItem.thumb = R('icon-defaultTV.jpg')<br />
  <br />
####################################################################################################<br />
def MainMenu():<br />
    dir = MediaContainer(mediaType='video') <br />
    dir.Append(Function(DirectoryItem(VideoPageMusic, "Music", thumb=R('icon-default.png')), pageUrl = MTV_MUSIC))<br />
    dir.Append(Function(DirectoryItem(MainMenu2, "Popular Shows", thumb=R('icon-defaultTV.jpg'))))<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(WebVideoItem(link, title=title, thumb=image))<br />
    return dir<br />
    <br />
####################################################################################################<br />
def MainMenu2(sender):<br />
    dir = MediaContainer(mediaType='video')<br />
    dir.Append(Function(DirectoryItem(ShowList, "Recent Full Episodes"), pageUrl = MTV_SHOWS, pageAppend = "video.jhtml?filter=fulleps"))<br />
    dir.Append(Function(DirectoryItem(ShowList, "Clips"), pageUrl = MTV_SHOWS, pageAppend = "video.jhtml?filter=clips"))<br />
    dir.Append(Function(DirectoryItem(ShowList, "Seasons"), pageUrl = MTV_SHOWS, pageAppend = "seasons.jhtml"))<br />
    return dir<br />
<br />
####################################################################################################<br />
def MeatList(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//li/a'):<br />
        image = MTV_ROOT + content.xpath(".//div/ol/li/ul/li[5]/img")[0].get('src')<br />
        Log(image)<br />
        link = MTV_ROOT + item.get('href')<br />
        title = item.text<br />
        dir.Append(WebVideoItem(link, title=title, thumb=image))<br />
    return dir<br />
        <br />
####################################################################################################<br />
def ShowList(sender, pageUrl, pageAppend):<br />
    dir = MediaContainer(title2=sender.itemTitle)<br />
    content = XML.ElementFromURL(pageUrl, isHTML=True)<br />
    for test in content.xpath('//div[@class="mdl mdl-main"]//div[3]//li/div'):<br />
        for item in content.xpath('//div[@class="mdl mdl-main"]//div[3]//li/div/a'):<br />
            link = MTV_ROOT + item.get('href')<br />
            link = link.replace("series.jhtml", pageAppend)<br />
            title = item.text<br />
            if "seasons.jhtml" in link:<br />
                dir.Append(Function(DirectoryItem(SeasonList, title), pageUrl = link))<br />
                continue<br />
            else:<br />
                dir.Append(Function(DirectoryItem(MeatList, title), pageUrl = link))<br />
        return dir      <br />
####################################################################################################<br />
def SeasonList(sender, pageUrl):<br />
    dir = MediaContainer(title2=sender.itemTitle)<br />
    content = XML.ElementFromURL(pageUrl, isHTML=True)<br />
    for item in content.xpath('//div[@class="mdl"]/ol//li'):<br />
        link = MTV_ROOT + item.xpath('.//a')[0].get('href')<br />
        link = link.replace("series.jhtml", "video.jhtml?filter=fulleps")<br />
        title = item.xpath('.//a/text()[2]')[0]<br />
        title = str(title)<br />
        dir.Append(Function(DirectoryItem(MeatList, title), pageUrl = link))<br />
    return dir
site config
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://www.mtv.com"<br />
	    plugin="http://media.mtvnservices.com/mgid:uma"<br />
			initialState="playing"<br />
			version="1.0"><br />
	<br />
	<pre m="http://media.mtvnservices.com/player/.*" /><br />
	<br />
	<crop x="0" y="0" width="0" height="435" /><br />
	<seekbar type="simple"><br />
		<start x="62" y="445" /><br />
		<end   x="642" y="445" /><br />
		<played><br />
				<color rgb="666666" /><br />
		</played><br />
	</seekbar><br />
	<br />
	<!-- PLAYING --><br />
	<state name="playing"><br />
		<event><br />
			<condition><br />
				<command name="pause" /><br />
			</condition><br />
			<action><br />
				<click x="15" y="450" /><br />
				<goto state="paused" /><br />
			</action><br />
		</event><br />
		<br />
		<!-- Video ends --><br />
		<event><br />
			<condition><br />
				<url matches="player/embed/AS3/endslate" /><br />
			</condition><br />
			<action><br />
				<goto state="end" /><br />
			</action><br />
		</event><br />
	</state><br />
	<br />
	<!-- PAUSED --><br />
	<state name="paused"><br />
		<event><br />
			<condition><br />
				<command name="play" /><br />
			</condition><br />
			<action><br />
				<click x="15" y="450" /><br />
				<goto state="playing" /><br />
			</action><br />
		</event><br />
	</state><br />
</site>
I’m confused, I can’t see a difference from the code I posted to this thread.
I didn’t update the wiki yet, as I was unsure what you were after.
FYI- There should be a way to make the swf players the same size.
With all due respect, since there is already a MTV Music Videos plugin, and a MTV Shows plugin, why are you trying to rewrite them?  (FYI-the consensus is that they should remain separate plugins)
Is this just academic?
the code you posted was only the video code, i inserted it into the code i had that has the music videos and some other differences. 
im not taking your thunder buddy, i said it was your code.
now i keep hearing about this mtv shows plugin but yet the one i downloaded didnt have the other seasons. unless there was something wrong with my version, i dont know.
maybe you could post the direct link to one your talking about. helps me not to search and find the wrong thing.
in the end, not sure why it matters?
its mostly acedemic since the documentation on writting apps, and the framework are pretty sparse. so why not write something for a site your a semi familiar with right?
not trying to ruffle anyones feathers
Not worried about my thunder level. I'm aware I don't have any anyway. :lol:
I was just concerned about the "Double work." And I didn't want there to be more confusion out there, by having 10 different MTV plugins.
You're right, the plugin I've posted to the wiki, doesn't have previous seasons.
You're also right, about coding a plugin for a site you know.
No hard feelings. I'm here to help, where I can.
Cheers,
Dbl_A
i understand, just wanted to be clear my intentions
and i agree having multiple plugins is confusing.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.