Init
This commit is contained in:
commit
98adf8e95f
28
mrparser.py
Normal file
28
mrparser.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import os
|
||||||
|
import fire
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
LIST_NAME = '_names.list'
|
||||||
|
PARTICLE_FMT = '{}.tag'
|
||||||
|
CONTENTS_PREFIX = '?'
|
||||||
|
|
||||||
|
def parse(inputdir: str = 'raw', outputdir: str = 'output', test: bool = False):
|
||||||
|
print('Arguments:', inputdir, outputdir, test)
|
||||||
|
if not os.path.exists(outputdir):
|
||||||
|
os.mkdir(outputdir)
|
||||||
|
print('Created output directory:', outputdir)
|
||||||
|
with open(os.path.join(inputdir, LIST_NAME), encoding='utf8') as f:
|
||||||
|
names = [_.rstrip() for _ in f.readlines()]
|
||||||
|
for i, name in enumerate(names):
|
||||||
|
if name.startswith(CONTENTS_PREFIX):
|
||||||
|
input_name = os.path.join(inputdir, PARTICLE_FMT.format(i+1))
|
||||||
|
output_name = os.path.join(outputdir, os.path.basename(name))
|
||||||
|
print('Copying:', input_name, '->', output_name)
|
||||||
|
if not test:
|
||||||
|
shutil.copyfile(input_name, output_name)
|
||||||
|
|
||||||
|
print('*' * 20, 'Summary', '*' * 20)
|
||||||
|
print(f'Done! {len(names)} files copied.')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
fire.Fire(parse)
|
2
process.ps1
Normal file
2
process.ps1
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$file = "2023-07-09.mrpro"
|
||||||
|
7z e $file -o"raw"
|
Loading…
Reference in New Issue
Block a user