FORMAT = "%%(series_name)s - [%%(season)0%(logmaxseason)sdx%%(episode)0%(logmaxepisode)sd] - %%(title)s.%%(extension)s"
-SEASONEPISODE_REGEXP = ur"^(?P<series_name>([A-Za-z0-9_-]+(\.| ))+)(S|\[)(?P<season>\d+)(E|x)(?P<episode>\d+).*\.(?P<extension>[a-z0-9]*)$"
+SEASONEPISODE_REGEXP = ur"^(?P<series_name>([A-Za-z0-9_()-]+(\.| ))+)(S|- \[?)(?P<season>\d+)(E|x)(?P<episode>\d+).*\.(?P<extension>[a-z0-9]*)$"
sep_re = re.compile(SEASONEPISODE_REGEXP)
def get_titles(filename, debug=False, oneintwo=False):
if oneintwo:
# On enlève une ligne sur deux
text = re.sub("(.*\n).*\n", r'\1', text)
- titles = re.findall('"(.*)"', text)
+ titles = re.findall('^[0-9\s]+"(.*?)"', text, flags=re.MULTILINE)
if debug:
print "Titres :"
pprint.pprint(titles)