From c6ffc817551bd088d3cf38696dfd0457f008ffea Mon Sep 17 00:00:00 2001 From: Drew Boshardy Date: Fri, 4 Apr 2014 15:06:04 -0500 Subject: [PATCH 1/3] Added exception handling for two inconsistencies in the quickinfo data. 1. ValueError when parsing 'Ended@' making split('@') fail. See: http://services.tvrage.com/tools/quickinfo.php?show=big%20brother 2. ValueError when show name begins with '@'. See: http://services.tvrage.com/tools/quickinfo.php?show=@midnight --- tvrage/quickinfo.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tvrage/quickinfo.py b/tvrage/quickinfo.py index dca9715..263deb4 100644 --- a/tvrage/quickinfo.py +++ b/tvrage/quickinfo.py @@ -45,7 +45,16 @@ def fetch(show, exact=False, ep=None): else: data = resp.replace('
', '').splitlines()
         for line in data:
-            k, v = line.split('@')
+      ne in data:
+            try:
+                k, v = line.split('@')
+                print line
+            except ValueError, err:
+                try:
+                    k, v = line.split('@@') #Latest Episode@@blah
+                except ValueError, err: #"Ended@"
+                    k = line.replace('@',"")
+                    v = ""
             # TODO: use datetimeobj for dates
             show_info[k] = (v.split(' | ') if ' | ' in v else
                             (v.split('^') if '^' in v else v))

From 47c58977fb8b653c1a0a26616091a34bf4b6c1f1 Mon Sep 17 00:00:00 2001
From: dboshardy 
Date: Fri, 4 Apr 2014 23:32:40 -0500
Subject: [PATCH 2/3] Improperly handled the @Midnight case such that the title
 output would only be Midnight and not the proper title @Midnight.

---
 tvrage/quickinfo.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tvrage/quickinfo.py b/tvrage/quickinfo.py
index 263deb4..7f6b419 100644
--- a/tvrage/quickinfo.py
+++ b/tvrage/quickinfo.py
@@ -28,8 +28,7 @@
 from urllib2 import urlopen, URLError, quote
 from util import _fetch
 from exceptions import ShowNotFound
-
-BASE_URL = 'http://services.tvrage.com/tools/quickinfo.php'
+s/tools/quickinfo.php'
 
 
 def fetch(show, exact=False, ep=None):
@@ -47,11 +46,15 @@ def fetch(show, exact=False, ep=None):
         for line in data:
       ne in data:
             try:
-                k, v = line.split('@')
-                print line
+                if '@@' in line:
+                    line = line.replace('@@','@')
+                    k, v = line.split('@')
+                    v = '@' + v
+                else:
+                    k, v = line.split('@')
+
             except ValueError, err:
-                try:
-                    k, v = line.split('@@') #Latest Episode@@blah
+
                 except ValueError, err: #"Ended@"
                     k = line.replace('@',"")
                     v = ""

From afd3d580b22f886b55ad8133edad2e3ee13dfd89 Mon Sep 17 00:00:00 2001
From: Andrew Boshardy 
Date: Wed, 1 Apr 2015 11:01:34 -0500
Subject: [PATCH 3/3] updated base urls for api

---
 tvrage/api.py   |   6 +++---
 tvrage/feeds.py |   2 +-
 tvrage/util.pyc | Bin 0 -> 2117 bytes
 3 files changed, 4 insertions(+), 4 deletions(-)
 create mode 100644 tvrage/util.pyc

diff --git a/tvrage/api.py b/tvrage/api.py
index 0e504a9..0a19215 100644
--- a/tvrage/api.py
+++ b/tvrage/api.py
@@ -115,8 +115,8 @@ class Show(object):
     """represents a TV show description from tvrage.com
 
     this class is kind of a wrapper around the following of tvrage's xml feeds:
-    * http://www.tvrage.com/feeds/search.php?show=SHOWNAME
-    * http://www.tvrage.com/feeds/episode_list.php?sid=SHOWID
+    * http://services.tvrage.com/feeds/search.php?show=SHOWNAME
+    * http://services.tvrage.com/feeds/episode_list.php?sid=SHOWID
     """
 
     def __init__(self, name):
@@ -158,7 +158,7 @@ def __init__(self, name):
                 snum = int(season.attrib['no'])
             except KeyError:
                 pass  # TODO: adding handeling for specials and movies
-                # bsp: http://www.tvrage.com/feeds/episode_list.php?sid=3519
+                # bsp: http://services.tvrage.com/feeds/episode_list.php?sid=3519
             else:
                 self.episodes[snum] = Season()
                 for episode in season:
diff --git a/tvrage/feeds.py b/tvrage/feeds.py
index c144533..d5a8e25 100644
--- a/tvrage/feeds.py
+++ b/tvrage/feeds.py
@@ -34,7 +34,7 @@
     import xml.etree.ElementTree as et
 
 
-BASE_URL = 'http://www.tvrage.com/feeds/%s.php?%s=%s'
+BASE_URL = 'http://services.tvrage.com/feeds/%s.php?%s=%s'
 
 
 def _fetch_xml(url, node=None):
diff --git a/tvrage/util.pyc b/tvrage/util.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..53973d3159ef71eb51cb355e69b617366351a948
GIT binary patch
literal 2117
zcmb_dUvJ|?5TCW1~
z#s4Q5=4XfmKSdeQRMA+`)S(EHl5VjsHjW34$HxD6+O`6wuqhG_b`kPp>Z@qf^;|ujKt-*
zS!q!)8gQn}O$dK4GTM)`$QXZ8RDN6=TTFfZB-W)(i`>MFay~xeWsK=W(Fsu~Ssn@0
zVFQ>qo|*?uY%O-z*(6|PfYAseG21k|Rn8>lFii8*hT&`M&u5W}IiC5DV|fwIJR;2#us_k@Ldkt#CSfC%*+Sp5oPr7liNb>|7Ng*ZuA)La9+^oa;zx^baVrEwWOnXNpc09p=AM
z%PM-*qv{t@r`&^Zc^o=&=#fL!ZL%)e7F)0YzwZ@2{+%!D(&vb*cae{~;`0O9_60sD
z;eTzOZv#(9@ch=`xxmMxd${7GgfANx%P{>BwV3|I;xCAS)Eg!!;2OmdL~)VmfJ+Pk
zfk#^f%xS=BlY3!#&HlWxNcP1O-4D=-DsAe_B2~Bs%PL;IUg8!`w2dFW4=?iy1SwZ-
zsps*%J|7NieMdT%+(UQ?J>X@98;555l0bAy{2WRl(I#8;-kDOM=M?!>RNbW$mySdS
zJ>QD`v_&~cc4>5&-#|WFlFtJ9^uVu2Cm!`bzmqGvCn;nULkTuXkHIBTWNl@ny_<){
zccGc(MQKtabJC5?HoVHHGP;?ZrN)2Df973qYm(;4VEY6AbtA1T;MOTr@PsH
zDYMjCZZV(Y