The branch, eden has been updated
via d69a8103b58216fdf0dab9a5ec0630112977da71 (commit)
via 304ea7899697036f9be6e6f4250bc9f6e0fd02c1 (commit)
from 914487870d2136e3396e038b04b2f5cf879d49c0 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=d69a8103b58216fdf0dab9a5ec0630112977da71
commit d69a8103b58216fdf0dab9a5ec0630112977da71
Author: beenje <[email protected]>
Date: Wed Dec 19 22:51:43 2012 +0100
[plugin.video.nolife] updated to version 1.15.0
diff --git a/plugin.video.nolife/addon.xml b/plugin.video.nolife/addon.xml
index 8cebec0..07c27ce 100644
--- a/plugin.video.nolife/addon.xml
+++ b/plugin.video.nolife/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.nolife"
name="Nolife Online"
- version="1.14.0"
+ version="1.15.0"
provider-name="gormux">
<requires>
<import addon="xbmc.python" version="2.0"/>
@@ -17,12 +17,12 @@
<language>fr</language>
<summary>Nolife Online XBMC Plugin</summary>
<description lang="fr">Un plugin pour accéder au contenu de Nolife Online.
-Nécéssite un compte payant sur le site http://www.nolife-tv.com
+Les modes accès libre et payant sont proposés par le plugin. Pour obtenir un
compte payant rendez-vous sur le site http://www.nolife-tv.com
Abonnez-vous :)
Pour toute question : [email protected] ou http://bugs.gormotte.info
</description>
<description lang="en">A plugin to access Nolife Online content.
-A paid account is necessary. Register on http://www.nolife-tv.com
+You can use either free or paid account. For paid account please register on
http://www.nolife-tv.com
Any question ? Ask [email protected], or see http://bugs.gormotte.info
</description>
<disclaimer lang="fr">Ce plugin n'est ni publié ni maintenu par Nolife,
et donc non officiel.</disclaimer>
diff --git a/plugin.video.nolife/default.py b/plugin.video.nolife/default.py
index 8f06ac4..526cee1 100644
--- a/plugin.video.nolife/default.py
+++ b/plugin.video.nolife/default.py
@@ -17,9 +17,21 @@ Nolife Online addon for XBMC
Authors: gormux, DeusP
"""
-import re, xbmcplugin, xbmcgui, xbmcaddon, urllib, urllib2, sys, cookielib,
pickle
+import os, re, xbmcplugin, xbmcgui, xbmcaddon, urllib, urllib2, sys,
cookielib, pickle
from BeautifulSoup import BeautifulSoup
+"""
+Class used as a C-struct to store video informations
+"""
+class videoInfo:
+ pass
+
+"""
+Class used to report login error
+"""
+class loginExpcetion(Exception):
+ pass
+
# Global variable definition
## Header for every log in this plugin
pluginLogHeader = "[XBMC_NOLIFE] "
@@ -27,6 +39,9 @@ pluginLogHeader = "[XBMC_NOLIFE] "
## Values for the mode parameter
MODE_LAST_SHOWS, MODE_CATEGORIES, MODE_SEARCH, MODE_SHOW_BY_URL, MODE_LINKS =
range(5)
+## Values for the subscription mode
+FREE, STANDARD, SUPPORT = range(3)
+
settings = xbmcaddon.Addon(id='plugin.video.nolife')
url = 'http://online.nolife-tv.com/index.php?'
name = 'Nolife Online'
@@ -34,6 +49,8 @@ mode = None
version = settings.getAddonInfo('version')
useragent = "XBMC Nolife-plugin/" + version
language = settings.getLocalizedString
+subscription = FREE
+fanartimage = os.path.join(settings.getAddonInfo("path"), "fanart.jpg")
def remove_html_tags(data):
"""Permits to remove all HTML tags
@@ -121,17 +138,17 @@ def login():
page = requestHandler.open("http://forum.nolife-tv.com/login.php",
loginrequest)
res = BeautifulSoup(page.read())
if re.compile('pas valide').findall(str(res)):
- xbmc.log(msg=pluginLogHeader + "Invalid username,
aborting",level=xbmc.LOGERROR)
+ xbmc.log(msg=pluginLogHeader + "Invalid username,
aborting",level=xbmc.LOGFATAL)
err = xbmcgui.Dialog()
- err.ok("Erreur", "Nom d'utilisateur ou mot de passe
invalide.","Veuillez vérifier les informations de connexion dans","les
paramètres de l'addon.")
- doanerror
+ err.ok(unicode(language(35002)), unicode(language(34001)),
unicode(language(34002)))
+ raise loginExpcetion()
elif re.compile('votre quota').findall(str(res)):
- xbmc.log(msg=pluginLogHeader + "User account
locked",level=xbmc.LOGERROR)
+ xbmc.log(msg=pluginLogHeader + "User account
locked",level=xbmc.LOGSEVERE)
err = xbmcgui.Dialog()
- err.ok("Message", "Trop d'erreurs d'authentification.","Veuillez
patienter 15 minutes avant de rééssayer","Vérifiez également vos
informations de connexion.")
- doanerror
+ err.ok(unicode(language(35001)), unicode(language(34003)),
unicode(language(34004)), unicode(language(34005)))
+ raise loginExpcetion()
else:
- xbmc.log(msg=pluginLogHeader + "Valid User",level=xbmc.LOGERROR)
+ xbmc.log(msg=pluginLogHeader + "Valid User",level=xbmc.LOGDEBUG)
def initialIndex():
"""Creates initial index
@@ -147,6 +164,7 @@ def getlastVideos():
Get the videos in the "last videos" menu option
"""
+ showseen = settings.getSetting( "showseen" )
postrequest = urllib.urlencode({'emissions': 0,
'famille': 0,
'a': 'ge'})
@@ -154,37 +172,16 @@ def getlastVideos():
page = requestHandler.open("http://mobile.nolife-tv.com/do.php",
postrequest)
liste = BeautifulSoup(page.read()).findAll('li')
for element in liste:
- if re.compile('data-icon="arrow-r"').findall(str(element)):
-
- if re.compile('icones/32/on').findall(str(element)):
- _seen = True
- else:
- _seen = False
-
- reg_date = '<p style="padding-right:25px;'\
- ' padding-left:10px;">.*</p>'
- _thumb = re.compile('data-thumb=".*"').findall(
-
str(element))[0][12:][:-1]
- _date_len = remove_html_tags(
-
re.compile(reg_date).findall(str(element))[0]
- )
- _duration = _date_len.split(' - ')[1]
-
- reg_vid = 'a href="emission-.*" '
- _vid = re.compile(reg_vid).findall(str(element))[0][17:][:-2]
-
- reg_desc = '<p style="padding-left:10px;"><strong>.*'
- _desc = remove_html_tags(
-
re.compile(reg_desc).findall(str(element))[0][30:])
-
- _name = remove_html_tags(
-
re.compile('<h3.*').findall(str(element))[0])
-
- addlink( _name + " - " + _desc,
- "plugin://plugin.video.nolife?id=" + _vid,
- _thumb,
- _duration,
- _seen )
+ extractVideoInfo(element)
+
+ videoInfo = extractVideoInfo(element)
+ if ( showseen == "false" and videoInfo.seen == False ):
+ if isAvailableForUser(videoInfo.availability):
+ addlink( videoInfo.name + " - " + videoInfo.desc,
+ "plugin://plugin.video.nolife?id=" + videoInfo.vid,
+ videoInfo.thumb,
+ videoInfo.duration,
+ videoInfo.seen )
def getcategories():
@@ -216,41 +213,43 @@ def search():
liste = BeautifulSoup(page.read()).findAll('li')
for element in liste:
- if re.compile('data-icon="arrow-r"').findall(str(element)):
- if re.compile('icones/32/on').findall(str(element)):
- _seen = True
- else:
- _seen = False
- reg_srch = 'a href="emission-.*" '
- _searchid = re.compile(reg_srch).findall(
- str(element))[0][17:][:-2]
- reg_desc = '<p style="padding-left:10px;"><strong>.*'
- _thumb = re.compile('data-thumb=".*"').findall(
- str(element))[0][12:][:-1]
- _bdesc = re.compile(reg_desc).findall(str(element))[0][30:]
- _bname = re.compile('<h3.*').findall(str(element))[0]
- _desc = remove_html_tags(_bdesc)
- _name = remove_html_tags(_bname)
- reg_date = '<p style="padding-right:25px;'\
- ' padding-left:10px;">.*</p>'
- _date_len = remove_html_tags(
- re.compile(reg_date).findall(str(element))[0]
- )
- _duration = _date_len.split(' - ')[1]
- addlink(_name + " - " + _desc,
- "plugin://plugin.video.nolife?id=" + _searchid,
- _thumb,
- _duration,
- _seen )
+ videoInfo = extractVideoSearchInfo(element)
+
+ if videoInfo != None:
+ if isAvailableForUser(videoInfo.availability):
+ addlink(videoInfo.name + " - " + videoInfo.desc,
+ "plugin://plugin.video.nolife?id=" + videoInfo.id,
+ videoInfo.thumb,
+ videoInfo.duration,
+ videoInfo.seen )
def getshows(category):
"""
Gets shows in a category
"""
emissions = parse_categories()
+ excluded_shows = [ '75', '104', '89' ]
for emission in emissions:
- if emission[0] == category:
- add_dir(emission[1], emission[2], MODE_LINKS, emission[3])
+ if not emission[2] in excluded_shows:
+ if emission[0] == category:
+ add_dir(emission[1], emission[2], MODE_LINKS, emission[3])
+
+def isAvailableForUser(type_of_show):
+ """
+ Return true is the show is available for user, false otherwise
+ """
+ if "Archive" in type_of_show:
+ if subscription >= SUPPORT:
+ return True
+ else:
+ return False
+ elif "Standard" in type_of_show:
+ if subscription >= STANDARD or settings.getSetting("extracts") ==
'true':
+ return True
+ else:
+ return False
+ else:
+ return True
def getlinks(show):
"""
@@ -260,8 +259,7 @@ def getlinks(show):
show_n = settings.getSetting( "show_n" )
showall = settings.getSetting( "showall" )
showseen = settings.getSetting( "showseen" )
- user = settings.getSetting( "username" )
- pwd = settings.getSetting( "password" )
+
if showall == "true":
show_n = 65536
emissions = []
@@ -282,44 +280,20 @@ def getlinks(show):
finished = True
else:
for element in liste:
+
if int(float(show_n)) == len(emissions):
finished = True
break
- if ( re.compile('data-icon="arrow-r"').findall(str(element))
- and int(float(show_n)) > len(emissions) ):
- if re.compile('icones/32/on').findall(str(element)):
- _seen = True
- else:
- _seen = False
-
- reg_date = '<p style="padding-right:25px;'\
- ' padding-left:10px;">.*</p>'
- _date_len = remove_html_tags(
- re.compile(reg_date).findall(str(element))[0]
- )
- _thumb = re.compile('data-thumb=".*"').findall(
- str(element))[0][12:][:-1]
- _duration = _date_len.split(' - ')[1]
-
- req_id = 'a href="emission-.*" '
- _id = re.compile(req_id).findall(
- str(element))[0][17:][:-2]
-
- req_desc = '<p style="padding-left:10px;"><strong>.*'
- _desc = remove_html_tags(
- re.compile(req_desc).findall(str(element))[0][30:]
- )
-
- _name = remove_html_tags(
- re.compile('<h3.*').findall(str(element))[0]
- )
-
- emissions.append([_id,
- _name,
- _desc,
- _duration,
- _seen,
- _thumb])
+
+ videoInfo = extractVideoInfo(element)
+
+ if isAvailableForUser(videoInfo.availability):
+ emissions.append([videoInfo.id,
+ videoInfo.name,
+ videoInfo.desc,
+ videoInfo.duration,
+ videoInfo.seen,
+ videoInfo.thumb])
i = i + 1
for emission in emissions:
@@ -360,8 +334,6 @@ def playvideo(requestHandler, video):
Plays video
"""
settings = xbmcaddon.Addon(id='plugin.video.nolife')
- user = settings.getSetting( "username" )
- pwd = settings.getSetting( "password" )
quality = settings.getSetting( "quality" )
if quality == "HQ" or quality == "1":
_video = video + "?quality=2"
@@ -376,6 +348,7 @@ def playvideo(requestHandler, video):
else:
_video = video
+ requestHandler.addheaders = [("User-agent", useragent)]
page = requestHandler.open(_video)
url = page.geturl()
xbmc.log(msg=pluginLogHeader + "URL :" + url,level=xbmc.LOGDEBUG)
@@ -440,25 +413,117 @@ def add_dir(name, url, mode, iconimage):
# Hack to avoid incompatiblity of urllib with unicode string
if isinstance(name, str):
- xbmc.log(msg="[XXX] str dir",level=xbmc.LOGERROR)
url = sys.argv[0]+"?url="+urllib.quote_plus(url)+\
"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
else:
url = sys.argv[0]+"?url="+urllib.quote_plus(url)+\
"&mode="+str(mode)+"&name="+urllib.quote_plus(name.encode("ascii",
"ignore"))
- liz = xbmcgui.ListItem(name,
- iconImage="DefaultFolder.png",
- thumbnailImage=iconimage)
+ showid = url.split('?')[1].split('&')[0].split('=')[1]
+ thumbnailimage = os.path.join(settings.getAddonInfo("path"), 'resources',
'images', showid + '.jpeg')
+ if not iconimage == '':
+ liz = xbmcgui.ListItem(name,
+ iconImage=iconimage,
+ thumbnailImage=iconimage)
+ else:
+ liz = xbmcgui.ListItem(name,
+ iconImage=thumbnailimage,
+ thumbnailImage=thumbnailimage)
+
liz.setInfo(
type="Video",
infoLabels={ "Title": name }
)
+ liz.setProperty('fanart_image', fanartimage)
ok = xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]),
url=url,
listitem=liz,
isFolder=True )
return ok
+def get_subscription_mode():
+ """
+ Return the subscription mode for the current user
+ """
+ url = "http://mobile.nolife-tv.com/abonnement/"
+
+ page = requestHandler.open(url)
+ htmlContent = page.read();
+ if "Soutien" in htmlContent:
+ xbmc.log(msg=pluginLogHeader + "User has a support
account",level=xbmc.LOGNOTICE)
+ return SUPPORT
+ elif "Standard" in htmlContent:
+ xbmc.log(msg=pluginLogHeader + "User has a standard
account",level=xbmc.LOGNOTICE)
+ return STANDARD
+ else :
+ xbmc.log(msg=pluginLogHeader + "User has no
account",level=xbmc.LOGNOTICE)
+ return FREE
+
+
+def extractVideoInfo(element):
+ """
+ Extract video info from html and store it in videoInfo class
+ """
+ info = videoInfo()
+ if re.compile('data-icon="arrow-r"').findall(str(element)):
+
+ if re.compile('icones/32/on').findall(str(element)):
+ info.seen = True
+ else:
+ info.seen = False
+
+ reg_date = '<p style="padding-right:25px;'\
+ ' padding-left:10px;">.*</p>'
+ info.thumb =
re.compile('data-thumb=".*"').findall(str(element))[0][12:][:-1]
+ _date_len =
remove_html_tags(re.compile(reg_date).findall(str(element))[0])
+ info.duration = _date_len.split(' - ')[1]
+
+ req_id = 'a href="emission-.*" '
+ info.id = re.compile(req_id).findall(str(element))[0][17:][:-2]
+
+ req_availability = '<p style="float:right; margin-right:-15px;
clear:right;"><strong>.*'
+ info.availability =
remove_html_tags(re.compile(req_availability).findall(str(element))[0][57:].replace("[",
"").replace("]", ""))
+
+ reg_vid = 'a href="emission-.*" '
+ info.vid = re.compile(reg_vid).findall(str(element))[0][17:][:-2]
+
+ reg_desc = '<p style="padding-left:10px;"><strong>.*'
+ info.desc =
remove_html_tags(re.compile(reg_desc).findall(str(element))[0][30:])
+
+ info.name =
remove_html_tags(re.compile('<h3.*').findall(str(element))[0])
+
+ return info
+
+def extractVideoSearchInfo(element):
+ """
+ Extract video info from html from a search page and store it in videoInfo
class
+ """
+ info = None
+ if re.compile('data-icon="arrow-r"').findall(str(element)):
+ info = videoInfo()
+ if re.compile('icones/32/on').findall(str(element)):
+ info.seen = True
+ else:
+ info.seen = False
+
+ reg_srch = 'a href="emission-.*" '
+ info.id = re.compile(reg_srch).findall(str(element))[0][17:][:-2]
+
+ reg_desc = '<p style="padding-left:10px;"><strong>.*'
+ info.thumb =
re.compile('data-thumb=".*"').findall(str(element))[0][12:][:-1]
+ _bdesc = re.compile(reg_desc).findall(str(element))[0][30:]
+ _bname = re.compile('<h3.*').findall(str(element))[0]
+ info.desc = remove_html_tags(_bdesc)
+ info.name = remove_html_tags(_bname)
+
+ req_availibity = '<p style="float:right; margin-right:-15px;
clear:right;"><strong>.*'
+ info.availability =
remove_html_tags(re.compile(req_availibity).findall(str(element))[0][30:])
+
+ reg_date = '<p style="padding-right:25px; padding-left:10px;">.*</p>'
+ _date_len =
remove_html_tags(re.compile(reg_date).findall(str(element))[0])
+ info.duration = _date_len.split(' - ')[1]
+
+ return info
+
## Start of the add-on
xbmc.log(msg=pluginLogHeader + "-----------------------",level=xbmc.LOGDEBUG)
xbmc.log(msg=pluginLogHeader + "Nolife plugin main loop",level=xbmc.LOGDEBUG)
@@ -491,7 +556,14 @@ xbmc.log(msg=pluginLogHeader + "requested id : " +
str(_id),level=xbmc.LOGDEBUG)
xbmc.log(msg=pluginLogHeader + "No cookies, adding a jar",level=xbmc.LOGDEBUG)
cj = cookielib.CookieJar()
requestHandler = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-login()
+
+# The login is only done for authenticated mode
+if settings.getSetting( "authenticate" ) == "true":
+ xbmc.log(msg=pluginLogHeader + "authentication
requested",level=xbmc.LOGDEBUG)
+ login()
+
+# Find the access mode of the user
+subscription = get_subscription_mode()
# Determining and executing action
if( mode == None or url == None or len(url) < 1 ) and _id == 0:
diff --git a/plugin.video.nolife/resources/language/english/strings.xml
b/plugin.video.nolife/resources/language/english/strings.xml
index bafd131..9c4bf2b 100644
--- a/plugin.video.nolife/resources/language/english/strings.xml
+++ b/plugin.video.nolife/resources/language/english/strings.xml
@@ -1,15 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<strings>
+ <!-- Parameters -->
<string id="32001">Authentication</string>
+ <string id="32010">Use a Nolife account</string>
<string id="32011">Username</string>
<string id="32012">Password</string>
+ <string id="32013">See previews</string>
<string id="33001">Appearance</string>
<string id="33011">Order by</string>
<string id="33012">Show all videos</string>
<string id="33013">Number of videos to show</string>
<string id="33014">Quality</string>
<string id="33015">Show already seen videos</string>
+
+ <!-- List of shows messages -->
<string id="33016">Last shows</string>
<string id="33017">Shows</string>
<string id="33018">Search</string>
+
+ <!-- Error messages -->
+ <string id="34001">Invalid user name.</string>
+ <string id="34002">Please check your login informations in addon's'
parameter menu.</string>
+ <string id="34003">There have been too many authentication errors.</string>
+ <string id="34004">You should wait 15 minutes before any new login
attempts.</string>
+ <string id="34005">Please check your login informations.</string>
+
+ <!-- Common messages -->
+ <string id="35001">Message</string>
+ <string id="35002">Error</string>
</strings>
diff --git a/plugin.video.nolife/resources/language/french/strings.xml
b/plugin.video.nolife/resources/language/french/strings.xml
index de7bdab..336e299 100644
--- a/plugin.video.nolife/resources/language/french/strings.xml
+++ b/plugin.video.nolife/resources/language/french/strings.xml
@@ -1,15 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<strings>
+ <!-- Paramètres -->
<string id="32001">Authentification</string>
+ <string id="32010">Utiliser un compte Nolife</string>
<string id="32011">Nom d'utilisateur</string>
<string id="32012">Mot de passe</string>
+ <string id="32013">Voir les extraits des émissions</string>
<string id="33001">Apparence</string>
<string id="33011">Classement</string>
<string id="33012">Afficher toutes les émissions</string>
<string id="33013">Nombre d'émissions à afficher</string>
<string id="33014">Qualité vidéo</string>
<string id="33015">Afficher les émissions déjà vues</string>
+
+ <!-- Messages dans la liste -->
<string id="33016">Dernières émissions</string>
<string id="33017">Ãmissions</string>
<string id="33018">Recherche</string>
+
+ <!-- Messages d'erreur -->
+ <string id="34001">Nom d'utilisateur ou mot de passe invalide.</string>
+ <string id="34002">Veuillez vérifier les informations de connexion. Ces
informations ce trouvent dans les paramètres de l'addon.</string>
+ <string id="34003">Trop d'erreurs d'authentification.</string>
+ <string id="34004">Veuillez patienter 15 minutes avant de
rééssayer.</string>
+ <string id="34005">Vérifiez également vos informations de
connexion.</string>
+
+ <!-- Messages généraux -->
+ <string id="35001">Message</string>
+ <string id="35002">Erreur</string>
</strings>
diff --git a/plugin.video.nolife/resources/settings.xml
b/plugin.video.nolife/resources/settings.xml
index 4bb1184..fe9bf69 100644
--- a/plugin.video.nolife/resources/settings.xml
+++ b/plugin.video.nolife/resources/settings.xml
@@ -3,8 +3,10 @@
<!-- Authentication -->
<category label="32001">
- <setting id="username" type="text" label="32011" default=""/>
- <setting id="password" type="text" option="hidden" label="32012"
default=""/>
+ <setting id="authenticate" type="bool" label="32010" default="false" />
+ <setting id="username" type="text" label="32011" enable="eq(-1,true)"
default="" />
+ <setting id="password" type="text" option="hidden" label="32012"
default="" enable="eq(-2,true)"/>
+ <setting id="extracts" type="bool" option="hidden" label="32013"
default="" enable="eq(-3,false)"/>
</category>
<!-- Affichage -->
<category label="33001">
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=304ea7899697036f9be6e6f4250bc9f6e0fd02c1
commit 304ea7899697036f9be6e6f4250bc9f6e0fd02c1
Author: beenje <[email protected]>
Date: Wed Dec 19 22:51:23 2012 +0100
[plugin.video.earth.touch] updated to version 1.0.2
diff --git a/plugin.video.earth.touch/addon.xml
b/plugin.video.earth.touch/addon.xml
index ecbf044..4825060 100644
--- a/plugin.video.earth.touch/addon.xml
+++ b/plugin.video.earth.touch/addon.xml
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.earth.touch"
name="Earth Touch"
- version="1.0.1"
+ version="1.0.2"
provider-name="divingmule">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.beautifulsoup" version="3.0.8"/>
- <import addon="script.common.plugin.cache" version="0.9.2"/>
- <import addon="plugin.video.vimeo" version="2.2.0"/>
+ <import addon="script.common.plugin.cache" version="1.3.0"/>
+ <import addon="plugin.video.vimeo" version="2.4.0"/>
+ <import addon="plugin.video.youtube" version="3.3.0"/>
</requires>
<extension point="xbmc.python.pluginsource"
library="default.py">
diff --git a/plugin.video.earth.touch/default.py
b/plugin.video.earth.touch/default.py
index bbf1501..e6fe307 100644
--- a/plugin.video.earth.touch/default.py
+++ b/plugin.video.earth.touch/default.py
@@ -13,110 +13,160 @@ except:
__settings__ = xbmcaddon.Addon(id='plugin.video.earth.touch')
__language__ = __settings__.getLocalizedString
-home = __settings__.getAddonInfo('path')
-icon = xbmc.translatePath(os.path.join(home, 'icon.png'))
-videoq = __settings__.getSetting('video_quality')
+addon_version = __settings__.getAddonInfo('version')
+home = xbmc.translatePath(__settings__.getAddonInfo('path'))
+icon = os.path.join(home, 'icon.png')
+default_fanart = os.path.join(home, 'fanart.jpg')
cache = StorageServer.StorageServer("earthtouch", 24)
-base = 'http://www.earth-touch.com'
+base_url = 'http://www.earthtouch.tv'
+debug = __settings__.getSetting('debug')
+if debug == 'true':
+ cache.dbg = True
+def addon_log(string):
+ if debug == 'true':
+ xbmc.log("[addon.earthtouch-%s]: %s" %(addon_version, string))
+
def make_request(url):
try:
- headers = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:6.0) Gecko/20100101 Firefox/6.0',
- 'Referer' : 'http://www.earth-touch.com'}
+ headers = {
+ 'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0)
Gecko/20100101 Firefox/16.0',
+ 'Referer' : base_url
+ }
req = urllib2.Request(url,None,headers)
response = urllib2.urlopen(req)
data = response.read()
response.close()
return data
except urllib2.URLError, e:
- print 'We failed to open "%s".' % url
+ addon_log('We failed to open "%s".' % url)
if hasattr(e, 'reason'):
- print 'We failed to reach a server.'
- print 'Reason: ', e.reason
+ addon_log('We failed to reach a server.')
+ addon_log('Reason: %s' %e.reason)
if hasattr(e, 'code'):
- print 'We failed with error code - %s.' % e.code
+ addon_log('We failed with error code - %s.' %e.code)
xbmc.executebuiltin("XBMC.Notification(Earth-Touch,HTTP ERROR:
"+str(e.code)+",5000,"+ICON+")")
def cache_shows():
- soup = BeautifulSoup(make_request(base+'/shows/'),
convertEntities=BeautifulSoup.HTML_ENTITIES)
- items = soup('div', attrs={'class' : 'show-block'})
- shows = []
- for i in items:
- thumb = i.img['src']
- name = i.h3.string
+ soup = BeautifulSoup(make_request(base_url),
convertEntities=BeautifulSoup.HTML_ENTITIES)
+ homepage = {}
+ latest = []
+ img_tag = soup.find('img', attrs={'id': 'bgimg'})
+ if img_tag:
+ fanart = img_tag['src']
+ else: fanart = default_fanart
+ homepage['fanart'] = fanart
+ latest_items = soup.find('div', attrs={'class': 'es-carousel'})('li')
+ for i in latest_items:
+ duration = i('span', attrs={'class': 'timestamp'})[0].string
+ latest.append((i.h3.string, i.a['href'], i.img['src'], duration,
i.blockquote.string))
+ homepage['latest'] = latest
+ featured = []
+ featured_items = soup.find('div', attrs={'class':
'flex-container'})('a')
+ for i in featured_items:
+ title = i.h3.string
+ thumb = i('img')[-1]['src']
+ duration = i('span', attrs={'class': 'timestamp'})[0].string
desc = i.p.string.strip()
- href = i('a', attrs={'class' : 'linkout'})[0]['href']
- shows.append((name,href,thumb,desc))
- return(str(shows))
+ featured.append((title, i['href'], thumb, duration, desc))
+ homepage['featured'] = featured
+ channels = {}
+ channel_items = soup.find('div', attrs={'class': 'channel-block'})('a')
+ for i in channel_items:
+ title = i.h3.string+' - '+i.small.string
+ channels[title] = {}
+ channels[title]['href'] = i['href']
+ homepage['channels'] = channels
+ for i in homepage['channels'].keys():
+ channel_url = base_url+homepage['channels'][i]['href']
+ soup = BeautifulSoup(make_request(channel_url),
convertEntities=BeautifulSoup.HTML_ENTITIES)
+ show_items = soup.findAll('div', attrs={'class': 'show-block'})
+ show_list = []
+ for s in show_items:
+ href = s.a['href'].rsplit('/', 2)[0]
+ show_list.append((s.h3.string, href, s.img['src'],
s.p.string))
+ homepage['channels'][i]['shows'] = show_list
+ return homepage
def get_shows():
- for i in eval(cache.cacheFunction(cache_shows)):
- addDir(i[0], base+i[1], 1, base+i[2], i[3])
- addDir('Podcasts', '', 4, xbmc.translatePath(os.path.join(home,
'resources', 'podcasts_icon.png')))
+ data = cache.cacheFunction(cache_shows)
+ fanart = base_url+data['fanart']
+ addDir(__language__(30001), 'recent', icon, fanart, 4)
+ channels = data['channels']
+ for i in channels.keys():
+ for s in channels[i]['shows']:
+ title = s[0].encode('utf-8')
+ desc = s[3].encode('utf-8').strip()
+ addDir(title, base_url+s[1], base_url+s[2], fanart, 1, '',
desc)
+ xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
+
+
+def get_latest_episodes():
+ data = cache.cacheFunction(cache_shows)
+ for i in data['latest']:
+ title = i[0].encode('utf-8')
+ desc = i[4].encode('utf-8').strip()
+ addDir(title, base_url+i[1], base_url+i[2],
base_url+data['fanart'], 2, i[3], desc, True)
+ xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
def index_show(url, show_name):
soup = BeautifulSoup(make_request(url),
convertEntities=BeautifulSoup.HTML_ENTITIES)
+ img_tag = soup.find('img', attrs={'class': 'slide-img'})
+ if img_tag:
+ fanart = img_tag['src']
+ else:
+ img_tag = soup.find('img', attrs={'id': 'bgimg'})
+ if img_tag:
+ fanart = img_tag['src']
+ else:
+ fanart = default_fanart
items = soup('div', attrs={'class' : "es-carousel"})[0]('li')
for i in items:
- episode = i.h3.string
- name = show_name + ': '+ episode.title()
desc = i('p')[-1].string.strip()
duration = i.span.string
- thumb = i.img['src']
- href = i.a['href']
- addPlayableLink(name, base+href, desc, duration, base+thumb, 2)
-
-
+ addDir(i.h3.string.title(), base_url+i.a['href'],
base_url+i.img['src'], base_url+fanart, 2, duration, desc, True)
+ xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
+
+
def resolve_url(url):
- soup = BeautifulSoup(make_request(url),
convertEntities=BeautifulSoup.HTML_ENTITIES)
- vid_id = soup.iframe['id'].split('_')[1]
- path
='plugin://plugin.video.vimeo/?path=/root/explore/hd&action=play_video&videoid='+vid_id
- item = xbmcgui.ListItem(path=path)
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
-
-
-def podcasts():
- thumb = xbmc.translatePath(os.path.join(home, 'resources',
'podcasts_icon.png'))
- feed = 'http://feeds2.feedburner.com/'
- if videoq==__language__(30011):
-
addDir(__language__(30000),feed+'earth-touch_featured_720p_commentary', 5,
thumb)
- addDir(__language__(30001),feed+'earth-touch_featured_720p', 5,
thumb)
- addDir(__language__(30003),feed+'WeeklyMarinePodcast-hd', 5, thumb)
- addDir(__language__(30004),feed+'moremi_podcast_720', 5, thumb)
- addDir(__language__(30002),feed+'earth-touch_podcast_720p', 5,
thumb)
- addDir(__language__(30005),feed+'kids-hd', 5, thumb)
- elif videoq==__language__(30012):
-
addDir(__language__(30000),feed+'earth-touch_featured_480p_commentary', 5,
thumb)
- addDir(__language__(30001),feed+'earth-touch_featured_480p', 5,
thumb)
- addDir(__language__(30003),feed+'WeeklyMarinePodcast-ipod', 5,
thumb)
- addDir(__language__(30002),feed+'earth-touch_podcast_480p', 5,
thumb)
- addDir(__language__(30004),feed+'moremi_podcast_ipod', 5, thumb)
- addDir(__language__(30005),feed+'kids-ipod', 5, thumb)
- else:
-
addDir(__language__(30000),feed+'earth-touch_featured_720p_commentary', 5,
thumb)
- addDir(__language__(30001),feed+'earth-touch_featured_720p', 5,
thumb)
- addDir(__language__(30003),feed+'WeeklyMarinePodcast-hd', 5, thumb)
- addDir(__language__(30004),feed+'moremi_podcast_720', 5, thumb)
- addDir(__language__(30002),feed+'earth-touch_podcast_720p', 5,
thumb)
- addDir(__language__(30005),feed+'kids-hd', 5, thumb)
-
-def index_podcasts(url):
- soup = BeautifulStoneSoup(make_request(url),
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
- items = soup('li', attrs={'class' : "regularitem"})
- for i in items:
- name = i.a.string
- thumb = i.img['src']
- media_url = i.p.a['href']
+ data = make_request(url)
+ soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
+ path = ''
+ success = False
+ for i in soup('iframe'):
+ try:
+ id_key = i['id']
+ if id_key.startswith('player_'):
+ # vid_id = id_key.split('_')[1]
+ vid_id = id_key.replace('player_', '')
+ path
='plugin://plugin.video.vimeo/?path=/root/explore/hd&action=play_video&videoid='+vid_id
+ success = True
+ else:
+ addon_log('id_key: %s' %id_key)
+ if success: break
+ except: continue
+ if not success:
try:
- desc = i.div.p.string
- except: desc = ''
- addLink(name,media_url,thumb,desc)
-
-
+ embed_link = re.findall('swfobject.embedSWF\("(.+?)",',
data)[0]
+ except:
+ addon_log('NO MATCH')
+ embed_link = None
+ if embed_link:
+ if 'youtube' in embed_link:
+ addon_log('YouTube: %s' %embed_link)
+ vid_id = embed_link.split('?')[0].split('/')[-1]
+ path =
'plugin://plugin.video.youtube/?action=play_video&videoid='+vid_id
+ success = True
+ else:
+ addon_log('Not YouTube: %s' %embed_link)
+ item = xbmcgui.ListItem(path=path)
+ xbmcplugin.setResolvedUrl(int(sys.argv[1]), success, item)
+
+
def get_params():
param=[]
paramstring=sys.argv[2]
@@ -135,68 +185,68 @@ def get_params():
return param
-def addLink(name,url,iconimage,plot):
- ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels={ "Title": name,"Plot":plot})
- liz.setProperty('mimetype', 'video')
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
- return ok
+def get_length_in_minutes(length):
+ l_split = length.split(':')
+ minutes = int(l_split[-2])
+ if int(l_split[-1]) >= 30:
+ minutes += 1
+ if len(l_split) == 3:
+ minutes += (int(l_split[0]) * 60)
+ if minutes < 1:
+ minutes = 1
+ return minutes
-def addPlayableLink(name,url,plot,duration,iconimage,mode):
-
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
- ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels={ "Title": name, "Plot": plot,
"Duration": duration })
- liz.setProperty('IsPlayable', 'true')
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz)
- return ok
-
-def addDir(name,url,mode,iconimage,desc=''):
+def addDir(name, url, iconimage, fanart, mode, duration='', description='',
isplayable=False):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png",
thumbnailImage=iconimage)
- liz.setInfo( type="Video", infoLabels={ "Title": name, "Plot": desc } )
-
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
+ isfolder = True
+ if isplayable:
+ if ':' in duration:
+ duration = get_length_in_minutes(duration)
+ liz.setInfo(type="Video", infoLabels={ "Title": name, "Plot":
description, "Duration": duration })
+ liz.setProperty('IsPlayable', 'true')
+ isfolder = False
+ else:
+ liz.setInfo(type="Video", infoLabels={ "Title": name, "Plot":
description })
+ liz.setProperty("Fanart_Image", fanart)
+
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isfolder)
return ok
-
-
+
+
params=get_params()
url=None
name=None
mode=None
try:
- url=urllib.unquote_plus(params["url"])
+ url=urllib.unquote_plus(params["url"])
except:
- pass
+ pass
try:
- name=urllib.unquote_plus(params["name"])
+ name=urllib.unquote_plus(params["name"])
except:
- pass
+ pass
try:
- mode=int(params["mode"])
+ mode=int(params["mode"])
except:
- pass
+ pass
-print "Mode: "+str(mode)
-print "URL: "+str(url)
-print "Name: "+str(name)
+addon_log("Mode: "+str(mode))
+addon_log("URL: "+str(url))
+addon_log("Name: "+str(name))
if mode==None:
get_shows()
-
+
elif mode==1:
index_show(url, name)
-
+
elif mode==2:
resolve_url(url)
-
+
elif mode==4:
- podcasts()
-
-elif mode==5:
- index_podcasts(url)
-
+ get_latest_episodes()
+
xbmcplugin.endOfDirectory(int(sys.argv[1]))
diff --git a/plugin.video.earth.touch/icon.png
b/plugin.video.earth.touch/icon.png
index eea8fb7..d934c7e 100644
Binary files a/plugin.video.earth.touch/icon.png and
b/plugin.video.earth.touch/icon.png differ
diff --git a/plugin.video.earth.touch/resources/language/English/strings.xml
b/plugin.video.earth.touch/resources/language/English/strings.xml
index 1174025..52b90bc 100644
--- a/plugin.video.earth.touch/resources/language/English/strings.xml
+++ b/plugin.video.earth.touch/resources/language/English/strings.xml
@@ -1,16 +1,9 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
- <string id="30000">Featured stories with field commentary</string>
- <string id="30001">Featured stories - Ambient</string>
- <string id="30002">Wildlife Highlights</string>
- <string id="30003">Marine Channel</string>
- <string id="30004">Moremi Lions Channel</string>
- <string id="30005">Kids Channel</string>
- <string id="30006"></string>
- <string id="30007"></string>
- <string id="30008"></string>
- <string id="30009"></string>
- <string id="30010">Select Video Quality</string>
- <string id="30011">HD 720p</string>
- <string id="30012">SD</string>
+ <string id="30000">Enable add-on debugging.</string>
+ <string id="30001">Latest Episodes</string>
+ <string id="30002"></string>
+ <string id="30003"></string>
+ <string id="30004"></string>
+ <string id="30005"></string>
</strings>
\ No newline at end of file
diff --git a/plugin.video.earth.touch/resources/settings.xml
b/plugin.video.earth.touch/resources/settings.xml
index 4ce098a..a614924 100644
--- a/plugin.video.earth.touch/resources/settings.xml
+++ b/plugin.video.earth.touch/resources/settings.xml
@@ -1,3 +1,3 @@
-<settings>
- <setting id="video_quality" type="select" lvalues="30011|30012"
label="30010" default=""/>
-</settings>
+<settings>
+ <setting id="debug" type="bool" label="30000" default="false"/>
+</settings>
-----------------------------------------------------------------------
Summary of changes:
plugin.video.earth.touch/addon.xml | 7 +-
plugin.video.earth.touch/changelog.txt | 2 +
plugin.video.earth.touch/default.py | 272 +++++++++++--------
plugin.video.earth.touch/icon.png | Bin 9006 -> 21982 bytes
.../resources/language/English/strings.xml | 21 +-
.../resources/podcasts_icon.png | Bin 125826 -> 0 bytes
plugin.video.earth.touch/resources/settings.xml | 6 +-
.../resources/storageserverdummy.py | 26 --
plugin.video.earth.touch/resources/xbmcvfsdummy.py | 18 --
plugin.video.nolife/addon.xml | 6 +-
plugin.video.nolife/default.py | 294 ++++++++++++--------
plugin.video.nolife/fanart.jpg | Bin 0 -> 1233277 bytes
.../resources/images/Actualit%C3%A9s.jpeg | Bin 0 -> 67053 bytes
.../resources/images/Culture+%26+Style.jpeg | Bin 0 -> 39977 bytes
plugin.video.nolife/resources/images/Fictions.jpeg | Bin 0 -> 18877 bytes
plugin.video.nolife/resources/images/Japon.jpeg | Bin 0 -> 31601 bytes
.../resources/images/Jeu+vid%C3%A9o.jpeg | Bin 0 -> 40208 bytes
plugin.video.nolife/resources/images/Musique.jpeg | Bin 0 -> 32427 bytes
plugin.video.nolife/resources/images/Nolife.jpeg | Bin 0 -> 10500 bytes
.../S%C3%A9lection+pour+d%C3%A9couvrir+Nolife.jpeg | Bin 0 -> 10704 bytes
.../images/http%3A%2F%2Fmobile.nolife-tv.com.jpeg | Bin 0 -> 10500 bytes
.../resources/language/english/strings.xml | 16 +
.../resources/language/french/strings.xml | 16 +
plugin.video.nolife/resources/settings.xml | 6 +-
24 files changed, 399 insertions(+), 291 deletions(-)
create mode 100644 plugin.video.earth.touch/changelog.txt
delete mode 100644 plugin.video.earth.touch/resources/__init__.py
delete mode 100644 plugin.video.earth.touch/resources/podcasts_icon.png
delete mode 100644 plugin.video.earth.touch/resources/storageserverdummy.py
delete mode 100644 plugin.video.earth.touch/resources/xbmcvfsdummy.py
create mode 100644 plugin.video.nolife/fanart.jpg
create mode 100644 plugin.video.nolife/resources/images/Actualit%C3%A9s.jpeg
create mode 100644 plugin.video.nolife/resources/images/Culture+%26+Style.jpeg
create mode 100644 plugin.video.nolife/resources/images/Fictions.jpeg
create mode 100644 plugin.video.nolife/resources/images/Japon.jpeg
create mode 100644 plugin.video.nolife/resources/images/Jeu+vid%C3%A9o.jpeg
create mode 100644 plugin.video.nolife/resources/images/Musique.jpeg
create mode 100644 plugin.video.nolife/resources/images/Nolife.jpeg
create mode 100644
plugin.video.nolife/resources/images/S%C3%A9lection+pour+d%C3%A9couvrir+Nolife.jpeg
create mode 100644
plugin.video.nolife/resources/images/http%3A%2F%2Fmobile.nolife-tv.com.jpeg
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons