The branch, frodo has been updated
       via  565f0369a42f5f6978b4864aa6a8d6fef115de3c (commit)
       via  cdf06c2a9822dfa70f8036ec615ff5546907426e (commit)
       via  7c67767154ebb7a64d272329fad539c6f042fac6 (commit)
      from  6a5170508d3904824031f54f5f57855152315e12 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=565f0369a42f5f6978b4864aa6a8d6fef115de3c

commit 565f0369a42f5f6978b4864aa6a8d6fef115de3c
Author: beenje <[email protected]>
Date:   Wed May 22 22:30:05 2013 +0200

    [plugin.video.circuitboard] updated to version 0.0.4

diff --git a/plugin.video.circuitboard/addon.xml 
b/plugin.video.circuitboard/addon.xml
index c177839..4083d63 100755
--- a/plugin.video.circuitboard/addon.xml
+++ b/plugin.video.circuitboard/addon.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.circuitboard" name="Circuit Board TV" version="0.0.2" 
provider-name="dethfeet">
+<addon id="plugin.video.circuitboard" name="Circuit Board TV" version="0.0.4" 
provider-name="dethfeet">
   <requires>
-    <import addon="xbmc.python" version="2.0"/>
-    <import addon="plugin.video.youtube" version="2.9.1"/>
-    <import addon="plugin.video.bliptv" version="0.4.0"/>
-    <import addon="script.module.urlresolver" version="0.0.1"/>
+    <import addon="xbmc.python" version="2.1.0"/>
+    <import addon="plugin.video.bliptv" version="1.8.3"/>
+    <import addon="plugin.video.youtube" version="4.4.4"/>
+    <import addon="script.module.urlresolver" version="1.0.9"/>
   </requires>
   <extension point="xbmc.python.pluginsource" library="default.py">
     <provides>video</provides>
@@ -12,8 +12,11 @@
   <extension point="xbmc.addon.metadata">
                <language>de</language>
        <summary>circuit-board.de</summary>
-       <description>Circuit Board TV: 15 Minutes of Game, Der Retro 
Brettspiel-Check, Floppy Fans, Kraut &amp; Rüben, Longplays, PIXELKITSCH, 
PixelSpieler, Retro Snippets, Sprites, Shapes &amp; Co
-       </description>
-    <platform>all</platform>
+       <description>Circuit Board TV: 15 Minutes of Game, Der Retro 
Brettspiel-Check, Floppy Fans, Kraut &amp; Rüben, Longplays, PIXELKITSCH, 
PixelSpieler, Retro Snippets, Sprites, Shapes &amp; Co</description>
+       <platform>all</platform>
+       
<forum>http://www.xbmcnerds.com/index.php?page=Thread&amp;threadID=13544</forum>
+               
<website>https://github.com/dethfeet/plugin.video.circuitboard</website>
+               
<source>https://github.com/dethfeet/plugin.video.circuitboard</source>
+               <email>[email protected]</email>
   </extension>
 </addon>
diff --git a/plugin.video.circuitboard/changelog.txt 
b/plugin.video.circuitboard/changelog.txt
index 8038511..c5da9c7 100755
--- a/plugin.video.circuitboard/changelog.txt
+++ b/plugin.video.circuitboard/changelog.txt
@@ -1,2 +1,5 @@
+0.0.4 - Resize logo
+0.0.3 - Fix category browsing
+               Localize strings
 0.0.2 - Add "Neuste Videos"
 0.0.1 - Initial release
diff --git a/plugin.video.circuitboard/default.py 
b/plugin.video.circuitboard/default.py
index 5c30bf9..2f6c1c7 100755
--- a/plugin.video.circuitboard/default.py
+++ b/plugin.video.circuitboard/default.py
@@ -9,24 +9,26 @@ import urlparse
 import showEpisode
 
 thisPlugin = int(sys.argv[1])
+addon = xbmcaddon.Addon(id='plugin.video.circuitboard')
+
 baseLink = "http://cbtv.circuit-board.de/";
 newEpisodes = "http://cbtv.circuit-board.de/?feed=rss";
 
-_regex_extractShows = re.compile("<li class=\"page_item page-item-.*?\"><a 
href=\"("+baseLink+"\?page_id=.*?)\" title=\".*?\"><img 
src=\"("+baseLink+"wp-content/uploads/icons/.*?)\" class=\"page_icon\" 
alt=\".*?\">(.*?)</a></li>");
+_regex_extractShows = re.compile("<li class=\"page_item page-item-.*?\"><a 
href=\"("+baseLink+"\?page_id=.*?)\"><img 
src=\"("+baseLink+"wp-content/uploads/icon[s]*/.*?)\" class=\"page_icon\" 
alt=\".*?\">(.*?)</a></li>");
 _regex_extractEpisodes = re.compile("<li><span class=\"class1\"><a 
href=\"("+baseLink+"\?p=.*?)\">(.*?)</a></span></li>")
-_regex_extractNew = re.compile("<item>[ \r\n\t]*<title>(.*?)</title>[ 
\r\n\t]*<description><!\[CDATA\[(.*?)\]\]></description>[ 
\r\n\t]*<link>("+baseLink+"\?p=[0-9]*)</link>[ \r\n\t]*</item>")
+_regex_extractNew = re.compile("<item>[ \r\n\t]*<title>(.*?)</title>[ 
\r\n\t]*<link>("+baseLink+"\?p=[0-9]*)</link>.*?<description><!\[CDATA\[(.*?)\]\]></description>.*?</item>",re.DOTALL)
 
 def mainPage():
     page = load_page(baseLink)
     
-    addDirectoryItem("Neuste Folgen", {"action" : "new", "link": newEpisodes})
+    addDirectoryItem(addon.getLocalizedString(30000), {"action" : "new", 
"link": newEpisodes})
     
     
     for show in _regex_extractShows.finditer(page):
         menu_link = show.group(1)
         pic = show.group(2)
         menu_name = remove_html_special_chars(show.group(3))
-        addDirectoryItem(menu_name, {"action" : "show", "link": menu_link})
+        addDirectoryItem(menu_name, {"action" : "show", "link": menu_link}, 
pic)
     xbmcplugin.endOfDirectory(thisPlugin)
 
 def showPage(link):
@@ -36,7 +38,7 @@ def showPage(link):
         episode_link = episode.group(1)
         episode_title = remove_html_special_chars(episode.group(2))
         
-        addDirectoryItem(episode_title, {"action" : "episode", "link": 
episode_link}, None, False)
+        addDirectoryItem(episode_title, {"action" : "episode", "link": 
episode_link}, "", False)
     xbmcplugin.endOfDirectory(thisPlugin)
     
 
@@ -44,10 +46,10 @@ def showNew(link):
     page = load_page(urllib.unquote(link))
     
     for episode in _regex_extractNew.finditer(page):
-        episode_link = episode.group(3)
+        episode_link = episode.group(2)
         episode_title = remove_html_special_chars(episode.group(1))
         
-        addDirectoryItem(episode_title, {"action" : "episode", "link": 
episode_link}, None, False)
+        addDirectoryItem(episode_title, {"action" : "episode", "link": 
episode_link}, "", False)
     xbmcplugin.endOfDirectory(thisPlugin)
     
 def playEpisode(link):
diff --git a/plugin.video.circuitboard/icon.png 
b/plugin.video.circuitboard/icon.png
index 4152bd7..fd91139 100644
Binary files a/plugin.video.circuitboard/icon.png and 
b/plugin.video.circuitboard/icon.png differ
diff --git a/plugin.video.circuitboard/showEpisode.py 
b/plugin.video.circuitboard/showEpisode.py
index ae5f65d..4da108c 100644
--- a/plugin.video.circuitboard/showEpisode.py
+++ b/plugin.video.circuitboard/showEpisode.py
@@ -33,6 +33,7 @@ def showEpisode(episode_page):
 def showEpisodeBip(videoItem):
     _regex_extractVideoFeedURL = re.compile("file=(.*?)&", re.DOTALL);
     _regex_extractVideoFeedURL2 = re.compile("file=(.*)", re.DOTALL);
+    _regex_extractVideoFeedURL3 = re.compile("data-episode-id=\"(.*?)\"", 
re.DOTALL);
 
     videoLink = videoItem.group(1)
     
@@ -44,9 +45,13 @@ def showEpisodeBip(videoItem):
     feedURL = _regex_extractVideoFeedURL.search(fullURL)
     if feedURL is None:
         feedURL = _regex_extractVideoFeedURL2.search(fullURL)
-    feedURL = urllib.unquote(feedURL.group(1))
     
-    blipId = feedURL[feedURL.rfind("/") + 1:]
+    if feedURL is None:
+        page = showEpisodeLoadPage(videoLink) 
+        blipId = _regex_extractVideoFeedURL3.search(page).group(1)
+    else:#This still needed for older links
+        feedURL = urllib.unquote(feedURL.group(1))
+        blipId = feedURL[feedURL.rfind("/") + 1:]
     
     stream_url = "plugin://plugin.video.bliptv/?action=play_video&videoid=" + 
blipId
     item = xbmcgui.ListItem(path=stream_url)

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=cdf06c2a9822dfa70f8036ec615ff5546907426e

commit cdf06c2a9822dfa70f8036ec615ff5546907426e
Author: beenje <[email protected]>
Date:   Wed May 22 22:30:00 2013 +0200

    [plugin.program.isybrowse] updated to version 0.2.1

diff --git a/plugin.program.isybrowse/addon.xml 
b/plugin.program.isybrowse/addon.xml
index 818f6d8..82214e9 100644
--- a/plugin.program.isybrowse/addon.xml
+++ b/plugin.program.isybrowse/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.program.isybrowse" name="ISY Browser" version="0.2.0" 
provider-name="Humble Robot">
+<addon id="plugin.program.isybrowse" name="ISY Browser" version="0.2.1" 
provider-name="Humble Robot">
     <requires>
         <import addon="xbmc.python" version="2.1.0"/>
     </requires>
diff --git a/plugin.program.isybrowse/changelog.txt 
b/plugin.program.isybrowse/changelog.txt
index 256bf60..03f35c9 100644
--- a/plugin.program.isybrowse/changelog.txt
+++ b/plugin.program.isybrowse/changelog.txt
@@ -1,3 +1,4 @@
+0.2.1 - Implemented fix for Issue 2 to fix crashing when browsing nodes that 
some users experienced
 0.2.0 - Fixed crash while showing program information (Issue 1), Fixed 
instabilities while toggling nodes (Issue 3)
 0.1.1 - Fixed bug regarding missing strings
 0.1.0 - First Release to XBMC Repository
diff --git a/plugin.program.isybrowse/resources/lib/menus.py 
b/plugin.program.isybrowse/resources/lib/menus.py
index 2a43c85..06342ad 100644
--- a/plugin.program.isybrowse/resources/lib/menus.py
+++ b/plugin.program.isybrowse/resources/lib/menus.py
@@ -124,7 +124,10 @@ class main(object):
             action = None
             if type == 'node':
                 action = 'toggle'
-                status = max([0, float(nodes[name][2])]) / 255.0 * 100
+                try:
+                    status = max([0, float(nodes[name][2])]) / 255.0 * 100
+                except ValueError:
+                    status = 0
                 if status == 0:
                     image += '_0'
                 elif status < 20:
@@ -287,9 +290,9 @@ def createContext(onoff=False, toggle=False, dim=False, 
run=False, program=False
         for item in new_items:
             menu.append(item)
     
-       if program:
-               menu.append((shared.translate(32012), 'pinfo'))
-       else:
-               menu.append((shared.translate(32012), 'info'))
+    if program:
+        menu.append((shared.translate(32012), 'pinfo'))
+    else:
+        menu.append((shared.translate(32012), 'info'))
        
     return menu
\ No newline at end of file

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=7c67767154ebb7a64d272329fad539c6f042fac6

commit 7c67767154ebb7a64d272329fad539c6f042fac6
Author: beenje <[email protected]>
Date:   Wed May 22 22:29:52 2013 +0200

    [plugin.video.twitch] updated to version 1.0.0

diff --git a/plugin.video.twitch/addon.xml b/plugin.video.twitch/addon.xml
index cf018bb..d909d96 100644
--- a/plugin.video.twitch/addon.xml
+++ b/plugin.video.twitch/addon.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<addon id='plugin.video.twitch' version='0.2.6' name='TwitchTV' 
provider-name='StateOfTheArt'>
+<addon id='plugin.video.twitch' version='1.0.0' name='TwitchTV' 
provider-name='StateOfTheArt'>
   <requires>
     <import addon='xbmc.python' version='2.1.0'/>
     <import addon='script.module.simplejson' version='2.0.10'/>
diff --git a/plugin.video.twitch/changelog.txt 
b/plugin.video.twitch/changelog.txt
index 315b815..6c97b4a 100644
--- a/plugin.video.twitch/changelog.txt
+++ b/plugin.video.twitch/changelog.txt
@@ -37,4 +37,10 @@
 - changed getting live favorite channels from on single .json query 
(user/favorite with live=true variable set)
 - channel listing in format "[channel_name] channel_status_text"
 0.2.6
-- bug fix: crashes or wrong error messages, when opening streams
\ No newline at end of file
+- bug fix: crashes or wrong error messages, when opening streams
+1.0.0
+- thx to ccaspers
+- major code refactoring
+- extracted twitch api
+- new search function
+- changed code style to match pep8 requirements
\ No newline at end of file
diff --git a/plugin.video.twitch/default.py b/plugin.video.twitch/default.py
index 506021f..69d7352 100644
--- a/plugin.video.twitch/default.py
+++ b/plugin.video.twitch/default.py
@@ -1,324 +1,187 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-import xbmcplugin
-import xbmcgui
+from converter import JsonListItemConverter 
+from functools import wraps
+from twitch import TwitchTV, TwitchVideoResolver, Keys, TwitchException
+from xbmcswift2 import Plugin #@UnresolvedImport
 import sys
-import urllib2
-import urllib
-import re
-import xbmcaddon
-import os
-import socket
-try:
-    import json
-except:
-    import simplejson as json
-from xbmcswift2 import Plugin
-
-settings = xbmcaddon.Addon(id='plugin.video.twitch')
-httpHeaderUserAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) 
Gecko/20100101 Firefox/6.0'
-translation = settings.getLocalizedString
-ITEMS_PER_SITE = 20
-plugin = Plugin()
-
-
-def downloadWebData(url):
-    try:
-        req = urllib2.Request(url)
-        req.add_header('User-Agent', httpHeaderUserAgent)
-        response = urllib2.urlopen(req)
-        data = response.read()
-        response.close()
-        return data
-    except urllib2.HTTPError, e:
-        # HTTP errors usualy contain error information in JSON Format
-        return e.fp.read()
-    except urllib2.URLError, e:
-        showNotification(translation(32001), translation(32010))
-
-def showNotification(caption, text):
-     xbmc.executebuiltin("XBMC.Notification(" + caption + "," + text + ")")
-
-
-def getJsonFromTwitchApi(url):
-    jsonString = downloadWebData(url)
-    if jsonString is None:
-        return None
-    try:
-        jsonData = json.loads(jsonString)
-    except:
-        showNotification(translation(32008), translation(32008))
-        return None
-    if type(jsonData) is dict and 'error' in jsonData.keys():
-        showNotification(translation(32007),jsonData['error'])
-        return None
-    return jsonData
-
-def getTitle(streamer, title, viewers):
-        titleDisplay = settings.getSetting('titledisplay')
-        if streamer is None:
-            streamer = '-'
-        if title is None:
-            title = 'no title'
-        if viewers is None:
-            viewers = '0'    
-
-        streamTitle = streamer + ' - ' + title
-        if titleDisplay == '0':
-            #Streamer - Stream Title
-            streamTitle = streamer + ' - ' + title
-        elif titleDisplay == '1':
-            #Viewers - Streamer - Stream Title
-            streamTitle = str(viewers) + ' - ' + streamer + ' - ' + title
-        elif titleDisplay == '2':
-            #Stream Title
-            streamTitle = title
-        elif titleDisplay == '3':
-            #Streamer
-            streamTitle = streamer
-        return streamTitle
-
-
[email protected]('/')
+
+ITEMS_PER_PAGE = 20
+LINE_LENGTH = 60
+
+PLUGIN = Plugin()
+CONVERTER = JsonListItemConverter(PLUGIN, LINE_LENGTH)
+TWITCHTV = TwitchTV()
+
+
+def managedTwitchExceptions(func):
+    @wraps(func)
+    def wrapper(*args,**kwargs):
+        try:
+            return func(*args, **kwargs)
+        except TwitchException as error:
+            handleTwitchException(error)
+    return wrapper
+
+
+def handleTwitchException(exception):
+    codeTranslations = {TwitchException.NO_STREAM_URL   : 32004,
+                        TwitchException.STREAM_OFFLINE  : 32002,
+                        TwitchException.HTTP_ERROR      : 32001,
+                        TwitchException.JSON_ERROR      : 32008 }
+    code = exception.code
+    title = 31000
+    msg = codeTranslations[code]
+    PLUGIN.notify(PLUGIN.get_string(title), PLUGIN.get_string(msg))
+
+
[email protected]('/')
 def createMainListing():
     items = [
-        {'label': translation(30005), 'path': plugin.url_for(
-            endpoint='createListOfFeaturedStreams'
-        )},
-        {'label': translation(30001), 'path': plugin.url_for(
-            endpoint='createListOfGames', sindex='0'
-        )},
-        {'label': translation(30002), 'path': plugin.url_for(
-            endpoint='createFollowingList'
-        )},
-        {'label': translation(30006), 'path': plugin.url_for(
-            endpoint='createListOfTeams', sindex='0'
-        )},
-        {'label': translation(30003), 'path': plugin.url_for(
-            endpoint='search'
-        )},
-        {'label': translation(30004), 'path': plugin.url_for(
-            endpoint='showSettings'
-        )}
+        {
+         'label': PLUGIN.get_string(30005),
+         'path': PLUGIN.url_for(endpoint = 'createListOfFeaturedStreams')
+         },
+        {
+         'label': PLUGIN.get_string(30001),
+         'path': PLUGIN.url_for(endpoint = 'createListOfGames', index = '0')
+         },
+        {
+         'label': PLUGIN.get_string(30002),
+         'path': PLUGIN.url_for(endpoint = 'createFollowingList')
+         },
+        {
+         'label': PLUGIN.get_string(30006),
+         'path': PLUGIN.url_for(endpoint = 'createListOfTeams')
+         },
+        {
+         'label': PLUGIN.get_string(30003),
+         'path': PLUGIN.url_for(endpoint = 'search')
+         },
+        {
+         'label': PLUGIN.get_string(30004),
+         'path': PLUGIN.url_for(endpoint = 'showSettings')
+         }
     ]
     return items
 
[email protected]('/createListOfFeaturedStreams/')
+
[email protected]('/createListOfFeaturedStreams/')
+@managedTwitchExceptions
 def createListOfFeaturedStreams():
-    items = []
-    jsonData = getJsonFromTwitchApi(
-        url='https://api.twitch.tv/kraken/streams/featured')
-    if jsonData is None:
-        return
-    for x in jsonData['featured']:
-        try:
-            streamData = x['stream']
-            channelData = x['stream']['channel']
-            loginname = channelData['name']
-            title = getTitle(streamer=channelData.get('name'), 
title=channelData.get('status'), viewers=streamData.get('viewers'))
-            items.append({'label': title, 'path': 
plugin.url_for(endpoint='playLive', name=loginname),
-             'is_playable': True, 'icon' : channelData['logo']})
-        except:
-            pass
-    return items
+    streams = TWITCHTV.getFeaturedStream()
+    return 
[CONVERTER.convertChannelToListItem(element[Keys.STREAM][Keys.CHANNEL])
+            for element in streams]
 
 
[email protected]('/createListOfGames/<sindex>/')
-def createListOfGames(sindex):
-    index = int(sindex)
-    items = []
-    jsonData = 
getJsonFromTwitchApi(url='https://api.twitch.tv/kraken/games/top?limit=' + 
str(ITEMS_PER_SITE) + '&offset=' + str(index * ITEMS_PER_SITE))
-    if jsonData is None:
-        return
-    for x in jsonData['top']:
-        try:
-            name = str(x['game']['name'])
-        except:
-            continue
-        try:
-            image = x['game']['images']['super']
-        except:
-            image = ''
-        items.append({'label': name, 'path': plugin.url_for(
-            'createListForGame', gameName=name, sindex='0'), 'icon' : image})
-    if len(jsonData['top']) >= ITEMS_PER_SITE:
-        items.append({'label': translation(31001), 'path': 
plugin.url_for('createListOfGames', sindex=str(index + 1))})
[email protected]('/createListOfGames/<index>/')
+@managedTwitchExceptions
+def createListOfGames(index):
+    index, offset, limit = calculatePaginationValues(index)
+
+    games = TWITCHTV.getGames(offset, limit)
+    items = [CONVERTER.convertGameToListItem(element[Keys.GAME]) for element 
in games]
+
+    items.append(linkToNextPage('createListOfGames', index))
     return items
 
 
[email protected]('/createListForGame/<gameName>/<sindex>/')
-def createListForGame(gameName, sindex):
-    index = int(sindex)
-    items = []
-    jsonData = 
getJsonFromTwitchApi(url='https://api.twitch.tv/kraken/streams?game=' + 
urllib.quote_plus(gameName) + '&limit=' + str(ITEMS_PER_SITE) + '&offset=' + 
str(index * ITEMS_PER_SITE))
-    if jsonData is None:
-        return
-    for x in jsonData['streams']:
-        channelData = x['channel']
-        try:
-            image = channelData['logo']
-        except:
-            image = ""
-        title = getTitle(streamer=channelData.get('name'), 
title=channelData.get('status'), viewers=x.get('viewers'))
-        items.append({'label': title, 'path': 
plugin.url_for(endpoint='playLive', name=channelData['name']),
-                    'is_playable' : True, 'icon' : image})
-    if len(jsonData['streams']) >= ITEMS_PER_SITE:
-        items.append({'label': translation(31001), 'path': plugin.url_for(
-            'createListForGame', gameName=gameName, sindex=str(index + 1))})
[email protected]('/createListForGame/<gameName>/<index>/')
+@managedTwitchExceptions
+def createListForGame(gameName, index):
+    index, offset, limit = calculatePaginationValues(index)
+    items = [CONVERTER.convertChannelToListItem(item[Keys.CHANNEL])for item
+             in TWITCHTV.getGameStreams(gameName, offset, limit)]
+
+    items.append(linkToNextPage('createListForGame', index, gameName = 
gameName))
     return items
 
 
