Skip to content

Commit

Permalink
revert unneeded file check, issue was with where pgsrip was outputtin…
Browse files Browse the repository at this point in the history
…g srt files.
  • Loading branch information
cbusillo committed Jun 22, 2024
1 parent b3d1b87 commit 4cd9f1b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
14 changes: 0 additions & 14 deletions bd_to_avp/modules/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ def move_file_to_output_root_folder(muxed_output_path: Path) -> None:
remove_folder_if_exists(muxed_output_path.parent)


def check_for_file_with_extension(folder_path: Path, extension: str) -> bool:
if not extension.startswith("."):
extension = f".{extension}"
print(f"Checking for {extension} files in: {folder_path}")

for file_path in folder_path.iterdir():
if file_path.suffix.lower() == extension.lower():
print(f"Found {extension} file: {file_path.name}")
return True

print(f"No {extension} files found in {folder_path}")
return False


@contextmanager
def mounted_image(image_path: Path):
mount_point = None
Expand Down
3 changes: 1 addition & 2 deletions bd_to_avp/modules/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from bd_to_avp.modules.config import config
from bd_to_avp.modules.command import Spinner
from bd_to_avp.modules.file import check_for_file_with_extension


class SRTCreationError(Exception):
Expand Down Expand Up @@ -58,7 +57,7 @@ def extract_subtitle_to_srt(mkv_path: Path, output_path: Path) -> None:
if srt_file.stat().st_size == 0:
srt_file.unlink()

if not check_for_file_with_extension(output_path, "srt") and not config.continue_on_error:
if not any(output_path.glob("*.srt")) and not config.continue_on_error:
raise SRTCreationError("No SRT subtitle files created.")

if forced_track_language:
Expand Down

0 comments on commit 4cd9f1b

Please sign in to comment.