intermediate checkin
This commit is contained in:
2
.vscode/settings.json
vendored
Normal file
2
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
||||||
BIN
build_hashdict.pickle
Normal file
BIN
build_hashdict.pickle
Normal file
Binary file not shown.
70
cmp_by_hash.py
Normal file
70
cmp_by_hash.py
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
#!python3
|
||||||
|
# Created 18 Sep 2019
|
||||||
|
# @author: andreas
|
||||||
|
|
||||||
|
""" Module: Main Template """
|
||||||
|
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import hashlib
|
||||||
|
from pathlib import Path
|
||||||
|
import datetime as dt
|
||||||
|
import pickle
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
LOG = logging.getLogger()
|
||||||
|
PROXY_DIR = "."
|
||||||
|
|
||||||
|
|
||||||
|
def cli(argv=None):
|
||||||
|
# command line interface
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv
|
||||||
|
LOG.info("%s %s", os.path.basename(argv[0]), " ".join(argv[1:]))
|
||||||
|
parser = ArgumentParser(description="Module Template")
|
||||||
|
parser.add_argument("--src")
|
||||||
|
parser.add_argument("--dest")
|
||||||
|
args = parser.parse_args(argv[1:])
|
||||||
|
argd = vars(args)
|
||||||
|
# arguments
|
||||||
|
for k, v in argd.items():
|
||||||
|
print(k, v)
|
||||||
|
# feature
|
||||||
|
srcd = build_hashdict(Path(args.src))
|
||||||
|
destd = build_hashdict(Path(args.dest))
|
||||||
|
srch = set(srcd.keys())
|
||||||
|
desth = set(destd.keys())
|
||||||
|
xor_hashes = srch ^ desth
|
||||||
|
for h in xor_hashes:
|
||||||
|
if h in srcd:
|
||||||
|
print(srcd[h])
|
||||||
|
for h in xor_hashes:
|
||||||
|
if h in destd:
|
||||||
|
print(destd[h])
|
||||||
|
LOG.info("done")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def build_hashdict(base):
|
||||||
|
files_by_hash = dict()
|
||||||
|
for fp in base.glob("**/*.jpg"):
|
||||||
|
h = file_hash(fp)
|
||||||
|
files_by_hash[h] = fp
|
||||||
|
return files_by_hash
|
||||||
|
|
||||||
|
|
||||||
|
def file_hash(filepath):
|
||||||
|
h = hashlib.sha256()
|
||||||
|
with filepath.open("rb") as fh:
|
||||||
|
h.update(fh.read())
|
||||||
|
return h.digest()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
logging.Formatter.default_time_format = '%H:%M:%S'
|
||||||
|
logging.Formatter.default_msec_format = '%s.%03d'
|
||||||
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
|
format='%(asctime)s [%(process)i] %(levelname).4s %(module)s.%(funcName)s: %(message)s')
|
||||||
|
sys.exit(cli())
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!python3
|
#!python
|
||||||
|
|
||||||
# https://github.com/hMatoba/Piexif
|
# https://github.com/hMatoba/Piexif
|
||||||
# http://ce3wiki.theturninggate.net/doku.php?id=file_name_convention
|
# http://ce3wiki.theturninggate.net/doku.php?id=file_name_convention
|
||||||
@@ -112,10 +112,10 @@ def rename(old, new):
|
|||||||
for daydir in Path(SRC).iterdir():
|
for daydir in Path(SRC).iterdir():
|
||||||
if not daydir.is_dir():
|
if not daydir.is_dir():
|
||||||
continue
|
continue
|
||||||
if daydir.name != "Aquaris U Plus":
|
if daydir.name != "Sony a5100":
|
||||||
continue
|
continue
|
||||||
print(f"[{daydir.name}] -------------------------------------------------")
|
print(f"[{daydir.name}] -------------------------------------------------")
|
||||||
mo = re.match("(?P<dt>\S*)\s?(?P<title>.*)", daydir.name)
|
mo = re.match("(?P<dt>\S*)\s?(?P<title>.*)", daydir.name)
|
||||||
md = mo.groupdict()
|
md = mo.groupdict()
|
||||||
title = md['title']
|
title = md['title']
|
||||||
recurse(daydir, md, camera="Aquaris U Plus")
|
recurse(daydir, md)
|
||||||
|
|||||||
61
transcode-ricoh.py
Normal file
61
transcode-ricoh.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#!python3
|
||||||
|
# Created 5 Jul 2019 Andreas Balogh
|
||||||
|
# @author: baloan
|
||||||
|
|
||||||
|
""" Module: Main Template """
|
||||||
|
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
LOG = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
def transcode_dir(src, dest):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def transcode_one(src, dest):
|
||||||
|
# set DFB="C:\Users\Andreas\AppData\Local\Programs\RicohTheta\resources\tools\dualfishblender\win\DualfishBlender.exe"
|
||||||
|
# %DFB% "%~1.MP4" "er\%~1_er.mp4"
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def gui():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def cli(argv=None):
|
||||||
|
# command line interface
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv
|
||||||
|
LOG.info("%s %s", os.path.basename(argv[0]), " ".join(argv[1:]))
|
||||||
|
parser = ArgumentParser(description="Module Template")
|
||||||
|
parser.add_argument("--action", help="mock action verb")
|
||||||
|
parser.add_argument("--database", help="database connection")
|
||||||
|
parser.add_argument("--config_file", help="json filepath, not used by mock")
|
||||||
|
args = parser.parse_args(argv[1:])
|
||||||
|
argd = vars(args)
|
||||||
|
# source directory tree root
|
||||||
|
# destination directory tree root
|
||||||
|
# location of dualfishblender
|
||||||
|
|
||||||
|
# arguments
|
||||||
|
for k, v in argd.items():
|
||||||
|
print(k, v)
|
||||||
|
# enviroment
|
||||||
|
for k, v in os.environ.items():
|
||||||
|
print(k, v)
|
||||||
|
# feature
|
||||||
|
LOG.info("done")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
logging.Formatter.default_time_format = '%H:%M:%S'
|
||||||
|
logging.Formatter.default_msec_format = '%s.%03d'
|
||||||
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
|
format='%(asctime)s [%(process)i] %(levelname).4s %(module)s.%(funcName)s: %(message)s')
|
||||||
|
sys.exit(cli())
|
||||||
Reference in New Issue
Block a user