[email protected]('/createFollowingList/')
[email protected]('/createFollowingList/')
+@managedTwitchExceptions
 def createFollowingList():
-    items = []
-    username = settings.getSetting('username').lower()
-    if not username:
-        settings.openSettings()
-        username = settings.getSetting('username').lower()
-    jsonData = getJsonFromTwitchApi('http://api.justin.tv/api/user/favorites/' 
+ username + '.json?limit=100&offset=0&live=true')
-    if jsonData is None:
-        return
-    for x in jsonData:
-        loginname = x['login']
-        image = x['image_url_huge']
-        title = getTitle(streamer=x.get('login'), title=x.get('status'), 
viewers=x.get('views_count'))
-        items.append({'label': title , 'path': 
plugin.url_for(endpoint='playLive', name=loginname), 'icon' : image, 
'is_playable' : True})
-    return items    
-
[email protected]('/createListOfTeams/')
-def createListOfTeams():
-    items = []
-    jsonData = getJsonFromTwitchApi('https://api.twitch.tv/kraken/teams/')
-    if jsonData is None:
-        return
-    for x in jsonData['teams']:
-        try:
-            image = x['logo']
-        except:
-            image = ""
-        name = x['name']
-        items.append({'label': name, 'path': 
plugin.url_for(endpoint='createListOfTeamStreams', team=name), 'icon' : image})
-    return items
+    username = getUserName()
+    streams = TWITCHTV.getFollowingStreams(username)
+    return [CONVERTER.convertChannelToListItem(stream[Keys.CHANNEL]) for 
stream in streams]
 
 
[email protected]('/createListOfTeamStreams/<team>/')
-def createListOfTeamStreams(team):
-    items = []      
-    jsonData = getJsonFromTwitchApi(url='http://api.twitch.tv/api/team/' + 
urllib.quote_plus(team) + '/live_channels.json')
-    if jsonData is None:
-        return
-    for x in jsonData['channels']:
-        try:
-            image = x['channel']['image']['size600']
-        except:
-            image = ""
-        try:
-            channelData = x['channel']
-            title = getTitle(streamer=channelData.get('display_name'), 
title=channelData.get('title'), viewers=channelData.get('current_viewers'))
-            channelname = x['channel']['name']
-            items.append({'label': title, 'path': 
plugin.url_for(endpoint='playLive', name=channelname), 'is_playable' : True, 
'icon' : image})
-        except:
-            # malformed data element
-            pass
[email protected]('/search/')
+@managedTwitchExceptions
+def search():
+    query = PLUGIN.keyboard('', PLUGIN.get_string(30101))
+    if query:
+        target = PLUGIN.url_for(endpoint = 'searchresults', query = query, 
index = '0')
+    else:
+        target = PLUGIN.url_for(endpoint = 'createMainListing')
+    PLUGIN.redirect(target)
+
+
[email protected]('/searchresults/<query>/<index>/')
+@managedTwitchExceptions
+def searchresults(query, index = '0'):
+    index, offset, limit = calculatePaginationValues(index)
+    streams = TWITCHTV.searchStreams(query, offset, limit)
+    
+    items = [CONVERTER.convertChannelToListItem(stream[Keys.CHANNEL]) for 
stream in streams]
+    items.append(linkToNextPage('searchresults', index, query = query))
     return items
 
 
[email protected]('/search/')
-def search():
-    items = []
-    keyboard = xbmc.Keyboard('', translation(30101))
-    keyboard.doModal()
-    if keyboard.isConfirmed() and keyboard.getText():
-        search_string = urllib.quote_plus(keyboard.getText())
-        sdata = 
downloadWebData('http://api.swiftype.com/api/v1/public/engines/search.json?callback=jQuery1337&q='
 + search_string + '&engine_key=9NXQEpmQPwBEz43TM592&page=1&per_page=' + 
str(ITEMS_PER_SITE))
-        sdata = sdata.replace('jQuery1337', '')
-        sdata = sdata[1:len(sdata) - 1]
-        jdata = json.loads(sdata)
-        records = jdata['records']['broadcasts']
-        for x in records:
-            items.append({'label': x['title'], 'path': plugin.url_for(
-                endpoint='playLive', name=x['user']
-            ), 'is_playable' : True})
-        return items
-
[email protected]('/showSettings/')
[email protected]('/showSettings/')
 def showSettings():
     #there is probably a better way to do this
