Skip to content

utils

Functions:

DVD_DEBUG module-attribute

DVD_DEBUG = 'DVD_DEBUG' in environ

debug_print

debug_print(*args: Any, **kwargs: Any) -> None
Source code
21
22
23
24
@copy_signature(print)
def debug_print(*args: Any, **kwargs: Any) -> None:
    if DVD_DEBUG:
        print(*args, **kwargs)

get_all_vobs

get_all_vobs(*files: SPath) -> list[SPath]
Source code
35
36
37
38
39
40
41
42
43
44
def get_all_vobs(*files: SPath) -> list[SPath]:
    found_files = list[SPath]()

    for file in list(files):
        if matches := re.search(r'VTS_([0-9]{2})_([0-9])\.VOB', file.name, re.IGNORECASE):
            found_files += file.get_folder().glob(
                f'[vV][tT][sS]_[{matches[1][0]}-9][{matches[1][1]}-9]_[{matches[2]}-9].[vV][oO][bB]'
            )

    return found_files

opt_int

opt_int(val: str | int | None) -> int | None
Source code
27
28
def opt_int(val: str | int | None) -> int | None:
    return int(val) if val is not None else None

opt_ints

opt_ints(vals: Sequence[str | int | None]) -> Sequence[int | None]
Source code
31
32
def opt_ints(vals: Sequence[str | int | None]) -> Sequence[int | None]:
    return [opt_int(x) for x in vals]