Here's the actual code -- plug it in as the _rss.py module in Hulu/resources/lib and alternate which method is called. Tell me what the results are. The only one that works for me in both is highest rated, the rest, not so much...
Code:
import xbmcplugin
import common
import sys
import re
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup
class Main:
def __init__( self ):
if common.args.mode == 'RSS_Shows':
self.activateShowPage()
else:
xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
self.addListings()
#self.addShowList()
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ))
def activateShowPage( self ):
import xbmc, urllib
print 'executing--> %s?url="%s"&mode="TV_Seasons"&name="%s"&fanart="%s"&plot="%s"&genre="%s")' % (sys.argv[0], urllib.quote_plus(common.args.url), common.args.name, urllib.quote_plus(common.args.fanart), common.args.plot, common.args.genre)
xbmc.executebuiltin('XBMC.activatewindow(MyVideoLibrary,%s?url="%s"&mode="TV_Seasons"&name="%s"&fanart="%s"&plot="%s"&genre="%s")' % (sys.argv[0], urllib.quote_plus(common.args.url), common.args.name, urllib.quote_plus(common.args.fanart), common.args.plot.replace(',',' ').replace('"',''), common.args.genre))
[color=red] def addShowList( self ):[/color]
print "\n\n adding show list \n\n"
content=common.getHTML(common.args.url)
# name, url, thumb, plot -- plot can have embedded newlines, which do not compute...
items=re.compile('<item>.+?<title>(.+?)</title>.+?<link>(.+?)#.+?<img src="(.+?)".+?</a><p>(.+?)</p>', re.DOTALL).findall(content)
mode=('RSS_Play', 'RSS_Shows')[common.args.name=='Recently Added Shows']
genre=common.args.name
for name, url, thumb, plot in items:
fanart='http://assets.hulu.com/shows/key_art_' + name.split(':')[0].replace('-','_').replace(' ','_').replace('\'','').replace('"','').replace(',', '').lower() + '.jpg'
# display show plot if asked for; we've already extracted it from the page above, so no overhead
plot=('', plot.replace('\n', '\r'))[common.settings['get_show_plot']]
common.addDirectory(common.cleanNames(name), url, mode, thumb, thumb, fanart, plot, genre)
[color=red] def addListings ( self ):[/color]
print "\n\n adding listings \n\n"
xmlsoup = BeautifulStoneSoup(common.getHTML( common.args.url ))
items = xmlsoup.findAll('item')
for item in items:
name = item.title.contents[0]
url = item.guid.contents[0]
try:
try:
p = re.compile('<p>(.+?)</p>')
plot = p.findall(item.description.contents[0])[0]
except:
p = re.compile('<p>(.+?)</p>')
plot = p.findall(str(item.description))[0]
except:
plot = 'Unavaliable'
try:
p = re.compile('media:thumbnail.+?url="(.+?)"')
thumb = p.findall(str(item))[0]
except:
thumb = ''
try:
fanart = 'http://assets.hulu.com/shows/key_art_'+name.split(':')[0].replace('-','_').replace(' ','_').replace('\'','').replace('"','').lower()+'.jpg'
except:
fanart = ''
genre = common.args.name
if common.args.name == 'Recently Added Shows':
common.addDirectory(name, url, 'RSS_Shows', thumb, thumb, fanart, plot, genre)
else:
common.addDirectory(name, url, 'RSS_play', thumb, thumb, fanart, plot, genre)
Thanks for reading this far. Any hints would really really be appreciated, as I'm seeing this behaviour elsewhere now, too. Maybe I have a ghost in the machine
.