The branch, frodo has been updated
via c4f32c3af36a38a0f1d3e618760a6df0bbb91c70 (commit)
via ae3c54b5d2d752e7f0ba1470d9f9de42a98f518f (commit)
from d3ac122f074b801febab2f9788a476e7644461a1 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=c4f32c3af36a38a0f1d3e618760a6df0bbb91c70
commit c4f32c3af36a38a0f1d3e618760a6df0bbb91c70
Author: Martijn Kaijser <[email protected]>
Date: Fri Apr 4 08:18:28 2014 +0200
[plugin.video.the.colbert.repor] 1.0.1
diff --git a/plugin.video.the.colbert.report/addon.py
b/plugin.video.the.colbert.report/addon.py
index 96ddd96..efbcb03 100644
--- a/plugin.video.the.colbert.report/addon.py
+++ b/plugin.video.the.colbert.report/addon.py
@@ -1,4 +1,6 @@
+import json
import os
+from datetime import datetime
import re
import sys
import urllib
@@ -100,7 +102,8 @@ def get_url(url):
log('The Colbert Report --> get_url :: url = ' + url)
txdata = None
txheaders = {
- 'Referer': 'http://www.colbertnation.com/video/',
+
+ 'Referer': 'http://thecolbertreport.cc.com/',
'X-Forwarded-For': '12.13.14.15',
'User-Agent':
'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)',
@@ -116,9 +119,16 @@ def get_url(url):
return link
+def make_in_app_url(**kwargs):
+ data = json.dumps(kwargs)
+ quoted_data = urllib2.quote(data)
+ url = "{sysarg}?{data}".format(sysarg=sys.argv[0], data=quoted_data)
+ return url
+
+
def add_directory_entry(name, identifier):
"""Adds a directory entry to the xbmc ListItem"""
- url = "{sysarg}?mode={mode}".format(sysarg=sys.argv[0], mode=identifier)
+ url = make_in_app_url(mode=identifier)
liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png")
liz.setInfo(type="Video", infoLabels={"Title": name})
liz.setProperty('fanart_image', image_fanart)
@@ -128,92 +138,53 @@ def add_directory_entry(name, identifier):
# Root listing
-def root():
+def root(**ignored):
msg = addon.getLocalizedString(30030)
add_directory_entry(msg, 'full')
-# msg = addon.getLocalizedString(30031)
-# add_directory_entry(msg, 'guests')
- msg = addon.getLocalizedString(30032)
- add_directory_entry(msg, 'search')
-# msg = addon.getLocalizedString(30033)
-# add_directory_entry(msg, 'browse')
+ #msg = addon.getLocalizedString(30032)
+ #add_directory_entry(msg, 'search')
+ #msg = addon.getLocalizedString(30033)
+ #add_directory_entry(msg, 'browse')
xbmcplugin.endOfDirectory(pluginhandle)
-def full_episodes():
+def full_episodes(**ignored):
xbmcplugin.setContent(pluginhandle, 'episodes')
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE)
- full = 'http://www.colbertnation.com/full-episodes/'
- allData = get_url(full)
-
- episodeURLs = re.compile(
- '"(http://www.colbertnation.com/full-episodes/....+?)"').findall(
- allData)
- episodeURLSet = set(episodeURLs)
-
- listings = []
- for episodeURL in episodeURLs:
- if episodeURL in episodeURLSet:
- episodeURLSet.remove(episodeURL)
- episodeData = get_url(episodeURL)
-
- title = re.compile(
- '<meta property="og:title" content="(.+?)"').search(
- episodeData)
- thumbnail = re.compile(
- '<meta property="og:image" content="(.+?)"').search(
- episodeData)
- description = re.compile(
- '<meta property="og:description" content="(.+?)"').search(
- episodeData)
- airDate = re.compile(
- '<meta itemprop="datePublished" content="(.+?)"').search(
- episodeData)
- epNumber = re.compile('/season_\d+/(\d+)').search(episodeData)
- link = re.compile(
- '<meta property="og:url" content="(.+?)"').search(
- episodeData)
-
- listing = []
- listing.append(title.group(1))
- listing.append(link.group(1))
- listing.append(thumbnail.group(1))
- listing.append(description.group(1))
- listing.append(airDate.group(1))
- listing.append(epNumber.group(1))
- listings.append(listing)
-
- #for name, link, thumbnail, plot, date, seasonepisode in listings:
- for name, link, thumbnail, plot, date, seasonepisode in listings:
- mode = "play"
- season = int(seasonepisode[:-3])
- episode = int(seasonepisode[-3:])
- u = sys.argv[
- 0] + "?url=" + urllib.quote_plus(
- link) + "&mode=" + str(
- mode) + "&name=" + urllib.quote_plus(
- name)
- u += "&season=" + urllib.quote_plus(str(season))
- u += "&episode=" + urllib.quote_plus(str(episode))
- u += "&premiered=" + urllib.quote_plus(date)
- u += "&plot=" + urllib.quote_plus(plot)
- u += "&thumbnail=" + urllib.quote_plus(thumbnail)
+ url = 'http://thecolbertreport.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("\\",
"")
+
+ jsonresponse = json.loads(get(jsonurl).content)
+ episodes = jsonresponse.get('result').get('episodes')
+ for episode in episodes:
+ 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')
liz = xbmcgui.ListItem(
- name,
+ episode.get('title'),
iconImage="DefaultFolder.png",
thumbnailImage=thumbnail)
liz.setInfo(
- type="Video", infoLabels={"Title": BS3(name,
convertEntities=BS3.HTML_ENTITIES),
+ type="Video", infoLabels={"Title": episode.get('title'),
"Plot":
- BS3(plot,
- convertEntities=BS3.HTML_ENTITIES),
- "Season": season,
- "Episode": episode,
- "premiered": date,
+ episode.get('description'),
+ "Season": episode.get('season',
{}).get('seasonNumber'),
+ "Episode": episode.get('season',
{}).get('episodeNumber'),
+ "premiered": airdate,
"TVShowTitle": TVShowTitle})
liz.setProperty('IsPlayable', 'true')
liz.setProperty('fanart_image', image_fanart)
- xbmcplugin.addDirectoryItem(handle=pluginhandle, url=u, listitem=liz)
+ url = make_in_app_url(
+ mode="play_full_episode",
+ episode_id=episode.get('id'),
+ additional_data=episode,
+ )
+ log("make url: " + str(episode))
+ xbmcplugin.addDirectoryItem(handle=pluginhandle, url=url, listitem=liz)
xbmcplugin.endOfDirectory(pluginhandle)
@@ -310,7 +281,7 @@ def get_user_input(title, default="", hidden=False):
return None
-def search():
+def search(**ignored):
msg = addon.getLocalizedString(30032)
query = get_user_input(msg)
if not query:
@@ -330,7 +301,7 @@ def search():
line1=msg)
-def browse():
+def browse(**ignored):
"""Browse videos by Date"""
mydialogue = xbmcgui.Dialog()
msg = addon.getLocalizedString(30020)
@@ -390,11 +361,15 @@ def play_video(name, url):
# Play Full Episode
-def play_full_episode(name, url):
- data = get_url(url)
- uri = re.compile(
-
'(mgid:cms:episode:colbertnation.com:\d{6}|mgid:cms:video:colbertnation.com:\d{6})').findall(data)[0]
- url = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?uri=' + uri
+#def play_full_episode(name, url):
+# data = get_url(url)
+# uri = re.compile(
+#
'(mgid:cms:episode:colbertnation.com:\d{6}|mgid:cms:video:colbertnation.com:\d{6})').findall(data)[0]
+# url = 'http://shadow.comedycentral.com/feeds/video_player/mrss/?uri=' +
uri
+
+def play_full_episode(episode_id, additional_data, **ignored):
+ content_id = 'mgid:arc:episode:colbertnation.com:%s' % episode_id
+ url = 'http://thecolbertreport.cc.com/feeds/mrss?uri=' + content_id
data = get_url(url)
uris = re.compile('<guid isPermaLink="false">(.+?)</guid>').findall(data)
stacked_url = 'stack://'
@@ -405,29 +380,14 @@ def play_full_episode(name, url):
log('stacked_url --> %s' % stacked_url)
- item = xbmcgui.ListItem(
- name,
- iconImage="DefaultVideo.png",
- thumbnailImage=thumbnail,
- path=stacked_url)
-
- log('item --> %s' % item)
-
- item.setInfo(type="Video", infoLabels={"Title": name,
- "Plot": plot,
- "premiered": premiered,
- "Season": int(season),
- "Episode": int(episode),
- "TVShowTitle": TVShowTitle})
- item.setProperty('fanart_image', image_fanart)
+ item = xbmcgui.ListItem("ignored", path=stacked_url)
xbmcplugin.setResolvedUrl(pluginhandle, True, item)
# Grab rtmp
def grab_rtmp(uri):
- url =
'http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?uri='
+ \
- uri + '&showTicker=true'
+ url = 'http://thecolbertreport.cc.com/feeds/mediagen/?uri=' + uri
mp4_url =
"http://mtvnmobile.vo.llnwd.net/kip0/_pxn=0+_pxK=18639+_pxE=/44620/mtvnorigin"
data = get_url(url)
@@ -450,73 +410,21 @@ def grab_rtmp(uri):
return furl
-# Since params are defined by us in this module, we could use JSON
-# representation here instead of parsing this by hand
-def get_params():
- param = []
- paramstring = sys.argv[2]
- if len(paramstring) >= 2:
- params = sys.argv[2]
- cleanedparams = params.replace('?', '')
- if (params[len(params) - 1] == '/'):
- params = params[0:len(params) - 2]
- pairsofparams = cleanedparams.split('&')
- param = {}
- for i in range(len(pairsofparams)):
- splitparams = {}
- splitparams = pairsofparams[i].split('=')
- if (len(splitparams)) == 2:
- param[splitparams[0]] = splitparams[1]
-
- return param
-
-params = get_params()
-url = None
-name = None
-mode = None
-
-try:
- url = urllib.unquote_plus(params["url"])
-except:
- pass
-try:
- name = urllib.unquote_plus(params["name"])
-except:
- pass
-try:
- mode = params["mode"]
-except:
- pass
-try:
- thumbnail = urllib.unquote_plus(params["thumbnail"])
-except:
- thumbnail = ''
-try:
- season = int(params["season"])
-except:
- season = 0
-try:
- episode = int(params["episode"])
-except:
- episode = 0
-try:
- premiered = urllib.unquote_plus(params["premiered"])
-except:
- premiered = ''
-try:
- plot = urllib.unquote_plus(params["plot"])
-except:
- plot = ''
-
-#log("Mode: " + str(mode))
-#log("URL: " + str(url))
-#log("Name: " + str(name))
-
-mode_handlers = {"browse": browse,
- "full": full_episodes,
- "guests": guests,
- "play": lambda: play_full_episode(name, url),
- "search": search,
- }
-
-mode_handlers.get(mode, root)()
+mode_handlers = {
+ "browse": browse,
+ "full": full_episodes,
+ "play_full_episode": play_full_episode,
+ "search": search,
+ "root": root,
+}
+
+def main(data):
+ decoded = urllib2.unquote(data or "{}")
+ if len(decoded) >= 1 and decoded[0] == '?':
+ decoded = decoded[1:]
+ log('The Colbert Report --> main :: decoded = ' + str(decoded))
+ parsed_data = json.loads(decoded)
+ mode = parsed_data.get('mode') or 'root'
+ mode_handlers[mode](**parsed_data)
+
+main(sys.argv[2])
diff --git a/plugin.video.the.colbert.report/addon.xml
b/plugin.video.the.colbert.report/addon.xml
index 62b5ecc..9e121f7 100644
--- a/plugin.video.the.colbert.report/addon.xml
+++ b/plugin.video.the.colbert.report/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.the.colbert.report"
name="The Colbert Report"
- version="1.0.0"
+ version="1.0.1"
provider-name="Fritzl Inc.">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.the.colbert.report/changelog.txt
b/plugin.video.the.colbert.report/changelog.txt
index 35d5106..7490e5b 100644
--- a/plugin.video.the.colbert.report/changelog.txt
+++ b/plugin.video.the.colbert.report/changelog.txt
@@ -1,3 +1,9 @@
+[B]Version 1.0.1 - 2014-03-31[/B]
+
+- Fixes Full Episodes for complete page restructure.
+
+- Guests, Search and Browse are disabled for now, but should come back
+
[B]Version 1.0 - 2014-02-04[/B]
- Initial release
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=ae3c54b5d2d752e7f0ba1470d9f9de42a98f518f
commit ae3c54b5d2d752e7f0ba1470d9f9de42a98f518f
Author: Martijn Kaijser <[email protected]>
Date: Fri Apr 4 08:17:38 2014 +0200
[plugin.video.the.daily.show] 1.0.8
diff --git a/plugin.video.the.daily.show/addon.py
b/plugin.video.the.daily.show/addon.py
index 2f087e3..e0d8aec 100644
--- a/plugin.video.the.daily.show/addon.py
+++ b/plugin.video.the.daily.show/addon.py
@@ -119,7 +119,8 @@ def get_url(url):
def make_in_app_url(**kwargs):
data = json.dumps(kwargs)
- url = "{sysarg}?{data}".format(sysarg=sys.argv[0], data=data)
+ quoted_data = urllib2.quote(data)
+ url = "{sysarg}?{data}".format(sysarg=sys.argv[0], data=quoted_data)
return url
@@ -181,6 +182,7 @@ def full_episodes(**ignored):
episode_id=episode.get('id'),
additional_data=episode,
)
+ log("make url: " + str(episode))
xbmcplugin.addDirectoryItem(handle=pluginhandle, url=url, listitem=liz)
xbmcplugin.endOfDirectory(pluginhandle)
@@ -356,10 +358,12 @@ mode_handlers = {
"search": search,
"root": root,
}
+
def main(data):
decoded = urllib2.unquote(data or "{}")
if len(decoded) >= 1 and decoded[0] == '?':
decoded = decoded[1:]
+ log('The Daily Show --> main :: decoded = ' + str(decoded))
parsed_data = json.loads(decoded)
mode = parsed_data.get('mode') or 'root'
mode_handlers[mode](**parsed_data)
diff --git a/plugin.video.the.daily.show/addon.xml
b/plugin.video.the.daily.show/addon.xml
index ec38b24..7de5a4e 100644
--- a/plugin.video.the.daily.show/addon.xml
+++ b/plugin.video.the.daily.show/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.the.daily.show"
name="The Daily Show"
- version="1.0.7"
+ version="1.0.8"
provider-name="Fritzl Inc.">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.the.daily.show/changelog.txt
b/plugin.video.the.daily.show/changelog.txt
index c63a9ed..2297647 100644
--- a/plugin.video.the.daily.show/changelog.txt
+++ b/plugin.video.the.daily.show/changelog.txt
@@ -1,10 +1,13 @@
+[B]Version 1.0.8 - 2014-04-03[/B]
+
+- Fixes a URL encoding bug that prevented some episodes from playing
+
[B]Version 1.0.7 - 2014-03-31[/B]
- Fix Full Episodes for complete page restructure.
- Guests, Search and Browse are disabled for now, but should come back
-
[B]Version 1.0.6 - 2014-01-12[/B]
- Adds a missing xml header to
-----------------------------------------------------------------------
Summary of changes:
plugin.video.the.colbert.report/addon.py | 242 ++++++++-----------------
plugin.video.the.colbert.report/addon.xml | 2 +-
plugin.video.the.colbert.report/changelog.txt | 6 +
plugin.video.the.daily.show/addon.py | 6 +-
plugin.video.the.daily.show/addon.xml | 2 +-
plugin.video.the.daily.show/changelog.txt | 5 +-
6 files changed, 92 insertions(+), 171 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons