Compare commits
3 Commits
a7bc9c6257
...
master
Author | SHA1 | Date | |
---|---|---|---|
b5b2f580fa | |||
13c7bde679 | |||
5790b9134e |
2
.env.sample
Normal file → Executable file
2
.env.sample
Normal file → Executable file
@@ -8,7 +8,7 @@ TRANSFER_DESTINATION_FOLDER="../transcoder/raw"
|
|||||||
HANDBRAKE_PROCESS_NICE_LEVEL=10
|
HANDBRAKE_PROCESS_NICE_LEVEL=10
|
||||||
HANDBRAKE_PRESET_MOVIE="General/HQ 1080p30 Surround"
|
HANDBRAKE_PRESET_MOVIE="General/HQ 1080p30 Surround"
|
||||||
HANDBRAKE_PRESET_SERIES="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"
|
OUT_VIDEO_FORMAT=".mkv"
|
||||||
MIN_EPISODES_DURATION_MINUTES=30
|
MIN_EPISODES_DURATION_MINUTES=30
|
||||||
MAX_EPISODES_DURATION_MINUTES=90
|
MAX_EPISODES_DURATION_MINUTES=90
|
||||||
|
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
@@ -132,15 +132,21 @@ class Dvd:
|
|||||||
"HandBrakeCLI",
|
"HandBrakeCLI",
|
||||||
"--preset",
|
"--preset",
|
||||||
handbrake_preset,
|
handbrake_preset,
|
||||||
"--audio-lang-list",
|
|
||||||
HANDBRAKE_AUDIO_LANG_LIST,
|
|
||||||
"--first-audio",
|
|
||||||
"--input",
|
"--input",
|
||||||
self.dvd_path,
|
self.dvd_path,
|
||||||
"--output",
|
"--output",
|
||||||
output_file,
|
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):
|
if os.path.exists(self.nodvdnav_file):
|
||||||
args += ["--no-dvdnav"]
|
args += ["--no-dvdnav"]
|
||||||
self.append_line_to_logfile(
|
self.append_line_to_logfile(
|
||||||
@@ -279,13 +285,19 @@ def transcode_episode(dvd: Dvd, season, episode, title_number):
|
|||||||
# Returns success
|
# Returns success
|
||||||
def run_and_log_handbrake(dvd: Dvd, command) -> bool:
|
def run_and_log_handbrake(dvd: Dvd, command) -> bool:
|
||||||
with open(dvd.log_file, "a") as log_file:
|
with open(dvd.log_file, "a") as log_file:
|
||||||
proc = subprocess.run(
|
try:
|
||||||
command,
|
proc = subprocess.run(
|
||||||
stderr=subprocess.STDOUT,
|
command,
|
||||||
stdout=log_file,
|
stderr=subprocess.STDOUT,
|
||||||
timeout=TRANSCODE_TIMEOUT_SECONDS,
|
stdout=log_file,
|
||||||
)
|
timeout=TRANSCODE_TIMEOUT_SECONDS,
|
||||||
if proc.returncode != 0:
|
)
|
||||||
|
if proc.returncode != 0:
|
||||||
|
return False
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
log_file.write(
|
||||||
|
f"Transcoding timeout of {TRANSCODE_TIMEOUT_SECONDS}s reached!"
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if check_handbrake_log_for_error(dvd):
|
if check_handbrake_log_for_error(dvd):
|
||||||
@@ -309,24 +321,30 @@ def find_series_titles(dvd: Dvd):
|
|||||||
return read_titles_from_titles_file(dvd)
|
return read_titles_from_titles_file(dvd)
|
||||||
|
|
||||||
with open(dvd.log_file, "w") as log_file:
|
with open(dvd.log_file, "w") as log_file:
|
||||||
proc = subprocess.run(
|
try:
|
||||||
[
|
proc = subprocess.run(
|
||||||
"nice",
|
[
|
||||||
"-n",
|
"nice",
|
||||||
str(HANDBRAKE_PROCESS_NICE_LEVEL),
|
"-n",
|
||||||
"HandBrakeCLI",
|
str(HANDBRAKE_PROCESS_NICE_LEVEL),
|
||||||
"--input",
|
"HandBrakeCLI",
|
||||||
dvd.dvd_path,
|
"--input",
|
||||||
"-t",
|
dvd.dvd_path,
|
||||||
"0",
|
"-t",
|
||||||
"--min-duration",
|
"0",
|
||||||
str(MIN_EPISODES_DURATION_SECONDS),
|
"--min-duration",
|
||||||
"--json",
|
str(MIN_EPISODES_DURATION_SECONDS),
|
||||||
],
|
"--json",
|
||||||
stdout=subprocess.PIPE,
|
],
|
||||||
stderr=log_file,
|
stdout=subprocess.PIPE,
|
||||||
timeout=TRANSCODE_TIMEOUT_SECONDS,
|
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:
|
if proc.returncode != 0:
|
||||||
return None
|
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