Compare commits
5 Commits
055eb7b04d
...
master
Author | SHA1 | Date | |
---|---|---|---|
b5b2f580fa | |||
13c7bde679 | |||
5790b9134e | |||
a7bc9c6257 | |||
7306e018a6 |
3
.env.sample
Normal file → Executable file
3
.env.sample
Normal file → Executable file
@@ -8,7 +8,8 @@ TRANSFER_DESTINATION_FOLDER="../transcoder/raw"
|
||||
HANDBRAKE_PROCESS_NICE_LEVEL=10
|
||||
HANDBRAKE_PRESET_MOVIE="General/HQ 1080p30 Surround"
|
||||
HANDBRAKE_PRESET_SERIES="General/HQ 1080p30 Surround"
|
||||
HANDBRAKE_AUDIO_LANG_LIST="de,en"
|
||||
HANDBRAKE_AUDIO_LANG_LIST="de,en" # Leave empty to get all audio tracks
|
||||
OUT_VIDEO_FORMAT=".mkv"
|
||||
MIN_EPISODES_DURATION_MINUTES=30
|
||||
MAX_EPISODES_DURATION_MINUTES=90
|
||||
TRANSCODE_TIMEOUT_MINUTES=120
|
||||
|
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
Readme.org
Normal file → Executable file
0
Readme.org
Normal file → Executable file
0
flake.lock
generated
Normal file → Executable file
0
flake.lock
generated
Normal file → Executable file
0
requirements.txt
Normal file → Executable file
0
requirements.txt
Normal file → Executable file
0
ripper/bell.oga
Normal file → Executable file
0
ripper/bell.oga
Normal file → Executable file
@@ -107,8 +107,7 @@ def transfer_ripped_dvd(ripped_dvd, destination_folder):
|
||||
subprocess.run(
|
||||
[
|
||||
"rsync",
|
||||
"-az",
|
||||
"-e ssh",
|
||||
"-rzP",
|
||||
"--remove-source-files",
|
||||
ripped_dvd,
|
||||
destination_folder,
|
||||
|
@@ -37,6 +37,7 @@ HANDBRAKE_AUDIO_LANG_LIST = os.environ["HANDBRAKE_AUDIO_LANG_LIST"]
|
||||
OUT_VIDEO_FORMAT = os.environ["OUT_VIDEO_FORMAT"]
|
||||
MIN_EPISODES_DURATION_SECONDS = int(os.environ["MIN_EPISODES_DURATION_MINUTES"]) * 60
|
||||
MAX_EPISODES_DURATION_SECONDS = int(os.environ["MAX_EPISODES_DURATION_MINUTES"]) * 60
|
||||
TRANSCODE_TIMEOUT_SECONDS = int(os.environ["TRANSCODE_TIMEOUT_MINUTES"]) * 60
|
||||
|
||||
SERIES_TITLE_REGEX = r"S(\d+)[ _]?E(\d+)(-(\d+))?$"
|
||||
|
||||
@@ -131,15 +132,21 @@ class Dvd:
|
||||
"HandBrakeCLI",
|
||||
"--preset",
|
||||
handbrake_preset,
|
||||
"--audio-lang-list",
|
||||
HANDBRAKE_AUDIO_LANG_LIST,
|
||||
"--first-audio",
|
||||
"--input",
|
||||
self.dvd_path,
|
||||
"--output",
|
||||
output_file,
|
||||
]
|
||||
|
||||
if HANDBRAKE_AUDIO_LANG_LIST.strip() == "":
|
||||
args += ["--all-audio"]
|
||||
else:
|
||||
args += [
|
||||
"--audio-lang-list",
|
||||
HANDBRAKE_AUDIO_LANG_LIST,
|
||||
"--first-audio"]
|
||||
|
||||
|
||||
if os.path.exists(self.nodvdnav_file):
|
||||
args += ["--no-dvdnav"]
|
||||
self.append_line_to_logfile(
|
||||
@@ -278,12 +285,19 @@ def transcode_episode(dvd: Dvd, season, episode, title_number):
|
||||
# Returns success
|
||||
def run_and_log_handbrake(dvd: Dvd, command) -> bool:
|
||||
with open(dvd.log_file, "a") as log_file:
|
||||
proc = subprocess.run(
|
||||
command,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdout=log_file,
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
command,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdout=log_file,
|
||||
timeout=TRANSCODE_TIMEOUT_SECONDS,
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
return False
|
||||
except subprocess.TimeoutExpired:
|
||||
log_file.write(
|
||||
f"Transcoding timeout of {TRANSCODE_TIMEOUT_SECONDS}s reached!"
|
||||
)
|
||||
return False
|
||||
|
||||
if check_handbrake_log_for_error(dvd):
|
||||
@@ -307,23 +321,30 @@ def find_series_titles(dvd: Dvd):
|
||||
return read_titles_from_titles_file(dvd)
|
||||
|
||||
with open(dvd.log_file, "w") as log_file:
|
||||
proc = subprocess.run(
|
||||
[
|
||||
"nice",
|
||||
"-n",
|
||||
str(HANDBRAKE_PROCESS_NICE_LEVEL),
|
||||
"HandBrakeCLI",
|
||||
"--input",
|
||||
dvd.dvd_path,
|
||||
"-t",
|
||||
"0",
|
||||
"--min-duration",
|
||||
str(MIN_EPISODES_DURATION_SECONDS),
|
||||
"--json",
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=log_file,
|
||||
)
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
[
|
||||
"nice",
|
||||
"-n",
|
||||
str(HANDBRAKE_PROCESS_NICE_LEVEL),
|
||||
"HandBrakeCLI",
|
||||
"--input",
|
||||
dvd.dvd_path,
|
||||
"-t",
|
||||
"0",
|
||||
"--min-duration",
|
||||
str(MIN_EPISODES_DURATION_SECONDS),
|
||||
"--json",
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=log_file,
|
||||
timeout=TRANSCODE_TIMEOUT_SECONDS,
|
||||
)
|
||||
except subprocess.TimeoutExpired:
|
||||
log_file.write(
|
||||
f"Transcoding timeout of {TRANSCODE_TIMEOUT_SECONDS}s reached!"
|
||||
)
|
||||
return None
|
||||
|
||||
if proc.returncode != 0:
|
||||
return None
|
||||
|
0
transcoder/video_transcoder.service.sample
Normal file → Executable file
0
transcoder/video_transcoder.service.sample
Normal file → Executable file
Reference in New Issue
Block a user