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

42
mv_lumia.py Normal file
View File

@@ -0,0 +1,42 @@
#!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
# SRC = r'E:\RawByUser\Andreas\Microsoft Lumia 640'
# SRC = r'E:\RawByUser\Andreas\Samsung DV-150'
SRC = r'E:\RawByUser\Andreas\Sony K800i'
DEST = r'E:\VideoByDateArchive'
src = Path(SRC)
for raw in src.glob("*.3GP"):
fn = raw.name
if not raw.is_file():
print(f"skipped {fn}")
continue
try:
# rawdt = dt.datetime.strptime(fn,"ab-%Y%m%d-%H%M%S-Samsung DV-150.MP4")
rawdt = dt.datetime.strptime(fn,"ab-%Y%m%d-%H%M%S-Sony K800i.3GP")
except:
print(f'exif failed {fn}, using file date')
mtime = raw.stat().st_mtime
rawdt = dt.datetime.fromtimestamp(mtime)
year = rawdt.year
day = f"{rawdt:%Y%m%d}"
ts = f"{rawdt:%H%M%S}"
destdir = Path(DEST, f"{year}",f"{day}")
if not destdir.exists():
print(f'creating {destdir}')
destdir.mkdir(parents=True)
# stem = f"kb-{day}-{ts}"
destfn = destdir / f"{fn}"
if destfn.exists():
print(f'skipped {destfn}, already exists')
continue
print(f"{fn}", "->", destfn)
raw.rename(destfn)