unknown
This commit is contained in:
55
.vscode/settings.json
vendored
55
.vscode/settings.json
vendored
@@ -1,3 +1,56 @@
|
|||||||
{
|
{
|
||||||
"python.pythonPath": "C:\\Apps\\Python310\\python.exe"
|
"code-runner.executorMap": {
|
||||||
|
|
||||||
|
"javascript": "node",
|
||||||
|
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||||
|
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"php": "php",
|
||||||
|
"python": "C:\\Apps\\Python3\\python.exe -u",
|
||||||
|
"perl": "perl",
|
||||||
|
"perl6": "perl6",
|
||||||
|
"ruby": "ruby",
|
||||||
|
"go": "go run",
|
||||||
|
"lua": "lua",
|
||||||
|
"groovy": "groovy",
|
||||||
|
"powershell": "powershell -ExecutionPolicy ByPass -File",
|
||||||
|
"bat": "cmd /c",
|
||||||
|
"shellscript": "bash",
|
||||||
|
"fsharp": "fsi",
|
||||||
|
"csharp": "scriptcs",
|
||||||
|
"vbscript": "cscript //Nologo",
|
||||||
|
"typescript": "ts-node",
|
||||||
|
"coffeescript": "coffee",
|
||||||
|
"scala": "scala",
|
||||||
|
"swift": "swift",
|
||||||
|
"julia": "julia",
|
||||||
|
"crystal": "crystal",
|
||||||
|
"ocaml": "ocaml",
|
||||||
|
"r": "Rscript",
|
||||||
|
"applescript": "osascript",
|
||||||
|
"clojure": "lein exec",
|
||||||
|
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
|
||||||
|
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
|
||||||
|
"racket": "racket",
|
||||||
|
"scheme": "csi -script",
|
||||||
|
"ahk": "autohotkey",
|
||||||
|
"autoit": "autoit3",
|
||||||
|
"dart": "dart",
|
||||||
|
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
|
||||||
|
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
|
||||||
|
"haskell": "runhaskell",
|
||||||
|
"nim": "nim compile --verbosity:0 --hints:off --run",
|
||||||
|
"lisp": "sbcl --script",
|
||||||
|
"kit": "kitc --run",
|
||||||
|
"v": "v run",
|
||||||
|
"sass": "sass --style expanded",
|
||||||
|
"scss": "scss --style expanded",
|
||||||
|
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
|
||||||
|
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
|
||||||
|
"sml": "cd $dir && sml $fileName"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ DRY_RUN = False
|
|||||||
|
|
||||||
fileidx = defaultdict(int)
|
fileidx = defaultdict(int)
|
||||||
|
|
||||||
CAMERAS = ("GoPro Hero3+", "Ricoh Theta V", "Ricoh Theta S", "Sony a5100", "Sony a65", "Sony a68", "Sony TRV-25E", "Fuji Finepix Real 3D W3", "DJI Mini 2", "Mobile Media")
|
CAMERAS = ("GoPro Hero3+", "Ricoh Theta V", "Ricoh Theta S", "Sony a5100", "Sony a65", "Sony a68", "Sony TRV-25E", "Fuji Finepix Real 3D W3", "DJI Mini 2", "Samsung Galaxy A40", "Samsung Galaxy A41")
|
||||||
|
|
||||||
|
|
||||||
def recurse(dir, md, camera=None):
|
def recurse(dir, md, camera=None):
|
||||||
@@ -45,7 +45,7 @@ def recurse(dir, md, camera=None):
|
|||||||
author = "ab"
|
author = "ab"
|
||||||
mtime = fp.stat().st_mtime
|
mtime = fp.stat().st_mtime
|
||||||
rawdt = dt.datetime.fromtimestamp(mtime)
|
rawdt = dt.datetime.fromtimestamp(mtime)
|
||||||
if fp.suffix.lower() == ".jpg":
|
if fp.suffix.lower() in [".jpg"]:
|
||||||
try:
|
try:
|
||||||
exif_dict = piexif.load(str(fp))
|
exif_dict = piexif.load(str(fp))
|
||||||
idto = exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal].decode("ascii")
|
idto = exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal].decode("ascii")
|
||||||
@@ -56,8 +56,8 @@ def recurse(dir, md, camera=None):
|
|||||||
try:
|
try:
|
||||||
model = exif_dict["0th"][piexif.ImageIFD.Model].decode("ascii")
|
model = exif_dict["0th"][piexif.ImageIFD.Model].decode("ascii")
|
||||||
except:
|
except:
|
||||||
|
print(exif_dict)
|
||||||
model = None
|
model = None
|
||||||
pass
|
|
||||||
use_camera = False
|
use_camera = False
|
||||||
if model == 'Canon EOS 5D':
|
if model == 'Canon EOS 5D':
|
||||||
print(f"{fp.name} scanned photo, use directory date")
|
print(f"{fp.name} scanned photo, use directory date")
|
||||||
@@ -69,6 +69,13 @@ def recurse(dir, md, camera=None):
|
|||||||
author = "jb"
|
author = "jb"
|
||||||
if model == 'ASUS_Z00ED':
|
if model == 'ASUS_Z00ED':
|
||||||
author = "sb"
|
author = "sb"
|
||||||
|
if model == 'SM-A405FN':
|
||||||
|
author = "ab"
|
||||||
|
if model == 'SM-A415F' or camera == "Samsung Galaxy A41":
|
||||||
|
author = "kb"
|
||||||
|
elif fp.suffix.lower() == ".heic":
|
||||||
|
use_camera = False
|
||||||
|
author = "kb"
|
||||||
elif fp.suffix.upper() == ".ARW":
|
elif fp.suffix.upper() == ".ARW":
|
||||||
use_camera = False
|
use_camera = False
|
||||||
elif fp.suffix.upper() == ".MRW":
|
elif fp.suffix.upper() == ".MRW":
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!python3
|
#!python
|
||||||
|
|
||||||
# set mtime for handbrake mp4 files from filename
|
# set mtime for handbrake mp4 files from filename
|
||||||
|
|
||||||
@@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import piexif
|
|
||||||
from collections import defaultdict
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -23,10 +21,10 @@ def rename(old, new):
|
|||||||
else:
|
else:
|
||||||
print(f"skipped {old.name}, {new.name}, already exists")
|
print(f"skipped {old.name}, {new.name}, already exists")
|
||||||
|
|
||||||
src = Path(r'D:\Videos')
|
# src = Path(r'D:\Videos')
|
||||||
|
|
||||||
for raw in src.glob("*.m4v"):
|
for raw in src.glob("*.mp4"):
|
||||||
mo = re.match("(?P<author>[^-]*)-(?P<dt>\S*)-(?P<model>[^-]*)(-\S+)?.m4v", raw.name)
|
mo = re.match("(?P<author>[^-]*)-(?P<dt>\S*)-(?P<model>[^-]*)(-\S+)?.mp4", raw.name)
|
||||||
if mo is None:
|
if mo is None:
|
||||||
print(f"skipped {raw.name}, no match")
|
print(f"skipped {raw.name}, no match")
|
||||||
continue
|
continue
|
||||||
|
|||||||
40
set_mtime_from_filename.py
Normal file
40
set_mtime_from_filename.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!python
|
||||||
|
|
||||||
|
# set mtime for handbrake mp4 files from filename
|
||||||
|
|
||||||
|
# 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 re
|
||||||
|
import os
|
||||||
|
|
||||||
|
DRY_RUN = False
|
||||||
|
|
||||||
|
def rename(old, new):
|
||||||
|
print(old.name, "->", new.name)
|
||||||
|
if not DRY_RUN:
|
||||||
|
if not new.exists():
|
||||||
|
old.rename(new)
|
||||||
|
else:
|
||||||
|
print(f"skipped {old.name}, {new.name}, already exists")
|
||||||
|
|
||||||
|
# src = Path(r'D:\Videos')
|
||||||
|
src = Path(r"D:\MediaLibrary\Pictures\2022\20220831 Urlaub Cote d'Azur")
|
||||||
|
|
||||||
|
for raw in src.glob("*pano.jpg"):
|
||||||
|
mo = re.match("(?P<author>[^-]*)-(?P<dt>\S*)-(?P<model>[^-]*)(-\S+)?.jpg", raw.name)
|
||||||
|
if mo is None:
|
||||||
|
print(f"skipped {raw.name}, no match")
|
||||||
|
continue
|
||||||
|
md = mo.groupdict()
|
||||||
|
rawdt = dt.datetime.strptime(md['dt'],"%Y%m%d-%H%M%S")
|
||||||
|
mtime = rawdt.timestamp()
|
||||||
|
atime = raw.stat().st_atime
|
||||||
|
print(f"setting {raw.name} to {rawdt}")
|
||||||
|
if not DRY_RUN:
|
||||||
|
os.utime(raw, (atime, mtime))
|
||||||
|
# fn = f"{md['author'].lower()}-{md['dt']}-{md['model']}{raw.suffix}"
|
||||||
|
# rename(raw, raw.parent / fn)
|
||||||
Reference in New Issue
Block a user