The branch, eden-pre has been updated
via 89fede50bf73585d8f16e56edc893ffc00f238be (commit)
from 6c27e5cf49c81cb894d048f63badfb7c625332fe (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=89fede50bf73585d8f16e56edc893ffc00f238be
commit 89fede50bf73585d8f16e56edc893ffc00f238be
Author: spiff <[email protected]>
Date: Wed Jan 25 09:13:48 2012 +0100
[plugin.video.leafstv] updated to version 1.0.5
diff --git a/plugin.video.leafstv/LeafsTV.py b/plugin.video.leafstv/LeafsTV.py
index c9e3c51..2302555 100644
--- a/plugin.video.leafstv/LeafsTV.py
+++ b/plugin.video.leafstv/LeafsTV.py
@@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public
License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
-import urllib, urllib2, re, time, logging
+import urllib, urllib2, re, xml.dom.minidom, time, logging
class LeafsTVError(Exception):
def __init__(self, value):
@@ -217,19 +217,13 @@ class LeafsTV:
except urllib2.HTTPError, he:
logging.error("HTTP error trying to open game: %s" % he.read())
raise LeafsTVError("HTTP error trying to open game")
-
- # try to pull the program id
- match = re.search('<programId>(.*?)</programId>', resp.read())
- if match == None:
- logging.error("Unable to find programId")
- raise LeafsTVError("Unable to find programId")
-
- # ensure a valid program id exists
- try:
- program_id = match.group(1)
- except IndexError:
- logging.error("Invalid program ID")
- raise LeafsTVError("Invalid program ID")
+
+ xml = resp.read()
+ program_id = self.parseLiveGameXML(xml)
+
+ if program_id == None:
+ logging.error("ERROR: program ID is none")
+ raise LeafsTVError("Program ID is none")
# by default use the 1600 bitrate... poor, I know, but that is the best
full_id = program_id + "_1600"
@@ -241,6 +235,35 @@ class LeafsTV:
return live_game
+ def parseLiveGameXML(self, xml_string):
+ """
+ Parse the XML for a live game.
+ """
+ dom = xml.dom.minidom.parseString(xml_string.lstrip())
+ for game in dom.getElementsByTagName('game'):
+
+ # skip nodes that do not have an isLive tag
+ is_live_node = game.getElementsByTagName('isLive')
+ if is_live_node.length == 0:
+ continue
+
+ # skip any non live nodes
+ is_live = is_live_node[0].firstChild.nodeValue
+ if is_live.lower() != "true":
+ continue
+
+ # get the program id node
+ program_id_node = game.getElementsByTagName('programId')
+ if program_id_node.length == 0:
+ logging.error("ERROR: no programId tag in live game.")
+ continue
+
+ program_id = program_id_node[0].firstChild.nodeValue
+ return program_id
+
+ return None
+
+
def getEncryptedLiveGame(self, path):
values = {'isFlex' : "true",
diff --git a/plugin.video.leafstv/addon.xml b/plugin.video.leafstv/addon.xml
index 40b5ade..db4ebd3 100644
--- a/plugin.video.leafstv/addon.xml
+++ b/plugin.video.leafstv/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.leafstv" name="LeafsTV Interactive" version="1.0.4"
provider-name="Micah Galizia">
+<addon id="plugin.video.leafstv" name="LeafsTV Interactive" version="1.0.5"
provider-name="Micah Galizia">
<requires>
<import addon="xbmc.python" version="2.0"/>
</requires>
diff --git a/plugin.video.leafstv/changelog.txt
b/plugin.video.leafstv/changelog.txt
index 359a2bb..b58c07d 100644
--- a/plugin.video.leafstv/changelog.txt
+++ b/plugin.video.leafstv/changelog.txt
@@ -1,3 +1,8 @@
+[B]Version 1.0.5[/B]
+
+- Parse response from the game request as XML (instead of a regular expession).
+ This fixes responses that contain non-live and live games.
+
[B]Version 1.0.4[/B]
- fix LA Kings team abbreviation
-----------------------------------------------------------------------
Summary of changes:
plugin.video.leafstv/LeafsTV.py | 51 ++++++++++++++++++++++++++----------
plugin.video.leafstv/addon.xml | 2 +-
plugin.video.leafstv/changelog.txt | 5 +++
3 files changed, 43 insertions(+), 15 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons