Complex Seek Bars

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>

thumb should be the right method for your seek bar.



i’m seeing color d4d5d7 (and 9ba4ab) at y=476 pixels. try x = 63, x=446 (or maybe 446 - 27 = 419, being the end point minus the width of the seek thumb)

Funny… One of our guys has a Daily show plugin just about finished already… I think it’s already more feature rich in content content it’s providing too. Sorry to bring the bad news, plugin looks rad so far. If you want to help with a Colbert Report plugin I’ll be happy to help with siteconfigs and content tree setup.



Booooooo! Quit hogging all the sites ya jerks! It takes those of us who don't know python or xpath a while to muddle our way through this! :P

Sure - I can start working on the Colbert Report instead. I'm willing to bet it's very similar to the Daily Show. Can I get a copy of what the other more complete plug in looks like so far?

Zakharm - Thanks for suggestion, it's still not working with your numbers though... but at least I know I was on the right track with the Thumb.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.