Fix bugs, Add error messages

This commit is contained in:
2022-09-12 15:32:09 +02:00
parent e6917b9807
commit 140d30d767
3 changed files with 43 additions and 13 deletions

View File

@ -27,6 +27,13 @@ def main():
chdir_to_script_dir()
mkdirs()
dst = os.path.join(RIPPED_DIR, args.type, args.title)
if os.path.exists(dst):
print(
f"A {args.type} with this name has already been ripped. Are you sure you spelled the name right?"
)
exit(1)
success = rip_to_tmp_dir(args)
program_execution_time_str = get_program_execution_time_str(program_start_time)
if success:
@ -110,14 +117,11 @@ def rip_to_tmp_dir(args) -> bool:
def create_rip_command(args, dest):
if args.type == "movie":
return f"dvdbackup -i '{args.dev}' -o '{dest}' -F -n '{args.title}'"
else:
return f"dvdbackup -i '{args.dev}' -o '{dest}' -M -n '{args.title}'"
return f"dvdbackup -v -p -i '{args.dev}' -o '{dest}' -M -n \"{args.title}\""
def get_program_execution_time_str(program_start_time):
program_execution_time_minutes = (program_start_time - time.time()) / 60.0
program_execution_time_minutes = (time.time() - program_start_time) / 60.0
program_execution_time_minutes = max(0.0, program_execution_time_minutes)
return f"{program_execution_time_minutes:.1f} minutes"

View File

@ -3,13 +3,21 @@
import os
import subprocess
DESTINATION_FOLDER = "transcoder/raw" # pi@192.168.xxx:/home/pi/transcoder/raw
DESTINATION_FOLDER = (
"../transcoder/raw" # pi@192.168.xxx:/home/pi/dvd_rip/transcoder/raw
)
RIPPED_DIR = "ripped"
def main():
chdir_to_script_dir()
if not os.path.exists(DESTINATION_FOLDER):
print(
f"Destination folder '{DESTINATION_FOLDER}' does not exist. Please run transcoder script to generate it"
)
exit(1)
for dvd_type in ("movie", "series"):
for dvd in list_ripped_dvds(dvd_type):
print(f"Transferring {dvd_type}: {dvd}")