Add possibility to rip series disc with one title

This commit is contained in:
2023-03-06 19:15:04 +01:00
parent 19fcd9d1f0
commit dbdea3b638
2 changed files with 15 additions and 5 deletions

View File

@ -15,7 +15,7 @@ RIPPED_DIR = "ripped"
LOGFILE = "rip.log" LOGFILE = "rip.log"
NOTIFICATION_SOUND = "bell.oga" NOTIFICATION_SOUND = "bell.oga"
SERIES_TITLE_REGEX = r"S\d+[ _]?E(\d+)-(\d+)$" SERIES_TITLE_REGEX = r"S\d+[ _]?E(\d+)(-(\d+))?$"
MAX_FILENAME_LEN_IN_TMP = 25 # dvdbackup cuts name of output files at 33 chars MAX_FILENAME_LEN_IN_TMP = 25 # dvdbackup cuts name of output files at 33 chars
WAIT_FOR_DEVICE_TIME_SECONDS = 3 WAIT_FOR_DEVICE_TIME_SECONDS = 3
@ -90,7 +90,12 @@ def is_series_title_valid(title):
if episode_matches is None: if episode_matches is None:
return False return False
episode_from = int(episode_matches.group(1)) episode_from = int(episode_matches.group(1))
episode_to = int(episode_matches.group(2)) episode_to = episode_matches.group(3)
if episode_to:
episode_to = int(episode_to)
else:
episode_to = episode_from
if episode_from < episode_to: if episode_from < episode_to:
return True return True
except: except:
@ -151,6 +156,7 @@ def rip_to_tmp_dir(args) -> bool:
def create_info_command(args): def create_info_command(args):
return ["dvdbackup", "-i", args.dev, "-I"] return ["dvdbackup", "-i", args.dev, "-I"]
def create_rip_command(args, dest): def create_rip_command(args, dest):
shortened_title = shorten_title(args) shortened_title = shorten_title(args)
return [ return [

View File

@ -23,7 +23,7 @@ OUT_VIDEO_FORMAT = os.environ["OUT_VIDEO_FORMAT"]
MIN_EPISODES_DURATION_SECONDS = int(os.environ["MIN_EPISODES_DURATION_MINUTES"]) * 60 MIN_EPISODES_DURATION_SECONDS = int(os.environ["MIN_EPISODES_DURATION_MINUTES"]) * 60
MAX_EPISODES_DURATION_SECONDS = int(os.environ["MAX_EPISODES_DURATION_MINUTES"]) * 60 MAX_EPISODES_DURATION_SECONDS = int(os.environ["MAX_EPISODES_DURATION_MINUTES"]) * 60
SERIES_TITLE_REGEX = r"S(\d+)[ _]?E(\d+)-(\d+)$" SERIES_TITLE_REGEX = r"S(\d+)[ _]?E(\d+)(-(\d+))?$"
def main(): def main():
@ -89,9 +89,13 @@ class Dvd:
series = int(re_matches.group(1)) series = int(re_matches.group(1))
episode_from = int(re_matches.group(2)) episode_from = int(re_matches.group(2))
episode_to = int(re_matches.group(3)) episode_to = re_matches.group(4)
if episode_to:
episode_to = int(episode_to)
else:
episode_to = episode_from
if episode_from >= episode_to: if episode_from > episode_to:
return None return None
episodes = list(range(episode_from, episode_to + 1)) episodes = list(range(episode_from, episode_to + 1))