Skip to content

Commit

Permalink
Correctly parse epguides >9 seasons more often
Browse files Browse the repository at this point in the history
  • Loading branch information
Perry Lorier committed Nov 16, 2009
1 parent 8600d1e commit a5f708f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tvrenamer2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# coding=latin1
# TV Renamer v2.10
# TV Renamer v2.11
# (C) Copyright 2007,2009 Perry Lorier
#
# Latest version can be downloaded from
Expand Down Expand Up @@ -29,6 +29,8 @@
# * support "ffn" prefix for people that like dotted names.
# 2.10 (2008-12-18)
# * Deal with epguides latin1 encodings.
# 2.11 (2009-11-17)
# * Correctly parse epguides when there are more than 9 seaons
import urllib
import sys
import re
Expand Down Expand Up @@ -143,10 +145,10 @@ def fetchpage(title):
newflag=0
i=i[:-(len("<title>")+1)]
if flag==1:
a=re.match(r'(?:.*\.?|<li>) *([0-9]+|S)- *([0-9]+).*["\']>(.*)</a>',i)
a=re.match(r'(?:.*\.?|<li>) +([0-9]+|S)- *([0-9]+).*["\']>(.*)</a>',i)
# Sometimes they aren't linked
if not a:
a=re.match(r'(?:.*\.|<li>) *([0-9]+|S)- *([0-9]+).*[0-9][0-9] (.*)',i)
a=re.match(r'(?:.*\.|<li>) +([0-9]+|S)- *([0-9]+).*[0-9][0-9] (.*)',i)
if a:
if a.groups()[0]!="S":
season=int(a.groups()[0])
Expand All @@ -156,6 +158,8 @@ def fetchpage(title):
if not data.has_key(season):
data[season]={}
data[season][ep]=unhtmlspecialchars(a.groups()[2])
if debug:
print "DEBUG: Found:",repr(season),repr(ep),repr(data[season][ep])
else:
if debug and i!="":
print "DEBUG: Unmatched line",`i`
Expand Down

0 comments on commit a5f708f

Please sign in to comment.