-    settings.openSettings()
-
-
-def getSwfUrl(channel_name):
-    # Helper method to grab the swf url
-    base_url = 'http://www.justin.tv/widgets/live_embed_player.swf?channel=%s' 
% channel_name
-    headers = {'User-agent': httpHeaderUserAgent,
-               'Referer': 'http://www.justin.tv/' + channel_name}
-    req = urllib2.Request(base_url, None, headers)
-    response = urllib2.urlopen(req)
-    return response.geturl()
-
-
-def getBestJtvTokenPossible(name):
-    # Helper method to find another jtv token
-    swf_url = getSwfUrl(name)
-    headers = {'User-agent': httpHeaderUserAgent,
-               'Referer': swf_url}
-    url = 'http://usher.justin.tv/find/' + name + '.json?type=any&group='
-    data = json.loads(downloadWebData(url))
-    bestVideoHeight = -1
-    bestIndex = -1
-    index = 0
-    for x in data:
-        value = x.get('token', '')
-        videoHeight = int(x['video_height'])
-        if (value != '') and (videoHeight > bestVideoHeight):
-            bestVideoHeight = x['video_height']
-            bestIndex = index
-        index = index + 1
-    if bestIndex == -1:
-        return None
-    return data[bestIndex]
-
-
[email protected]('/playLive/<name>/')
+    PLUGIN.open_settings()
+
+
[email protected]('/playLive/<name>/')
+@managedTwitchExceptions
 def playLive(name):
-    swf_url = getSwfUrl(name)
-    headers = {'User-agent': httpHeaderUserAgent,
-               'Referer': swf_url}
-    chosenQuality = settings.getSetting('video')
-    videoTypeName = 'any'
-    if chosenQuality == '0':
-        videoTypeName = 'any'
-    elif chosenQuality == '1':
-        videoTypeName = '720p'
-    elif chosenQuality == '2':
-        videoTypeName = '480p'
-    elif chosenQuality == '3':
-        videoTypeName = '360p'
-    url = 'http://usher.justin.tv/find/' + name + '.json?type=' + \
-        videoTypeName + '&private_code=null&group='
-    data = json.loads(downloadWebData(url))
-    tokenIndex = 0
-
-    try:
-        # trying to get a token in desired quality
-        token = ' jtv=' + data[tokenIndex]['token'].replace(
-            '\\', '\\5c').replace(' ', '\\20').replace('"', '\\22')
-        rtmp = data[tokenIndex]['connect'] + '/' + data[tokenIndex]['play']
-    except:
-        showNotification(translation(32005),translation(32006))
-        jtvtoken = getBestJtvTokenPossible(name)
-        if jtvtoken is None:
-            showNotification(translation(31000),translation(32004))
-            return
-        token = ' jtv=' + jtvtoken['token'].replace('\\', '\\5c').replace(' ', 
'\\20').replace('"', '\\22')
-        rtmp = jtvtoken['connect'] + '/' + jtvtoken['play']
-
-    swf = ' swfUrl=%s swfVfy=1 live=true' % swf_url
-    Pageurl = ' Pageurl=http://www.justin.tv/' + name
-    url = rtmp+token+swf+Pageurl
-    item = xbmcgui.ListItem(path=url)
-    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
+    videoQuality = getVideoQuality()
+    resolver = TwitchVideoResolver()
+    rtmpUrl = resolver.getRTMPUrl(name, videoQuality)
+    PLUGIN.set_resolved_url(rtmpUrl)
+
+
[email protected]('/createListOfTeams/')
+@managedTwitchExceptions
+def createListOfTeams():
+    items = [CONVERTER.convertTeamToListItem(item)for item in 
TWITCHTV.getTeams()]
+    return items
+
+
[email protected]('/createListOfTeamStreams/<team>/')
+@managedTwitchExceptions
+def createListOfTeamStreams(team):
+    return [CONVERTER.convertTeamChannelToListItem(channel[Keys.CHANNEL]) 
+            for channel in TWITCHTV.getTeamStreams(team)]
+
+
+def calculatePaginationValues(index):
+    index = int(index)
+    limit = ITEMS_PER_PAGE
+    offset = index * limit
+    return  index, offset, limit
+
+
+def getUserName():
+    username = PLUGIN.get_setting('username').lower()
+    if not username:
+        PLUGIN.open_settings()
+        username = PLUGIN.get_setting('username').lower()
+    return username
+
+
+def getVideoQuality():
+    chosenQuality = PLUGIN.get_setting('video')
+    qualities = {'0':sys.maxint, '1':720, '2':480, '3':360}
+    return qualities.get(chosenQuality, sys.maxint)
+
 
+def linkToNextPage(target, currentIndex, **kwargs):
+    return {
+            'label': PLUGIN.get_string(31001),
+            'path': PLUGIN.url_for(target, index = str(currentIndex+1), 
**kwargs)
+            }
 
 if __name__ == '__main__':
-    plugin.run()
+    PLUGIN.run()
diff --git a/plugin.video.twitch/resources/language/English/strings.xml 
b/plugin.video.twitch/resources/language/English/strings.xml
index 52dca61..0035ae8 100644
--- a/plugin.video.twitch/resources/language/English/strings.xml
+++ b/plugin.video.twitch/resources/language/English/strings.xml
@@ -40,4 +40,10 @@
   <string id="33014">Streamer</string>
 
   <string id="33100">Username</string>
+  
+  <!--title-->
+  <string id="34000">Unnamed Streamer</string>
+  <string id="34001">Untitled Stream</string>
+  <string id="34002">Unknown Number of Viewers</string>
+
 </strings>
diff --git a/plugin.video.twitch/resources/language/German/strings.xml 
b/plugin.video.twitch/resources/language/German/strings.xml
index efc1f79..935cd0a 100644
--- a/plugin.video.twitch/resources/language/German/strings.xml
+++ b/plugin.video.twitch/resources/language/German/strings.xml
@@ -40,4 +40,9 @@
   <string id="33014">Streamer</string>
 
   <string id="33100">Benutzername</string>
+  
+  <!--title-->
+  <string id="34000">Unbenannter Streamer</string>
+  <string id="34001">Unbenannter Stream</string>
+  <string id="34002">Unbekannte Zuschauerzahl</string>
 </strings>
diff --git a/plugin.video.twitch/resources/settings.xml 
b/plugin.video.twitch/resources/settings.xml
index 8056a0e..af9e229 100644
--- a/plugin.video.twitch/resources/settings.xml
+++ b/plugin.video.twitch/resources/settings.xml
@@ -1,13 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <settings>
-  <!-- General -->
-  <category label="General">
-    <setting id="username" type="text" label="33100" default="" />
-       <!-- Video Quality -->
-    <setting id="video" type="enum" label="33000" 
lvalues="33001|33002|33003|33004" default="0" />
-       <!-- Title Display -->
-       <setting id="titledisplay" type="enum" label="33010" 
lvalues="33011|33012|33013|33014" default="0" />
-  </category>
-  
-
+       <!-- General -->
+       <category label="General">
+               <setting id="username" type="text" label="33100" default="" />
+               <!-- Video Quality -->
+               <setting id="video" type="enum" label="33000" 
lvalues="33001|33002|33003|33004" default="0" />
+               <!-- Title Display -->
+               <setting id="titledisplay" type="enum" label="33010" 
lvalues="33011|33012|33013|33014" default="0" />
+       </category>
 </settings>
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 plugin.program.isybrowse/addon.xml                 |    2 +-
 plugin.program.isybrowse/changelog.txt             |    1 +
 plugin.program.isybrowse/resources/lib/menus.py    |   13 +-
 plugin.video.circuitboard/addon.xml                |   19 +-
 plugin.video.circuitboard/changelog.txt            |    3 +
 plugin.video.circuitboard/default.py               |   16 +-
 plugin.video.circuitboard/icon.png                 |  Bin 90353 -> 20545 bytes
 .../resources/language/English}/strings.xml        |    4 +-
 .../resources/language/German/strings.xml          |    4 +-
 plugin.video.circuitboard/showEpisode.py           |    9 +-
 plugin.video.twitch/addon.xml                      |    2 +-
 plugin.video.twitch/changelog.txt                  |    8 +-
 plugin.video.twitch/converter.py                   |  107 +++++
 plugin.video.twitch/default.py                     |  453 +++++++-------------
 .../resources/language/English/strings.xml         |    6 +
 .../resources/language/German/strings.xml          |    5 +
 plugin.video.twitch/resources/settings.xml         |   18 +-
 plugin.video.twitch/twitch.py                      |  241 +++++++++++
 18 files changed, 577 insertions(+), 334 deletions(-)
 copy {plugin.audio.vorleser_net/resources/language/German => 
plugin.video.circuitboard/resources/language/English}/strings.xml (54%)
 mode change 100644 => 100755
 copy {plugin.audio.vorleser_net => 
plugin.video.circuitboard}/resources/language/German/strings.xml (54%)
 mode change 100644 => 100755
 create mode 100644 plugin.video.twitch/converter.py
 create mode 100644 plugin.video.twitch/twitch.py


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_may
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to