Skip to content

Commit

Permalink
Revert "Use Mpeg4-MVC-3D from title information to pick 3d titles, th…
Browse files Browse the repository at this point in the history
…en select the longest one."

This reverts commit ca0369d.
  • Loading branch information
cbusillo committed Jul 1, 2024
1 parent 8c51565 commit 201aae3
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions bd_to_avp/modules/disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,37 +66,22 @@ def get_disc_and_mvc_video_info() -> DiscInfo:
if "/" in disc_info.frame_rate:
disc_info.frame_rate = disc_info.frame_rate.split(" ")[0]

mvc_titles = get_mvc_title_numbers_and_durations(output)
main_feature_index = get_longest_mvc_title(mvc_titles)

disc_info.main_title_number = main_feature_index

return disc_info
title_info_pattern = re.compile(r'TINFO:(?P<index>\d+),\d+,\d+,"(?P<duration>\d+:\d+:\d+)"')
longest_duration = 0
main_feature_index = 0

for match in title_info_pattern.finditer(output):
title_index = int(match.group("index"))
h, m, s = map(int, match.group("duration").split(":"))
duration_seconds = h * 3600 + m * 60 + s

def get_mvc_title_numbers_and_durations(output: str) -> dict:
mvc_titles = {}
for line in output.splitlines():
if "Mpeg4-MVC-3D" in line:
title_number_match = re.search(r"TINFO:(\d+),", line)
duration_match = re.search(r"TINFO:\d+,9,0,\"(\d+:\d+:\d+)\"", output)
if title_number_match and duration_match:
title_number = int(title_number_match.group(1))
duration = duration_match.group(1)
mvc_titles[title_number] = duration
return mvc_titles
if duration_seconds > longest_duration:
longest_duration = duration_seconds
main_feature_index = title_index

disc_info.main_title_number = main_feature_index

def get_longest_mvc_title(mvc_titles: dict) -> int:
longest_duration = 0
longest_title = 0
for title, duration in mvc_titles.items():
h, m, s = map(int, duration.split(":"))
total_seconds = h * 3600 + m * 60 + s
if total_seconds > longest_duration:
longest_duration = total_seconds
longest_title = title
return longest_title
return disc_info


def rip_disc_to_mkv(output_folder: Path, disc_info: DiscInfo, language_code: str) -> None:
Expand Down

0 comments on commit 201aae3

Please sign in to comment.