Skip to content

Commit

Permalink
Make tool to merge vba-m movies. #23.
Browse files Browse the repository at this point in the history
  • Loading branch information
laqieer committed Aug 16, 2022
1 parent 140ae9f commit ca83308
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/movie/vbam/chapters.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
XX001
X0001
Binary file added test/movie/vbam/chapters.vm0
Binary file not shown.
Binary file added test/movie/vbam/chapters.vmv
Binary file not shown.
21 changes: 21 additions & 0 deletions test/movie/vbam/merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

import os
import sys
import shutil

fnIn = os.path.splitext(sys.argv[1])[0]

with open(fnIn + '.txt', 'r') as fIn, open(fnIn + '.vmv', 'wb') as fOut:
first = True
for fnMovie in [l.strip() for l in fIn.readlines()]:
if fnMovie:
if first:
first = False
shutil.copyfile(fnMovie + '.vm0', fnIn + '.vm0')
with open(fnMovie + '.vmv', 'rb') as f:
fOut.write(f.read())
continue
with open(fnMovie + '.vmv', 'rb') as f:
f.seek(4) # skip vmv header which specifies movie format version, only version 2 is supported now
fOut.write(f.read())

0 comments on commit ca83308

Please sign in to comment.