initial commit

This commit is contained in:
2019-09-12 22:14:01 +02:00
parent 6baa5a6b72
commit b75a865a7c
28 changed files with 1100 additions and 0 deletions

37
mv_mrw.py Normal file
View File

@@ -0,0 +1,37 @@
#!python3
# https://github.com/hMatoba/Piexif
# http://ce3wiki.theturninggate.net/doku.php?id=file_name_convention
# destination: <BASE>/<year>/<YYYYMMDD> <Event>/ab-<YYYYMMDD>-<Event>-<nnnn>.jpg
from pathlib import Path
import datetime as dt
import piexif
from collections import defaultdict
import re
src = Path(r'E:\MediaArchive\Andreas\RawByDate')
dest = Path(r'E:\MediaArchive\Andreas\RawByCamera\Minolta Dynax 5')
dry_run = False
for mrw in src.rglob("*.mrw"):
mo = re.match("ab-(?P<dt>\S*-\S*).mrw", mrw.name)
if mo is None:
print(f"skipped {mrw.name}, no match")
continue
md = mo.groupdict()
mrwdt = dt.datetime.strptime(md['dt'],"%Y%m%d-%H%M%S")
# move avi to raw Sony
mrw_dir = dest / str(mrwdt.year) / f"{mrwdt:%Y%m%d}"
mrw_n = mrw_dir / mrw.name
if not mrw_dir.exists():
print(f"creating {mrw_dir}")
if not dry_run:
mrw_dir.mkdir(parents=True)
print(mrw.name, "->", mrw_n)
if not mrw_n.exists():
if not dry_run:
mrw.rename(mrw_n)
else:
print(f"skipped {mrw.name}, {mrw_n}, already exists")