vtskit 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {vtskit-0.3.0/vtskit.egg-info → vtskit-0.3.1}/PKG-INFO +3 -2
  2. {vtskit-0.3.0 → vtskit-0.3.1}/README.md +2 -1
  3. {vtskit-0.3.0 → vtskit-0.3.1}/pyproject.toml +1 -1
  4. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_vmg.py +17 -0
  5. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/__init__.py +1 -1
  6. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/vmg.py +10 -4
  7. {vtskit-0.3.0 → vtskit-0.3.1/vtskit.egg-info}/PKG-INFO +3 -2
  8. {vtskit-0.3.0 → vtskit-0.3.1}/COPYING +0 -0
  9. {vtskit-0.3.0 → vtskit-0.3.1}/COPYING.LESSER +0 -0
  10. {vtskit-0.3.0 → vtskit-0.3.1}/setup.cfg +0 -0
  11. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_angles.py +0 -0
  12. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_ifo.py +0 -0
  13. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_lang.py +0 -0
  14. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_menu.py +0 -0
  15. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_nav.py +0 -0
  16. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_subtitles.py +0 -0
  17. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_title_buttons.py +0 -0
  18. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_titleset.py +0 -0
  19. {vtskit-0.3.0 → vtskit-0.3.1}/tests/test_vm.py +0 -0
  20. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/errors.py +0 -0
  21. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/ifo.py +0 -0
  22. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/lang.py +0 -0
  23. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/menu.py +0 -0
  24. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/nav.py +0 -0
  25. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/ps.py +0 -0
  26. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/spu.py +0 -0
  27. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/subtitles.py +0 -0
  28. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/titleset.py +0 -0
  29. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit/vm.py +0 -0
  30. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit.egg-info/SOURCES.txt +0 -0
  31. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit.egg-info/dependency_links.txt +0 -0
  32. {vtskit-0.3.0 → vtskit-0.3.1}/vtskit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vtskit
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: DVD-Video titlesets in pure Python: VOBs, navigation packs and IFO files
5
5
  Author: kajisho5
6
6
  License-Expression: LGPL-3.0-or-later
@@ -184,7 +184,8 @@ The tests give the same titles to dvdauthor and to vtskit, and the IFO and
184
184
  the VOBs must be the same byte for byte: NTSC and PAL, 4:3 and 16:9,
185
185
  chapters on and between VOBU starts, two titles in a titleset, AC-3, LPCM
186
186
  and MPEG sound with languages, B-pictures, short GOPs, a 40-second title,
187
- a subtitle track, two titlesets; every command form is the bytes dvdauthor
187
+ a subtitle track, two titlesets and three (whose attributes take the VMG
188
+ a second sector); every command form is the bytes dvdauthor
188
189
  compiles for the same statement, and a disc described in its language
189
190
  (menus of commands alone, buttons of several commands, cell commands, two
190
191
  titlesets) comes out with the same IFOs; for menus, the highlight
@@ -167,7 +167,8 @@ The tests give the same titles to dvdauthor and to vtskit, and the IFO and
167
167
  the VOBs must be the same byte for byte: NTSC and PAL, 4:3 and 16:9,
168
168
  chapters on and between VOBU starts, two titles in a titleset, AC-3, LPCM
169
169
  and MPEG sound with languages, B-pictures, short GOPs, a 40-second title,
170
- a subtitle track, two titlesets; every command form is the bytes dvdauthor
170
+ a subtitle track, two titlesets and three (whose attributes take the VMG
171
+ a second sector); every command form is the bytes dvdauthor
171
172
  compiles for the same statement, and a disc described in its language
172
173
  (menus of commands alone, buttons of several commands, cell commands, two
173
174
  titlesets) comes out with the same IFOs; for menus, the highlight
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vtskit"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "DVD-Video titlesets in pure Python: VOBs, navigation packs and IFO files"
9
9
  readme = "README.md"
10
10
  license = "LGPL-3.0-or-later"
@@ -105,6 +105,23 @@ class TestAgainstDvdauthor(unittest.TestCase):
105
105
  self.assertEqual([c[:3] for c in ifo.chapters(ifo.read_folder(mine))],
106
106
  [(1, 1, 1), (1, 1, 2), (2, 1, 1)])
107
107
 
108
+ def test_three_titlesets(self):
109
+ # VTS_ATRT holds 776 bytes a titleset: three no longer fit in a
110
+ # sector, and the table goes on into the next (as dvdauthor writes it)
111
+ paths = [os.path.join(self.tmp, f"{n}.mpg") for n in "abc"]
112
+ for p in paths:
113
+ encode(p, seconds=2)
114
+ theirs, mine = self.same("ntsc", [[Title(p, audio=(Audio("en", 2),))] for p in paths])
115
+ d = read(os.path.join(mine, "VIDEO_TS.IFO"))
116
+ tt_srpt, atrt = struct.unpack_from(">I", d, 0xC4)[0], struct.unpack_from(">I", d, 0xD0)[0]
117
+ self.assertEqual(struct.unpack_from(">H", d, atrt * 2048)[0], 3)
118
+ self.assertGreater(struct.unpack_from(">I", d, atrt * 2048 + 4)[0], 2048)
119
+ self.assertEqual([c[:3] for c in ifo.chapters(ifo.read_folder(mine))],
120
+ [(1, 1, 1), (2, 1, 1), (3, 1, 1)])
121
+ if LIBDVDNAV:
122
+ with dvdnav_sim.DvdSim(mine, LIBDVDNAV) as nav:
123
+ self.assertEqual(nav.num_titles(), 3)
124
+
108
125
  @unittest.skipUnless(LIBDVDNAV, "needs libdvdnav")
109
126
  def test_libdvdnav_plays_a_whole_disc(self):
110
127
  # a VIDEO_TS written by vtskit alone: two titlesets, three titles;
@@ -21,5 +21,5 @@ subtitles and angles, and dvdauthor's command language:
21
21
 
22
22
  from .errors import VtsError
23
23
 
24
- __version__ = "0.3.0"
24
+ __version__ = "0.3.1"
25
25
  __all__ = ["VtsError"]
@@ -7,8 +7,9 @@ it, TT_SRPT (every title of the disc: its titleset, number there, chapters,
7
7
  angles, and where the titleset starts on the disc), VTS_ATRT (a copy of
8
8
  each titleset's stream attributes) and, with menus, VMGM_PGCI_UT (one
9
9
  language unit), VMGM_C_ADT and VMGM_VOBU_ADMAP. The parental masks and
10
- the text data are absent. Each table starts at a sector; the BUP is the
11
- IFO again.
10
+ the text data are absent. Each table starts at a sector and takes as many
11
+ as it needs (VTS_ATRT two from three titlesets on); the BUP is the IFO
12
+ again.
12
13
 
13
14
  From dvdauthor's output: the VMG takes its IFO, its menu VOB and its BUP
14
15
  on the disc, 32 sectors at least, and the first titleset starts right
@@ -92,7 +93,12 @@ def write(folder, titlesets, menus=(), first_play=None, language="en", provider=
92
93
  for name, t in order:
93
94
  if t is not None:
94
95
  ifo_sectors += len(_pad(t)) // SECTOR
95
- ifo_sectors += 2 # TT_SRPT and VTS_ATRT below, a sector each (checked)
96
+ # TT_SRPT and VTS_ATRT, written below once the titlesets' places are
97
+ # known: 12 bytes a title, and 4 + 8 + 0x300 bytes a titleset (from
98
+ # three titlesets on, the attributes take a second sector)
99
+ titles = sum(len(ts.titles) for ts in titlesets)
100
+ ifo_sectors += -(-(8 + 12 * titles) // SECTOR)
101
+ ifo_sectors += -(-(8 + (4 + 8 + 0x300) * len(titlesets)) // SECTOR)
96
102
  vmg_sectors = max(2 * ifo_sectors + menu_sectors, VMG_SECTORS)
97
103
 
98
104
  # TT_SRPT: the titles of the disc
@@ -131,7 +137,7 @@ def write(folder, titlesets, menus=(), first_play=None, language="en", provider=
131
137
  pointers[name] = sectors
132
138
  sectors += len(tables[name]) // SECTOR
133
139
  if sectors != ifo_sectors:
134
- raise VtsError("the title table or the attributes outgrew a sector") # (99 titles fit)
140
+ raise VtsError("the title table or the attributes are not the size counted")
135
141
  mat = bytearray(head)
136
142
  mat[:12] = b"DVDVIDEO-VMG"
137
143
  struct.pack_into(">I", mat, 0x0C, vmg_sectors - 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vtskit
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: DVD-Video titlesets in pure Python: VOBs, navigation packs and IFO files
5
5
  Author: kajisho5
6
6
  License-Expression: LGPL-3.0-or-later
@@ -184,7 +184,8 @@ The tests give the same titles to dvdauthor and to vtskit, and the IFO and
184
184
  the VOBs must be the same byte for byte: NTSC and PAL, 4:3 and 16:9,
185
185
  chapters on and between VOBU starts, two titles in a titleset, AC-3, LPCM
186
186
  and MPEG sound with languages, B-pictures, short GOPs, a 40-second title,
187
- a subtitle track, two titlesets; every command form is the bytes dvdauthor
187
+ a subtitle track, two titlesets and three (whose attributes take the VMG
188
+ a second sector); every command form is the bytes dvdauthor
188
189
  compiles for the same statement, and a disc described in its language
189
190
  (menus of commands alone, buttons of several commands, cell commands, two
190
191
  titlesets) comes out with the same IFOs; for menus, the highlight
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes