@@ 26,9 26,22 @@ from typing import Optional
from os import system
import socket
-RESOLUTIONS=[(1280, 720), (1366, 768), (1920, 1080)]
+# 1080p
+#RESOLUTIONS=[(1280, 720), (1366, 768), (1920, 1080)]
+
+# 720p
+#RESOLUTIONS=[(1280, 720), (1366, 768)]
+
+# 576p
+#RESOLUTIONS=[(1024, 576), (1366, 768)]
+
+# cursed
#RESOLUTIONS=[(710, 480), (1136, 768)]
+# dvd
+#RESOLUTIONS=[(720, 480), (1152, 768)]
+
+
argv0 = 'reenc.py'
def usage():
@@ 114,14 127,14 @@ def find_sXXeXX(name):
if (m := re.search('S([0-9]+)', name, re.I)) is not None:
season = int(m.group(1))
name = name[:m.start()] + name[m.end():]
- elif (m := re.search('Season ([0-9]+)', name, re.I)) is not None:
+ elif (m := re.search('Se?a?s?o?n?\\D?([0-9]+)', name, re.I)) is not None:
season = int(m.group(1))
name = name[:m.start()] + name[m.end():]
if (m := re.search('E([0-9]+)', name, re.I)) is not None:
episode = int(m.group(1))
- elif (m := re.search('Episode ([0-9]+)', name, re.I)) is not None:
+ elif (m := re.search('E\p\i\s\o\d\e\\D?([0-9]+)', name, re.I)) is not None:
episode = int(m.group(1))
elif (m := re.search('([0-9]+)', name, re.I)) is not None:
episode = int(m.group(1))
@@ 136,8 149,11 @@ def dump_metafile(path, name, files):
pfx, sfx = find_common_ends(map(lambda x: x.name, files))
for file in files:
- season, episode = find_sXXeXX(file.name)
+ sxxexxchunk = file.name[:len(pfx)] + file.name[-len(sfx):]
+ season, episode = find_sXXeXX(sxxexxchunk)
title = file.name[len(pfx):-len(sfx)]
+ if ' ' not in file.name:
+ title = title.replace('.', ' ').replace('_', ' ')
print(f'file: {str(file)}', file=fp)
print(f'season: {season}', file=fp)