The page this plugin scrapes from is promoting a special edition episode so the plugin doesn't find the appropriate JSON blob to extract the episode list from. The fix in #188 didn't work for me so I came up with the following patch. It, too, is imperfect as some of The Colbert Report episodes are labled as 'The Daily Show' in their metadata so they show up in the list; it does restore the ability to view most recent episodes, though.
Code:
diff --git a/addon.py.backup b/addon.py
index e0d8aec..d8a8cb0 100644
--- a/addon.py.backup
+++ b/addon.py
@@ -153,16 +153,38 @@ def full_episodes(**ignored):
url = 'http://thedailyshow.cc.com/full-episodes/'
# Due to unstructured daily show site, there is no canonical JSON url
# so we find the full episode json url presented on the latest full episode
- jsonurl = re.compile(r'http[^"]+/f1010\\/[^"]+').findall(get(url).content)[0].replace("\\", "")
+ urls = re.compile(r'http[^"]+feeds\\/f[^"]+').findall(get(url).content)
+ responses = [json.loads(get(ea.replace("\\","")).content) for ea in urls]
+
+ episodes = []
+ for each in responses:
+ try:
+ episodes.append(each.get('result').get('episode'))
+ except:
+ pass
+ try:
+ episodes.extend(each.get('result').get('episodes'))
+ except:
+ pass
- jsonresponse = json.loads(get(jsonurl).content)
- episodes = jsonresponse.get('result').get('episodes')
for episode in episodes:
+ if not episode: continue
+ try:
+ assert episode.get('show').get('title') == 'The Daily Show'
+ except AssertionError, AttributeError:
+ continue
thumbnail = None
if len(episode.get('images', ())) >= 1:
thumbnail = episode.get('images')[0].get('url')
airdate = episode.get('airDate', '0')
airdate = datetime.fromtimestamp(int(airdate)).strftime('%Y-%m-%d')
+ season = episode.get('season', None)
+ if season:
+ snum = season.get('seasonNumber', '0')
+ enum = season.get('episodeNumber', '0')
+ else:
+ snum = 0
+ enum = 0
liz = xbmcgui.ListItem(
episode.get('title'),
iconImage="DefaultFolder.png",
@@ -171,8 +193,8 @@ def full_episodes(**ignored):
type="Video", infoLabels={"Title": episode.get('title'),
"Plot":
episode.get('description'),
- "Season": episode.get('season', {}).get('seasonNumber'),
- "Episode": episode.get('season', {}).get('episodeNumber'),
+ "Season": snum,
+ "Episode": enum,
"premiered": airdate,
"TVShowTitle": TVShowTitle})
liz.setProperty('IsPlayable', 'true')
First make a backup, then retrieve the file "addon.py", apply the above changes and push the modified file. I'm using a raspberry pi so it looked like:
Code:
$ ssh root@serverip
Enter your password:
$ cd /storage/.xbmc/addons/plugin.video.the.daily.show
$ cp addon.py addon.py.backup
$ exit
$
$ scp root@serverip:/storage/.xbmc/addons/plugin.video.the.daily.show/addon.py .
root@serverip's password:
$ nano addon.py
<make the changes>
$ scp addon.py root@serverip:/storage/.xbmc/addons/plugin.video.the.daily.show
root@serverip's password:
$
This plugin is/was part of bluecop's package, available on
Github and
Google Code. However, neither repo has been updated in over a year and the code in those repos doesn't resemble the code of the version install via XBMC Add-ons.