The branch, frodo has been updated
via 11ed6e465f8efe6ea385234524add6b35ce8dc40 (commit)
from 2aefced116f39fc58280e44c06146604c8810d0e (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=11ed6e465f8efe6ea385234524add6b35ce8dc40
commit 11ed6e465f8efe6ea385234524add6b35ce8dc40
Author: beenje <[email protected]>
Date: Thu Apr 25 22:26:34 2013 +0200
[plugin.video.yousee.tv] updated to version 3.0.1
diff --git a/plugin.video.yousee.tv/addon.py b/plugin.video.yousee.tv/addon.py
index 869fa75..cb41f0a 100644
--- a/plugin.video.yousee.tv/addon.py
+++ b/plugin.video.yousee.tv/addon.py
@@ -59,7 +59,7 @@ class YouSeeTv(object):
xbmcplugin.endOfDirectory(HANDLE)
def showLiveTVChannels(self):
- api = ysapi.YouSeeLiveTVApi(CACHE_PATH)
+ api = ysapi.YouSeeLiveTVApi()
channels = api.allowedChannels()
if not channels:
self._showError()
@@ -84,9 +84,9 @@ class YouSeeTv(object):
xbmcplugin.endOfDirectory(HANDLE, succeeded=len(channels) > 0)
def playLiveTVChannel(self, channelId):
- api = ysapi.YouSeeLiveTVApi(CACHE_PATH)
+ api = ysapi.YouSeeLiveTVApi()
channel = api.channel(channelId)
- stream = api.streamUrl(channelId)
+ stream = api.streamUrl(channelId, 'iphone')
if not stream or not 'url' in stream or not stream['url']:
xbmcplugin.setResolvedUrl(HANDLE, False, xbmcgui.ListItem())
@@ -96,14 +96,35 @@ class YouSeeTv(object):
self._showError()
return
+ url = self.getBestStream(stream['url'])
+
thumbnailImage = os.path.join(CACHE_PATH, str(channelId) + '.png')
if not os.path.exists(thumbnailImage):
thumbnailImage = channel['logos']['large']
- item = xbmcgui.ListItem(channel['nicename'], path=stream['url'],
thumbnailImage=thumbnailImage)
+ item = xbmcgui.ListItem(channel['nicename'], path=url,
thumbnailImage=thumbnailImage)
xbmcplugin.setResolvedUrl(HANDLE, True, item)
+ def getBestStream(self, url):
+ u = urllib2.urlopen(url)
+ m3u8 = u.read()
+ u.close()
+
+ lines = m3u8.splitlines()
+ bestBitrate = 0
+ path = ''
+ for idx in range(0, len(lines)):
+ pos = lines[idx].rfind('BANDWIDTH')
+ if pos >= 0:
+ bitrate = int(lines[idx][pos + 10:])
+ if bitrate > bestBitrate:
+ bestBitrate = bitrate
+ path = lines[idx+1]
+
+ host = url[0:url.find('/', 8)]
+ return host + path
+
def showMovieGenres(self):
- api = ysapi.YouSeeMovieApi(CACHE_PATH)
+ api = ysapi.YouSeeMovieApi()
genres = api.genres()
if not genres:
self._showError()
@@ -119,7 +140,7 @@ class YouSeeTv(object):
xbmcplugin.endOfDirectory(HANDLE)
def showMoviesInGenre(self, genre):
- api = ysapi.YouSeeMovieApi(CACHE_PATH)
+ api = ysapi.YouSeeMovieApi()
moviesInGenre = api.moviesInGenre(genre)
if not moviesInGenre:
self._showError()
@@ -133,7 +154,7 @@ class YouSeeTv(object):
xbmcplugin.endOfDirectory(HANDLE)
def showMovieThemes(self):
- api = ysapi.YouSeeMovieApi(CACHE_PATH)
+ api = ysapi.YouSeeMovieApi()
themes = api.themes()
if not themes:
self._showError()
@@ -149,7 +170,7 @@ class YouSeeTv(object):
xbmcplugin.endOfDirectory(HANDLE)
def showMoviesInTheme(self, theme):
- api = ysapi.YouSeeMovieApi(CACHE_PATH)
+ api = ysapi.YouSeeMovieApi()
moviesInTheme = api.moviesInTheme(theme)
if not moviesInTheme:
self._showError()
@@ -166,7 +187,7 @@ class YouSeeTv(object):
kbd = xbmc.Keyboard('', 'Search movies')
kbd.doModal()
if kbd.isConfirmed():
- api = ysapi.YouSeeMovieApi(CACHE_PATH)
+ api = ysapi.YouSeeMovieApi()
movies = api.search(kbd.getText())
if not movies:
self._showError()
@@ -222,6 +243,7 @@ class YouSeeTv(object):
import PIL.Image
sys.modules['Image'] = PIL.Image #
http://projects.scipy.org/scipy/ticket/1374
+ iconImage = os.path.join(ADDON.getAddonInfo('path'), 'resources',
'channel_bg.png')
for channel in channels:
path = os.path.join(CACHE_PATH, str(channel['id']) + '.png')
@@ -234,7 +256,6 @@ class YouSeeTv(object):
image = PIL.Image.open(StringIO.StringIO(data))
(width, height) = image.size
- iconImage = os.path.join(ADDON.getAddonInfo('path'),
'resources', 'channel_bg.png')
out = PIL.Image.open(iconImage)
x = (256 - width) / 2
@@ -247,7 +268,7 @@ class YouSeeTv(object):
out.save(path)
def isYouSeeIP(self):
- api = ysapi.YouSeeUsersApi(CACHE_PATH)
+ api = ysapi.YouSeeUsersApi()
try:
isYouSeeIP = api.isYouSeeIP()['status'] == 1
except Exception:
@@ -263,7 +284,6 @@ class YouSeeTv(object):
if xbmcgui.Dialog().yesno(heading, line1, line2, line3, nolabel,
yeslabel):
ADDON.setSetting('warn.if.not.yousee.ip', 'false')
-
def _showWarning(self):
title = ADDON.getLocalizedString(39000)
line1 = ADDON.getLocalizedString(39001)
@@ -293,6 +313,7 @@ if __name__ == '__main__':
os.makedirs(CACHE_PATH)
ytv = YouSeeTv()
+ buggalo.SUBMIT_URL = 'http://tommy.winther.nu/exception/submit.php'
try:
if 'area' in PARAMS and PARAMS['area'][0] == 'livetv':
ytv.showLiveTVChannels()
diff --git a/plugin.video.yousee.tv/addon.xml b/plugin.video.yousee.tv/addon.xml
index 84ff59f..63faff7 100644
--- a/plugin.video.yousee.tv/addon.xml
+++ b/plugin.video.yousee.tv/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.yousee.tv" version="3.0.0" name="YouSee web-tv"
provider-name="twinther [[email protected]]">
+<addon id="plugin.video.yousee.tv" version="3.0.1" name="YouSee web-tv"
provider-name="twinther">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.buggalo" version="1.1.2"/>
@@ -18,5 +18,9 @@
<disclaimer lang="da">Nogle dele af denne addon er muligvis ikke
lovlig i dit land - kontroller venligst dine lokale love.</disclaimer>
<platform>all</platform>
<language>da</language>
+ <license>GPLv2</license>
+ <email>[email protected]</email>
+ <website>http://tommy.winther.nu</website>
+ <source>https://github.com/twinther/plugin.video.yousee.tv</source>
</extension>
</addon>
diff --git a/plugin.video.yousee.tv/changelog.txt
b/plugin.video.yousee.tv/changelog.txt
index 13d9621..f68a572 100644
--- a/plugin.video.yousee.tv/changelog.txt
+++ b/plugin.video.yousee.tv/changelog.txt
@@ -1,3 +1,6 @@
+[B]Version 3.0.1 - 2013-04-16[/B]
+- Switched to use iPhone streams to get better quality
+
[B]Version 3.0.0 - 2013-01-29[/B]
- Initial version for Frodo
diff --git a/plugin.video.yousee.tv/ysapi.py b/plugin.video.yousee.tv/ysapi.py
index 4be7729..d0d5db9 100644
--- a/plugin.video.yousee.tv/ysapi.py
+++ b/plugin.video.yousee.tv/ysapi.py
@@ -19,11 +19,9 @@
#
#
https://docs.google.com/document/d/1_rs5BXklnLqGS6g6eAjevVHsPafv4PXDCi_dAM2b7G0/edit?pli=1
#
-import cookielib
import urllib
import urllib2
import simplejson
-import os
import re
import xbmc
@@ -50,20 +48,6 @@ class YouSeeApiException(Exception):
class YouSeeApi(object):
- COOKIE_JAR = cookielib.LWPCookieJar()
- COOKIES_LWP = 'cookies.lwp'
-
- def __init__(self, dataPath):
- xbmc.log('YouSeeApi.__init__(dataPath = %s)' % dataPath, xbmc.LOGDEBUG)
- self.cookieFile = os.path.join(dataPath, self.COOKIES_LWP)
- if os.path.isfile(self.cookieFile):
- try:
- self.COOKIE_JAR.load(self.cookieFile, ignore_discard=True,
ignore_expires=True)
- except cookielib.LoadError:
- pass # ignore
-
-
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor(self.COOKIE_JAR)))
-
def _invoke(self, area, function, params=None, method=METHOD_GET):
url = API_URL + '/' + area + '/' + function
if method == METHOD_GET and params:
@@ -81,8 +65,6 @@ class YouSeeApi(object):
u = urllib2.urlopen(r)
json = u.read()
u.close()
-
- self.COOKIE_JAR.save(self.cookieFile, ignore_discard=True,
ignore_expires=True)
except urllib2.HTTPError, error:
json = error.read()
except Exception, ex:
@@ -117,7 +99,9 @@ class YouSeeLiveTVApi(YouSeeApi):
"""
Returns list of channels the requesting IP is allowed to stream.
"""
- return self._invoke(AREA_LIVETV, 'allowed_channels')
+ return self._invoke(AREA_LIVETV, 'allowed_channels', {
+ 'apiversion': 2
+ })
def suggestedChannels(self):
"""
@@ -344,7 +328,7 @@ class YouSeePlayApi(YouSeeApi):
if __name__ == '__main__':
- api = YouSeeLiveTVApi('/tmp')
+ api = YouSeeLiveTVApi()
json = api.allowedChannels()
# api = YouSeeTVGuideApi()
-----------------------------------------------------------------------
Summary of changes:
plugin.video.yousee.tv/addon.py | 45 +++++++++++++++++++++++++---------
plugin.video.yousee.tv/addon.xml | 6 ++++-
plugin.video.yousee.tv/changelog.txt | 3 ++
plugin.video.yousee.tv/ysapi.py | 24 +++---------------
4 files changed, 45 insertions(+), 33 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons