Skip to content

dvdsrc

Classes:

DVDSRCIndexer

Bases: DVDIndexer

Methods:

Attributes:

iso_path instance-attribute

iso_path: SPath

parse_vts

parse_vts(
    title: IFO0Title,
    disable_rff: bool,
    vobidcellids_to_take: list[tuple[int, int]],
    target_vts: IFOX,
    output_folder: SPath,
    vob_input_files: Sequence[SPath],
) -> tuple[VideoNode, list[int], list[tuple[int, int]], list[int]]
Source code
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def parse_vts(
    self, title: IFO0Title, disable_rff: bool, vobidcellids_to_take: list[tuple[int, int]],
    target_vts: IFOX, output_folder: SPath, vob_input_files: Sequence[SPath]
) -> tuple[vs.VideoNode, list[int], list[tuple[int, int]], list[int]]:
    admap = target_vts.vts_vobu_admap

    all_ranges = [
        x for a in vobidcellids_to_take for x in get_sectorranges_for_vobcellpair(target_vts, a)
    ]

    vts_indices = list[int]()
    for a in all_ranges:
        start_index = admap.index(a[0])

        try:
            end_index = admap.index(a[1] + 1) - 1
        except ValueError:
            end_index = len(admap) - 1

        vts_indices.extend([start_index, end_index])

    rawnode = core.dvdsrc2.FullVts(str(self.iso_path), vts=title.title_set_nr, ranges=vts_indices)
    staff = self._extract_data(rawnode)

    if not disable_rff:
        rnode = apply_rff_video(rawnode, staff.rff, staff.tff, staff.prog, staff.progseq)
        _vobids = apply_rff_array(staff.vobids, staff.rff, staff.tff, staff.progseq)
    else:
        rnode = rawnode
        _vobids = staff.vobids

    return rnode, staff.rff, _vobids, vts_indices

get_sectorranges_for_vobcellpair

get_sectorranges_for_vobcellpair(
    current_vts: IFOX, pair_id: tuple[int, int]
) -> list[tuple[int, int]]
Source code
20
21
22
23
24
25
def get_sectorranges_for_vobcellpair(current_vts: IFOX, pair_id: tuple[int, int]) -> list[tuple[int, int]]:
    return [
        (e.start_sector, e.last_sector)
        for e in current_vts.vts_c_adt.cell_adr_table
        if (e.vob_id, e.cell_id) == pair_id
    ]