I am a complete noob to plugins, so there is a lot of room for optimization, but I was able to have some success with these updates. At least I can watch some shows again, but some of the meta data is missing because it's not in the JSON file. Maybe somebody else can have a look... Everything is in the cbs.py file.
First, re-wrote the showcats routine, so comment out the old one and add this code:
Code:
def showcats(url = common.args.url):
data = common.getURL(url)
try:
print 'CBS: Trying April 2013 Carousel'
tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
categories = re.compile("id-carousel-(\d+)").findall(str(tree))
for catId in categories:
thisUrl = 'http://www.cbs.com/carousels/videosBySection/'+catId+'/0/40/'
data = common.getURL(thisUrl)
name = demjson.decode(data)['result']['title']
common.addDirectory(name, 'cbs', 'newvideos2', thisUrl)
except:
print 'CBS: April 2013 Carousel failed'
common.setView('seasons')
Next, a new video parsing routine (lots of the elements are missing now), so just add this after the "newvideos":
Code:
def newvideos2(url = common.args.url):
data = common.getURL(url)
itemList = demjson.decode(data)['result']['videos']
for video in itemList:
url = 'http://www.cbs.com' + video['url']
description = 'description'
thumb = video['thumb']['small']
seriesTitle = video['series_title']
title = video['label']
try:episodeNum = int(video['episodeNum'])
except:episodeNum = 0
try:seasonNum = int(video['seasonNum'])
except:seasonNum = 0
duration = 0
airDate = 0
rating = 0
u = sys.argv[0]
u += '?url="'+urllib.quote_plus(url)+'"'
u += '&mode="cbs"'
u += '&sitemode="play"'
displayname = '%sx%s - %s' % (seasonNum,episodeNum,title)
infoLabels={ "Title":title,
"Plot":description,
"Season":seasonNum,
"Episode":episodeNum,
"premiered":airDate,
"Duration":str(duration),
"mpaa":rating,
"TVShowTitle":seriesTitle
}
common.addVideo(u,displayname,thumb,infoLabels=infoLabels)
common.setView('episodes')
Last step, modify the beginning of the "play" routine with this
partial snippet (the javascript variable definition changed):
Code:
def play(url = common.args.url):
print "DEBUG Entering play function"
swfUrl = 'http://can.cbs.com/thunder/player/chrome/canplayer.swf'
if 'http://' in url:
data=common.getURL(url)
try:
pid = re.compile('video.settings.pid = "(.*?)";').findall(data)[0]
except:
pid = re.compile("video.settings.pid = '(.*?)';").findall(data)[0]
else:
pid = url