From 03591714831213c9f302cc53bbe54d46d9a76d98 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Wed, 14 Sep 2022 17:32:26 +0200 Subject: [PATCH] Ceil len of names in tmp This is because dvdbackup allows maximum 33 chars in the output file (I dont know why) --- ripper/rip_dvd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ripper/rip_dvd.py b/ripper/rip_dvd.py index 09a56ef..68e8d03 100755 --- a/ripper/rip_dvd.py +++ b/ripper/rip_dvd.py @@ -16,6 +16,7 @@ LOGFILE = "rip.log" NOTIFICATION_SOUND = "bell.oga" SERIES_TITLE_REGEX = r"S\d+[ _]?E(\d+)-(\d+)$" +MAX_FILENAME_LEN_IN_TMP = 30 # dvdbackup cuts name of output files at 33 chars def main(): @@ -117,7 +118,8 @@ def rip_to_tmp_dir(args) -> bool: def create_rip_command(args, dest): - return f"dvdbackup -v -p -i '{args.dev}' -o '{dest}' -M -n \"{args.title}\"" + shortened_title = args.title[:MAX_FILENAME_LEN_IN_TMP] + return f"dvdbackup -v -p -i '{args.dev}' -o '{dest}' -M -n {shortened_title}" def get_program_execution_time_str(program_start_time): @@ -150,7 +152,8 @@ def send_notification(text): def mv_ripped_from_tmp_to_ripped_dir(args): - src = os.path.join(TMP_DIR, args.title) + shortened_title = args.title[:MAX_FILENAME_LEN_IN_TMP] + src = os.path.join(TMP_DIR, shortened_title) dst = os.path.join(RIPPED_DIR, args.type, args.title) shutil.move(src, dst)