~aleteoryx/employ

d1e13f79f675c0ce6a35ffc34f700ebd10675d5a — Aleteoryx 8 days ago dfacbad
stop being lazy and breaking things
1 files changed, 12 insertions(+), 3 deletions(-)

M queuers/reenc.py
M queuers/reenc.py => queuers/reenc.py +12 -3
@@ 27,6 27,7 @@ from os import system
import socket

RESOLUTIONS=[(1280, 720), (1366, 768), (1920, 1080)]
#RESOLUTIONS=[(710, 480), (1136, 768)]

argv0 = 'reenc.py'



@@ 60,9 61,11 @@ class Episode:

	def generate_script(self, show, res):
		wid, hei = res
		outpath = self.outpath(res, show)
		inparg = shlex.quote(str(self.file))
		outarg = shlex.quote(str(self.outpath(res, show)))
		return '#!/bin/sh\n' f'mkdir -p `dirname {outarg}`\n' f'ffmpeg -loglevel quiet -i {inparg} -map 0 -c:a copy -c:s ass -c:v h264 -s {wid}x{hei} {outarg}\n'
		outarg = shlex.quote(str(outpath))
		dirarg = shlex.quote(str(outpath.parent))
		return '#!/bin/sh\n' f'mkdir -p {dirarg}\n' f'ffmpeg -loglevel quiet -i {inparg} -map 0 -c:a copy -c:s ass -c:v h264 -s {wid}x{hei} {outarg}\n'
		
	def slug(self):
		if self.season == 0:


@@ 71,7 74,7 @@ class Episode:
			return f'S{self.season:02}E{self.number:02}'

def find_common_ends(files):
	files = iter(files)
	files = map(lambda x: re.sub('\d', '#', x), files)
	needle = next(files)
	pfxlen = len(needle)
	sfxlen = len(needle)


@@ 94,8 97,11 @@ 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:
		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))


@@ 156,6 162,8 @@ def load_metafile(path):
				v = int(v.strip())
			except:
				v = v.strip()
				if v == '':
					continue
			
			data[k.strip()] = v



@@ 251,6 259,7 @@ if __name__ == '__main__':
		mkglob = lambda x: iglob(f'**/*.{x}', root_dir=dir, recursive=True)
		globs = chain(mkglob('mkv'), mkglob('mp4'), mkglob('mov'), mkglob('avi'))
		files = [*map(lambda p: dir / p, globs)]
		files.sort()

		showname = input('enter the name of this show\n% ')