I’m writing a plug in for thedailyshow.com (I know it’s on Hulu, but some people were asking for it) and I have it mostly working, except for the seek bar. It isn’t a simple one like Hulu but it has a slider on it and breaks to mark the commercials. Should I be using the “thumb” type? Am I defining the where the slider is by the color? Or what played? I can’t seem to get it to work right. Thanks!
My python file
from PMS import Plugin, Log, XML, HTTP, JSON, Prefs, RSS, Utils<br />
from PMS.MediaXML import MediaContainer, DirectoryItem, WebVideoItem, VideoItem, SearchDirectoryItem<br />
from PMS.Shorthand import _L, _R, _E, _D<br />
from PMS.FileTypes import PLS<br />
import re<br />
<br />
TDS_PLUGIN_PREFIX = "/video/TheDailyShow"<br />
TDS_ROOT = "http://www.thedailyshow.com/full-episodes/"<br />
<br />
<br />
# this is a patch for feedparser.py to handle the yahoo/media namespace.<br />
def _start_media_thumbnail(self, attrsD):<br />
context = self._getContext()<br />
context.setdefault('media_thumbnail', [])<br />
context['media_thumbnail'].append(attrsD)<br />
RSS.feedparser._FeedParserMixin._start_media_thumbnail = _start_media_thumbnail<br />
<br />
################################################################################<br />
####################<br />
def Start():<br />
# Current artwork.jpg free for personal use only - http://squaresailor.deviantart.com/art/Apple-Desktop-52188810<br />
Plugin.AddRequestHandler(TDS_PLUGIN_PREFIX, HandleRequest, "&The Daily Show", "icon-default.jpg", "art-default.jpg")<br />
<br />
################################################################################<br />
####################<br />
<br />
def HandleRequest(pathNouns, count):<br />
dir = MediaContainer('art-default.jpg', None, "The Daily Show")<br />
<br />
if count == 0:<br />
site = XML.ElementFromString(HTTP.Get(TDS_ROOT, 36000), True) <br />
<br />
# Now grab the other episodes<br />
episodeObjs = site.xpath('//div[@id="seo_links"]/a')<br />
numEpisodes = len(episodeObjs)<br />
for episode in range(numEpisodes-1,1,-1):<br />
episodeObj = episodeObjs[episode-1]<br />
url = episodeObjs[episode-1].xpath('@href')[0]<br />
name = episodeObjs[episode-1].xpath('//strong')[episode].text<br />
name = name.split(':')[1].strip()<br />
video = WebVideoItem(str(url), name, name, "", _R("icon-default.png"))<br />
dir.AppendItem(video)<br />
<br />
return dir.ToXML()
and my site config looks like this so far
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://.*thedailyshow.com" <br />
plugin="http://entertainment.mtvnservices.com/media/mgid:cms:fullepisode:thedailyshow.com"<br />
initialState="playing"<br />
version="1.0"><br />
<crop x="0" y="0" width="3700" height="470" /> <br />
<br />
<!-- PLAYING --><br />
<state name="playing"><br />
<event><br />
<condition><br />
<command name="pause" /><br />
</condition><br />
<action><br />
<click x="18" y="500" /><br />
<goto state="paused" /><br />
</action><br />
</event><br />
<br />
</state><br />
<br />
<!-- PAUSED --><br />
<state name="paused"><br />
<event><br />
<condition><br />
<command name="play" /><br />
</condition><br />
<action><br />
<click x="18" y="500" /><br />
<goto state="playing" /><br />
</action><br />
</event><br />
</state><br />
<br />
<seekbar type="thumb"><br />
<start x="76" y="497" /><br />
<end x="446" y="497" /><br />
<played><br />
<color rgb="588998" /><br />
<color rgb="5f90a3" /><br />
<color rgb="719db0" /><br />
<color rgb="8badbb" /><br />
<color rgb="a8c0c9" /><br />
<color rgb="b9ced5" /><br />
</played><br />
</seekbar><br />
<br />
</site>