This commit is contained in:
2025-10-01 16:06:53 +02:00
commit 93c6b1c261
12 changed files with 874 additions and 0 deletions

50
Start.py Normal file
View File

@@ -0,0 +1,50 @@
import os
import re
from utils.encodeCDN import EncodeCDN
from utils.encodeDDL import EncodeDDL
from utils.interpolate import Interpolate
from utils.interpolate4k import Interpolate4K
from utils.upcale import upscale
from utils.mediainfo import get_aspect_ratio
INTERPOLATE_4K = False
MAX_INPUT_WIDTH = '720'
def create_folder(folder_path):
if not os.path.exists(folder_path):
os.makedirs(folder_path)
for filename in os.listdir('0-Source'):
input_file = os.path.join('0-Source', filename)
if not os.path.isfile(input_file):
continue
# Parse File Name
temp_name = re.sub(r'\[.*?\]|\(.*?\)', "", filename).rsplit('.', 1)[0].strip()
folder_name = re.sub(r'[^A-Za-z ]+', '', temp_name).strip()
episode_number = re.findall(r'\d+', temp_name)[-1]
cdn_folder_name = folder_name.replace(" ", ".")
cdn_folder = os.path.join('2-Out', folder_name, cdn_folder_name, 'E' + episode_number)
muxed_folder = os.path.join('2-Out', folder_name, 'Muxed')
upscale_output_folder = os.path.join('2-Out', folder_name, folder_name + ' [2160p]')
upscale_output = os.path.join(upscale_output_folder, temp_name + ' [4k][HEVC].mkv')
interpolate_output = os.path.join(upscale_output_folder, temp_name + ' [1080p][48fps][HEVC].mkv')
interpolate_4k_output = os.path.join(upscale_output_folder, temp_name + ' [2160p][48fps][HEVC].mkv')
print('Parsed Name: ' + temp_name)
create_folder(cdn_folder)
create_folder(muxed_folder)
create_folder(upscale_output_folder)
aspect_ratio = get_aspect_ratio(input_file)
upscale(input_file, upscale_output, MAX_INPUT_WIDTH, aspect_ratio)
Interpolate(interpolate_output, upscale_output, temp_name, aspect_ratio)
Interpolate4K(interpolate_4k_output, upscale_output, INTERPOLATE_4K, temp_name)
EncodeDDL(input_file, cdn_folder, folder_name, temp_name, upscale_output, aspect_ratio, interpolate_output, INTERPOLATE_4K, interpolate_4k_output)
EncodeCDN(input_file, cdn_folder, aspect_ratio, upscale_output, interpolate_output, INTERPOLATE_4K, interpolate_4k_output)