The branch, frodo has been updated
via 9569935e537427d2094a5db72ada218ac29b2edb (commit)
via 8160c81820dc01d5124231a1fc30d62b747cfd43 (commit)
from 9ac1144fb52e9ea7d0580a8ee4dc1fe70fb898ae (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=9569935e537427d2094a5db72ada218ac29b2edb
commit 9569935e537427d2094a5db72ada218ac29b2edb
Author: beenje <[email protected]>
Date: Thu Feb 28 21:55:41 2013 +0100
[plugin.video.pbs] updated to version 3.0.11
diff --git a/plugin.video.pbs/addon.xml b/plugin.video.pbs/addon.xml
index 751dbc2..9599074 100644
--- a/plugin.video.pbs/addon.xml
+++ b/plugin.video.pbs/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.pbs"
name="PBS"
- version="3.0.10"
+ version="3.0.11"
provider-name="stacked">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
diff --git a/plugin.video.pbs/changelog.txt b/plugin.video.pbs/changelog.txt
index 7eaa15c..4b4b6f0 100644
--- a/plugin.video.pbs/changelog.txt
+++ b/plugin.video.pbs/changelog.txt
@@ -1,3 +1,9 @@
+[B]Version 3.0.11[/B]
+
+- Removed deprecated video quality 'MPEG-4 500kbps'
+- Set default video quality to 'MP4 800k'
+- Fixed 'base' referenced before assignment error
+
[B]Version 3.0.10[/B]
- Fixed index error when loading directories
diff --git a/plugin.video.pbs/default.py b/plugin.video.pbs/default.py
index e3d7f23..28e1b68 100644
--- a/plugin.video.pbs/default.py
+++ b/plugin.video.pbs/default.py
@@ -5,8 +5,8 @@ import simplejson as json
plugin = "PBS"
__author__ = 'stacked <[email protected]>'
__url__ = 'http://code.google.com/p/plugin/'
-__date__ = '01-20-2013'
-__version__ = '3.0.10'
+__date__ = '02-28-2013'
+__version__ = '3.0.11'
settings = xbmcaddon.Addon( id = 'plugin.video.pbs' )
buggalo.SUBMIT_URL = 'http://www.xbmc.byethost17.com/submit.php'
dbg = False
@@ -185,10 +185,10 @@ def build_search_directory( url, page ):
@retry(TypeError)
def find_videos( name, program_id, topic, page ):
- if settings.getSetting("quality") == '0':
- type = ['MPEG-4 500kbps', 'MP4 800k', HIGH]
+ if settings.getSetting("video") == '0':
+ type = ['MP4 800k', 'Legacy KIDS encoding', HIGH]
else:
- type = [HIGH, 'MP4 800k', 'MPEG-4 500kbps' ]
+ type = [HIGH, 'MP4 800k', 'Legacy KIDS encoding']
start = str( 200 * page )
url = 'None'
backup_url = None
@@ -255,6 +255,7 @@ def play_video( name, url, thumb, plot, studio, starttime,
backup_url ):
print 'PBS - ' + studio + ' - ' + name
print url
playpath = False
+ defaulturl = url
#Release Urls
if 'http://release.theplatform.com/' in url:
@@ -274,15 +275,6 @@ def play_video( name, url, thumb, plot, studio, starttime,
backup_url ):
try:
base = re.compile( '<meta base="(.+?)" />' ).findall(
data )[0]
src = re.compile( '<ref src="(.+?)" title="(.+?)"
(author)?' ).findall( data )[0][0]
- except:
- print 'PBS - Release backup_url'
- if backup_url != 'None':
- url = backup_url
- backup_url = 'None'
- else:
- url = 'None'
- backup_url = 'None'
- if url != 'None' and 'http://urs.pbs.org/redirect/' not in url:
if base == 'http://ad.doubleclick.net/adx/':
src_data = src.split( "<break>" )
url = src_data[0] + "mp4:" +
src_data[1].replace('mp4:','')
@@ -291,6 +283,14 @@ def play_video( name, url, thumb, plot, studio, starttime,
backup_url ):
else:
url = base
playpath = "mp4:" + src.replace('mp4:','')
+ except:
+ print 'PBS - Release backup_url'
+ if backup_url != 'None':
+ url = backup_url
+ backup_url = 'None'
+ else:
+ url = 'None'
+ backup_url = 'None'
#Empty Urls
if url == 'None':
@@ -342,6 +342,7 @@ def play_video( name, url, thumb, plot, studio, starttime,
backup_url ):
dialog = xbmcgui.Dialog()
ok = dialog.ok(plugin , settings.getLocalizedString( 30008 ))
ok = dialog.ok(plugin, settings.getLocalizedString( 30051 ))
+ buggalo.addExtraData('defaulturl', defaulturl)
buggalo.addExtraData('url', url)
buggalo.addExtraData('info', studio + ' - ' + name)
raise Exception("backup_url ERROR")
diff --git a/plugin.video.pbs/resources/language/English/strings.xml
b/plugin.video.pbs/resources/language/English/strings.xml
index 17aea53..d1ea871 100644
--- a/plugin.video.pbs/resources/language/English/strings.xml
+++ b/plugin.video.pbs/resources/language/English/strings.xml
@@ -19,7 +19,7 @@
<string id="30016">access to this content.</string>
<string id="30017">Preferred video quality:</string>
<string id="30018">2500k-1200k</string>
- <string id="30019">800k-500k</string>
+ <string id="30019">800k</string>
<string id="30050">There was a connection error:</string>
<string id="30051">If this problem persists, please submit the error
report.</string>
<string id="30052">Retry</string>
diff --git a/plugin.video.pbs/resources/settings.xml
b/plugin.video.pbs/resources/settings.xml
index c3d6889..8def279 100644
--- a/plugin.video.pbs/resources/settings.xml
+++ b/plugin.video.pbs/resources/settings.xml
@@ -1,4 +1,4 @@
<settings>
- <setting id="quality" type="enum" label="30017" lvalues="30019|30018"
default="1"/>
+ <setting id="video" type="enum" label="30017" lvalues="30019|30018"
default="0"/>
<setting id="view" type="bool" label="30055" default="true"/>
</settings>
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=8160c81820dc01d5124231a1fc30d62b747cfd43
commit 8160c81820dc01d5124231a1fc30d62b747cfd43
Author: beenje <[email protected]>
Date: Thu Feb 28 21:55:38 2013 +0100
[plugin.video.tv5monde] updated to version 1.1.2
diff --git a/plugin.video.tv5monde/addon.xml b/plugin.video.tv5monde/addon.xml
index 06ccda9..d0eb8b7 100644
--- a/plugin.video.tv5monde/addon.xml
+++ b/plugin.video.tv5monde/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.tv5monde" name="tv5monde" version="1.1.1"
provider-name="jamontes">
+<addon id="plugin.video.tv5monde" name="tv5monde" version="1.1.2"
provider-name="jamontes">
<requires>
<!-- FRODO version -->
<import addon="xbmc.python" version="2.1.0"/>
@@ -9,12 +9,12 @@
</extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
- <summary lang="en">TV5MONDE videos (EN)</summary>
- <description lang="en">This plugin allows you to watch the TV5MONDE
videos provided by TV5MONDE+ web site, selected by category and ordered by date
of apearance (EN)</description>
- <summary lang="es">TV5MONDE vÃdeos (ES)</summary>
- <description lang="es">Este plugin permite ver los vÃdeos de TV5MONDE
contenidos en la página web de TV5MONDE+, seleccionados por categorÃa y
ordenados por fecha de emisión (ES)</description>
- <summary lang="fr">TV5MONDE médiathèque (FR)</summary>
- <description lang="fr">Ce plugin permet de regarder TV5MONDE
médiathèque qui se trouve sur le site web de TV5MONDE+ (FR)</description>
+ <summary lang="en">TV5MONDE videos</summary>
+ <description lang="en">This plugin allows you to watch the TV5MONDE
videos provided by TV5MONDE+ web site, selected by category and ordered by date
of apearance</description>
+ <summary lang="es">TV5MONDE vÃdeos</summary>
+ <description lang="es">Este plugin permite ver los vÃdeos de TV5MONDE
contenidos en la página web de TV5MONDE+, seleccionados por categorÃa y
ordenados por fecha de emisión</description>
+ <summary lang="fr">TV5MONDE médiathèque</summary>
+ <description lang="fr">Ce plugin permet de regarder TV5MONDE
médiathèque qui se trouve sur le site web de TV5MONDE+</description>
<language>fr</language>
</extension>
</addon>
diff --git a/plugin.video.tv5monde/changelog.txt
b/plugin.video.tv5monde/changelog.txt
index bb82d42..64b87c3 100644
--- a/plugin.video.tv5monde/changelog.txt
+++ b/plugin.video.tv5monde/changelog.txt
@@ -1,25 +1,29 @@
-0.0.1
-- First Try.
-0.0.2
-- Added json query from category video list.
-- Supported category selection ordered by date.
-0.9.99
-- Supported french characteres on titles.
-- Play older videos at the end of category list.
-1.0.0
-- Refactoring and code optimization.
-- First public release.
-1.0.1
-- Fix a pre 2.7 python syntax error in get_plugin_parms to run over Windows 7
and ATV.
-- change fanart and icon images.
+1.1.2
+- Added TV5MONDE+7 and Programs sections.
+- Fixed bug with last page link under each category section.
+- Some refactoring and cleaning up.
+1.1.1
+- Scaled fanart and icon images according to add-ons standards.
+- Added language tag into addon.xml to allow add-ons search by language.
+1.1.0
+- Change xbmc.python rel to 2.1.0 for Frodo branch.
1.0.2
- Suported debug option from plugin settings. Now debug is disabled by default.
- Suported internationalization of gui messages: English, Spanish and French.
- Modified plugin description.
- Change the copyleft license from GPLv2 to GPLv3.
- Eden and Frodo branches splited for pull to oficial repositories.
-1.1.0
-- Change xbmc.python rel to 2.1.0 for Frodo branch.
-1.1.1
-- Scaled fanart and icon images according to add-ons standards.
-- Added language tag into addon.xml to allow add-ons search by language.
+1.0.1
+- Fix a pre 2.7 python syntax error in get_plugin_parms to run over Windows 7
and ATV.
+- Change fanart and icon images.
+1.0.0
+- Refactoring and code optimization.
+- First public release.
+0.9.99
+- Supported french characteres on titles.
+- Play older videos at the end of category list.
+0.0.2
+- Added json query from category video list.
+- Supported category selection ordered by date.
+0.0.1
+- First Try.
diff --git a/plugin.video.tv5monde/default.py b/plugin.video.tv5monde/default.py
index fcefae5..33b7da6 100644
--- a/plugin.video.tv5monde/default.py
+++ b/plugin.video.tv5monde/default.py
@@ -40,14 +40,38 @@ def run():
params = lutil.get_plugin_parms()
if params.get("action") is None:
- index(params)
+ create_index(params)
else:
action = params.get("action")
exec action+"(params)"
+def create_index(params):
+ lutil.log("tv5monde.create_index "+repr(params))
+
+ action = 'genre_index'
+ title = 'Les Genres'
+ url = 'http://www.tv5mondeplus.com/videos'
+ lutil.log('tv5monde.create_index action=["%s"] title=["%s"] url=["%s"]' %
(action, title, url))
+ lutil.addDir(action=action, title=title, url=url)
+
+ action = 'emission_index'
+ title = 'Les Emissions'
+ url = 'http://www.tv5mondeplus.com/emissions'
+ lutil.log('tv5monde.create_index action=["%s"] title=["%s"] url=["%s"]' %
(action, title, url))
+ lutil.addDir(action=action, title=title, url=url)
+
+ action = 'monde7_index'
+ title = 'TV5MONDE+7'
+ url = 'http://www.tv5mondeplus.com/grilles'
+ lutil.log('tv5monde.create_index action=["%s"] title=["%s"] url=["%s"]' %
(action, title, url))
+ lutil.addDir(action=action, title=title, url=url)
+
+ lutil.close_dir(pluginhandle)
+
+
# This function generate the video index ordered by category.
-def index(params):
- lutil.log("tv5monde.index "+repr(params))
+def genre_index(params):
+ lutil.log("tv5monde.genre_index "+repr(params))
url = 'http://www.tv5mondeplus.com/videos'
buffer_html = lutil.carga_web(url)
@@ -57,18 +81,120 @@ def index(params):
for genre, label in lutil.find_multiple(lista_genre, genre_pattern):
genre_url =
'http://www.tv5mondeplus.com/get/videos?pg=0&type=genre&sort=%s&loadpg=false&order=date'
% genre
- lutil.log('tv5monde.index url=["%s"] genre=["%s"]' % (genre_url,
label))
- lutil.addDir(action="main_list", title=label, url=genre_url)
+ lutil.log('tv5monde.genre_index url=["%s"] genre=["%s"]' % (genre_url,
label))
+ lutil.addDir(action="genre_list", title=label, url=genre_url)
+
+ lutil.close_dir(pluginhandle)
+
+# This function generate the video index ordered by category.
+def emission_index(params):
+ lutil.log("tv5monde.emission_index "+repr(params))
+
+ url = params.get("url")
+ emi_pattern_block = '<div id="liste-emission">(.*?)</div></div>'
+ emi_pattern = '<a href="([^"]+)">([^<]+)</a>'
+
+ buffer_html = lutil.carga_web(url)
+ cacho_html = lutil.find_first(buffer_html, emi_pattern_block)
+ for url, title in lutil.find_multiple(cacho_html, emi_pattern):
+ url = 'http://www.tv5mondeplus.com%s' % url
+ action = 'emission_first_list'
+ lutil.log('tv5monde.emission_index action=["%s"] url=["%s"]' %
(action, url))
+ lutil.addDir(action=action, title=title, url=url)
+
+ lutil.close_dir(pluginhandle)
+
+# This function generate the video index ordered by category.
+def monde7_index(params):
+ lutil.log("tv5monde.monde7_index "+repr(params))
+
+ url = params.get("url")
+ buffer_html = lutil.carga_web(url)
+ grille_pattern_block = '<ul id="grille-floater">(.*?)</ul>'
+ grille_pattern ='<li name="[^"]+".*?rel="([^"]+)"><span
class="titre">([^<]+)</span><span class="date">([^<]+)</span></a></li>'
+ block_grille = lutil.find_first(buffer_html, grille_pattern_block)
+
+ if block_grille:
+ lista_grille =
[('http://www.tv5mondeplus.com/grilles/calendar?ajx=1&pg=0&classes=%s&slot=&sig=0&onoff=1'
% rel, '%s, %s' % (weekday, date)) for rel, weekday, date in
lutil.find_multiple(block_grille, grille_pattern)]
+ lista_grille.reverse()
+
+ for monde7_url, label in lista_grille:
+ lutil.log('tv5monde.monde7_index url=["%s"]' % monde7_url)
+ lutil.addDir(action="monde7_list", title=label, url=monde7_url)
+
+ lutil.close_dir(pluginhandle)
+
+
+def emission_first_list(params):
+ lutil.log("tv5monde.emission_first_list "+repr(params))
+
+ url = params.get("url")
+ nid_pattern = '<input id="nid" type="hidden" value="([^"]+)" />'
+ vid_pattern = '<input id="vid" type="hidden" value="([^"]+)" />'
+ emiid_pattern = '<input id="emi_string" type="hidden" value="([^"]+)"
/>'
+
+ mi_html = lutil.carga_web(url)
+ mi_nid = lutil.find_first(mi_html, nid_pattern)
+ mi_vid = lutil.find_first(mi_html, vid_pattern)
+ mi_emi = lutil.find_first(mi_html, emiid_pattern)
+ url_query =
'http://www.tv5mondeplus.com/get/video_emi?pg=0&emi=%s&nid=%s&vid=%s' %
(mi_emi, mi_nid, mi_vid)
+ params['referer'] = url
+ params['url'] = url_query
+
+ return emission_list(params)
+
+
+def emission_list(params):
+ lutil.log("tv5monde.emission_list "+repr(params))
+
+ url = params.get("url")
+ referer = params.get("referer")
+
+ mi_headers = { 'Accept' : 'application/json, text/javascript,
*/*',
+ 'Accept-Encoding' : 'deflate',
+ 'X-Requested-With' : 'XMLHttpRequest',
+ 'Referer' : referer,
+ 'Cookie' : 'ns_cookietest=true; ns_session=true'
+ }
+
+ buffer_html = lutil.carga_web(params.get("url"), mi_headers)
+ buffer_json = lutil.get_json_dict(buffer_html)
+ pattern_videos = '<a title="([^"]+)" href=".+?nid=([^"]+)"> <img
src="([^"]+)".*?<p class="date">([^<]+)</p>'
+ videolist = lutil.find_multiple(buffer_json['content'], pattern_videos)
+ for title, videoid, thumbnail, date in videolist:
+ video_url = 'http://www.tv5mondeplus.com/video-xml/get/%s' % videoid
+ title = title.replace('"', '"')
+ fecha = lutil.limpia_fecha(date)
+ lutil.log('videolist: URL: "%s" Date: "%s" Thumbnail: "%s"' %
(video_url, fecha, thumbnail))
+
+ plot = title
+ lutil.addLink(action="play_video", title='%s %s' % (title, fecha),
plot=plot, url=video_url, thumbnail=thumbnail)
+
+ pattern_next = '<li class="item suivante hide">.+?<a rel="address:([^"]+)"'
+ next_page = lutil.find_first(buffer_json['content'], pattern_next)
+ if next_page:
+ next_page_url = 'http://www.tv5mondeplus.com%s' % next_page
+ lutil.log('next_page_url="%s"' % next_page_url)
+ lutil.addDir(action="emission_list", title=">> %s" %
translation(30010), url=next_page_url, referer=referer)
lutil.close_dir(pluginhandle)
# This function generates the list of videos available on each category,
ordered by date.
-def main_list(params):
- lutil.log("tv5monde.main_list "+repr(params))
+def genre_list(params):
+ lutil.log("tv5monde.genre_list "+repr(params))
# Loads the list of videos of the selected category based on the json
object retrieved from the server.
- buffer_json = lutil.get_json(params.get("url"))
+ mi_headers = { 'Accept' : 'application/json, text/javascript,
*/*',
+ 'Accept-Encoding' : 'deflate',
+ 'X-Requested-With' : 'XMLHttpRequest',
+ 'Referer' : 'http://www.tv5mondeplus.com/videos',
+ 'Cookie' : 'ns_cookietest=true; ns_session=true'
+ }
+
+ url = params.get("url")
+ buffer_html = lutil.carga_web(url, mi_headers)
+ buffer_json = lutil.get_json_dict(buffer_html)
pattern_videos = '<a title="([^"]+)" href="/video/([^/]+)/[^"]+"> <img
src="([^"]+)" .*?<div class="bookmark" id="book_([0-9]+)">'
videolist = lutil.find_multiple(buffer_json['content'], pattern_videos)
@@ -85,15 +211,61 @@ def main_list(params):
pattern_total = '<ul class="pager" total="([0-9]+)"'
pattern_genre = 'sort=([0-9]+)'
last_page = int(lutil.find_first(buffer_json['pager'], pattern_total))
- 1
- next_page = int(lutil.find_first(params.get("url"), pattern_page)) + 1
- if last_page != next_page:
- genre = lutil.find_first(params.get("url"), pattern_genre)
+ current_page = int(lutil.find_first(url, pattern_page))
+ if last_page > current_page:
+ next_page = current_page + 1
+ genre = lutil.find_first(url, pattern_genre)
next_page_url =
'http://www.tv5mondeplus.com/get/videos?pg=%s&type=genre&sort=%s&loadpg=false&order=date'
% (next_page, genre)
- lutil.log('next_page=%s last_page=%s next_page_url="%s"' %
(next_page, last_page, next_page_url))
- lutil.addDir(action="main_list", title=">> %s" %
translation(30010), url=next_page_url)
+ lutil.log('current_page=%s last_page=%s next_page_url="%s"' %
(current_page, last_page, next_page_url))
+ lutil.addDir(action="genre_list", title=">> %s" %
translation(30010), url=next_page_url)
lutil.close_dir(pluginhandle)
+
+# This function generates the list of videos available on each day.
+def monde7_list(params):
+ lutil.log("tv5monde.monde7_list "+repr(params))
+
+ # Loads the list of videos of the selected category based on the json
object retrieved from the server.
+ mi_headers = { 'Accept' : 'application/json, text/javascript,
*/*',
+ 'Accept-Encoding' : 'deflate',
+ 'X-Requested-With' : 'XMLHttpRequest',
+ 'Referer' :
'http://www.tv5mondeplus.com/grilles',
+ 'Cookie' : 'ns_cookietest=true; ns_session=true'
+ }
+
+ url = params.get("url")
+ buffer_html = lutil.carga_web(url, mi_headers)
+ buffer_json = lutil.get_json_dict(buffer_html)
+
+ pattern_videos = '<li class="item hide">.*? <div class="ivid">.*?<div
class="image-tv">.*?<a href="/video/([^/]+)/.*?<img
src="([^"]+)".*?<span>(.*?)</span><a href="[^>]+?>([^<]+?)<.*?<div
class="bookmark" id="book_([0-9]+)">.*?</li>'
+ videolist = lutil.find_multiple(buffer_json['output'], pattern_videos)
+
+ for date, thumbnail, time, title, videoid in videolist:
+ title = title.replace('"', '"')
+ mi_title = '%s (%s %s)' % (title, date, time[:5])
+ video_url = 'http://www.tv5mondeplus.com/video-xml/get/%s' % videoid
+ lutil.log('videolist: URL: "%s" Descripcion: "%s" Thumbnail: "%s"' %
(video_url, title, thumbnail))
+
+ plot = title
+ lutil.addLink(action="play_video", title=mi_title, plot=plot,
url=video_url, thumbnail=thumbnail)
+
+ if buffer_json['pager'] is not None:
+ pattern_page = 'pg=([0-9]+)'
+ pattern_total = '<ul class="pager" total="([0-9]+)"'
+ pattern_class = 'classes=([0-9-]+)'
+ last_page = int(lutil.find_first(buffer_json['pager'], pattern_total))
- 1
+ current_page = int(lutil.find_first(url, pattern_page))
+ if last_page > current_page:
+ next_page = current_page + 1
+ mi_class = lutil.find_first(url, pattern_class)
+ next_page_url =
'http://www.tv5mondeplus.com/grilles/calendar?ajx=1&pg=%s&classes=%s&slot=&sig=0&onoff=1'
% (next_page, mi_class)
+ lutil.log('current_page=%s last_page=%s next_page_url="%s"' %
(current_page, last_page, next_page_url))
+ lutil.addDir(action="monde7_list", title=">> %s" %
translation(30010), url=next_page_url)
+
+ lutil.close_dir(pluginhandle)
+
+
# This function searchs on the web server (up to 2 times) in order to get the
video link and then reproduces the video.
def play_video(params):
lutil.log("tv5monde.play_video "+repr(params))
diff --git a/plugin.video.tv5monde/lutil.py b/plugin.video.tv5monde/lutil.py
index c0bce56..2172e4e 100644
--- a/plugin.video.tv5monde/lutil.py
+++ b/plugin.video.tv5monde/lutil.py
@@ -19,7 +19,7 @@
Description:
These funtions are called from the main plugin module, aimed to ease and
simplify the plugin development process.
- Release 0.1.1
+ Release 0.1.3
'''
# First of all We must import all the libraries used for plugin development.
@@ -31,6 +31,7 @@ import xbmcplugin, xbmcaddon, xbmcgui, xbmc, xbmcaddon
def get_plugin_settings(plugin_id=""):
return xbmcaddon.Addon(id=plugin_id)
+
debug_enable = False # The debug logs are disabled by default.
# This function sets the debug_enable var to log everything if debug option is
true.
@@ -39,19 +40,20 @@ def set_debug_mode(debug_flag=""):
if debug_flag == "true":
debug_enable = True
+
# This function logs the messages into the main XBMC log file. Called from
main plugin module.
def log(message):
if debug_enable:
xbmc.log(message.encode('ascii', 'ignore'))
+
# This function logs the messages into the main XBMC log file. Called from the
libraries module by other functions.
def _log(message):
if debug_enable:
- xbmc.log("lutils.%s" % message.encode('ascii', 'ignore'))
+ xbmc.log("lutils." + message.encode('ascii', 'ignore'))
+
# This function gets all the parameters passed to the plugin from XBMC API and
retuns a dictionary.
-# Example:
-# plugin://plugin.video.atactv/?parametro1=valor1¶metro2=valor2¶metro3
def get_plugin_parms():
params = sys.argv[2]
_log("get_plugin_parms " + str(params))
@@ -64,15 +66,16 @@ def get_plugin_parms():
# This function loads the html code from a webserver and returns it into a
string.
-def carga_web(url):
+def carga_web(url, headers=""):
_log("carga_web " + url)
- MiReq = urllib2.Request(url) # esto funciona de forma diferente porque
metemos una cabecera.
- # Tenemos que hacer creer a la web que usamos un navegador de usuario real.
- MiReq.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0)
Gecko/20100101 Firefox/17.0') # Cabecera del Firefox.
- MiConex = urllib2.urlopen(MiReq) # abrimos una conexion con la URL
- MiHTML = MiConex.read() # Chupamos TODO el contenido de la pagina web y lo
salvamos en una variable
- MiConex.close() # Cerramos la conexion con la pagina web, pues ya tenemos
toda la info que necesitamos.
+ MiReq = urllib2.Request(url) # We have to use this method as we need to
add some headers.
+ MiReq.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0)
Gecko/20100101 Firefox/17.0') # Firefox header.
+ for key in headers:
+ MiReq.add_header(key, headers[key])
+ MiConex = urllib2.urlopen(MiReq) # Opens the http connection to the URL.
+ MiHTML = MiConex.read() # Gets all the html contents from the URL and
stores it into a variable.
+ MiConex.close() # Close the http connection as we get what we need.
return MiHTML
@@ -88,23 +91,18 @@ def get_redirect(url):
return MiHTML
-# This function sends a http GET with XMLHttpRequest, and gets back a JSON
from the web server stored into a dict.
-def get_json(url):
- _log("get_json " + url)
-
- MiReq = urllib2.Request(url)
- MiReq.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0)
Gecko/20100101 Firefox/17.0')
- MiReq.add_header('Accept', 'application/json, text/javascript, */*')
- MiReq.add_header('Accept-Encoding', 'deflate')
- MiReq.add_header('X-Requested-With', 'XMLHttpRequest')
- MiReq.add_header('Referer', 'http://www.tv5mondeplus.com/videos')
- MiReq.add_header('Cookie', 'ns_cookietest=true; ns_session=true')
+# This function returns a json object collected from the web into a dictionary.
+def get_json_dict(MiJSON):
+ return json.loads(MiJSON)
- MiConex = urllib2.urlopen(MiReq)
- MiJSON = MiConex.read()
- MiConex.close()
- return json.loads(MiJSON)
+# This function cleans the date field obtained from the emissions JSON video
list.
+def limpia_fecha(date):
+ fecha = date.split(",")
+ dia = fecha[1][1:].replace("..","")
+ hora = fecha[2][1:8]
+ _log("limpia_fecha (%s %s)" % (dia, hora))
+ return "(%s %s)" % (dia, hora)
# This function allows us to find multiples matches from a regexp into a
string.
@@ -127,11 +125,16 @@ def find_first(text,pattern):
except:
return ""
+
# This function adds a directory entry into the XBMC GUI throught the API
-def addDir(action = "", title = "", url = "", thumbnail = ""):
- _log("addDir action = [" + action + "] title = [" + title + "] url = [" +
url + "] thumbnail = [" + thumbnail + "]")
+def addDir(action = "", title = "", url = "", thumbnail = "", referer = ""):
+ _log("addDir action = [" + action + "] url = [" + url + "] thumbnail = ["
+ thumbnail + "]")
+
+ if referer:
+ dir_url = '%s?action=%s&url=%s&referer=%s' % (sys.argv[0], action,
urllib.quote_plus(url), urllib.quote_plus(referer))
+ else:
+ dir_url = '%s?action=%s&url=%s' % (sys.argv[0], action,
urllib.quote_plus(url))
- dir_url = '%s?action=%s&url=%s' % (sys.argv[0], action,
urllib.quote_plus(url))
dir_item = xbmcgui.ListItem(title, iconImage = "DefaultFolder.png",
thumbnailImage = thumbnail)
dir_item.setInfo(type = "Video", infoLabels = {"Title": title})
return xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url =
dir_url, listitem = dir_item, isFolder = True)
@@ -139,7 +142,7 @@ def addDir(action = "", title = "", url = "", thumbnail =
""):
# This function adds a video link entry into the XBMC GUI throught the API
def addLink(action = "", title = "", plot = "", url = "", thumbnail = ""):
- _log("addDir action = [" + action + "] title = [" + title + "] plot = [" +
plot + "] url = [" + url + "] thumbnail = [" + thumbnail + "]")
+ _log("addLink action = [" + action + "] url = [" + url + "] thumbnail = ["
+ thumbnail + "]")
link_url = '%s?action=%s&url=%s' % (sys.argv[0], action,
urllib.quote_plus(url))
link_item = xbmcgui.ListItem(title, iconImage = "DefaultVideo.png",
thumbnailImage = thumbnail)
@@ -153,11 +156,13 @@ def close_dir(pluginhandle):
_log("close_dir pluginhadle: %s" % pluginhandle)
xbmcplugin.endOfDirectory(pluginhandle)
+
# This funtion shows a popup window with a notices message through the XBMC
GUI during 5 secs.
def showWarning(message):
_log("showWarning message: %s" % message)
xbmc.executebuiltin('XBMC.Notification(Info:,' + message + '!,6000)')
+
# This function plays the video file pointed by the URL passed as argument.
def play_resolved_url(pluginhandle= "", url = ""):
_log("play_resolved_url pluginhandle = [%s] url = [%s]" % (pluginhandle,
url))
-----------------------------------------------------------------------
Summary of changes:
plugin.video.pbs/addon.xml | 2 +-
plugin.video.pbs/changelog.txt | 6 +
plugin.video.pbs/default.py | 29 ++--
.../resources/language/English/strings.xml | 2 +-
plugin.video.pbs/resources/settings.xml | 2 +-
plugin.video.tv5monde/addon.xml | 14 +-
plugin.video.tv5monde/changelog.txt | 42 +++--
plugin.video.tv5monde/default.py | 198 ++++++++++++++++++--
plugin.video.tv5monde/lutil.py | 65 ++++---
9 files changed, 274 insertions(+), 86 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons