initial commit

This commit is contained in:
Andrew Davidson 2021-10-02 21:15:22 -07:00
commit f3a699cfc7
Signed by: amd
GPG key ID: 17AF8F2A49CF25C6
5 changed files with 79 additions and 0 deletions

12
Pipfile Normal file
View file

@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pickledb = "*"
[dev-packages]
[requires]
python_version = "3.9"

28
Pipfile.lock generated Normal file
View file

@ -0,0 +1,28 @@
{
"_meta": {
"hash": {
"sha256": "84bbdcbaa4485132637e33fc1537e6010cc822a1faeb127116aeb7cd78ea59d0"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.9"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"pickledb": {
"hashes": [
"sha256:ec6973e65d7d112849e78ce522840aa908efb2523470bb8ce5c7942310192240"
],
"index": "pypi",
"version": "==0.9.2"
}
},
"develop": {}
}

1
README.md Normal file
View file

@ -0,0 +1 @@
#par2_photos.py

BIN
lib/par2 Executable file

Binary file not shown.

38
par2_photos.py Normal file
View file

@ -0,0 +1,38 @@
from pathlib import Path
import pickledb
import subprocess
PATH = Path("/data/backup/Photos")
PAR2_DB = PATH.joinpath(".par2.db")
db = pickledb.load(PAR2_DB, False)
extensions = {
".gif",
".jpg",
".jpeg",
".dng",
".cr2",
".orf",
".nef",
".psd",
".png",
".heic",
".heif",
".hevc",
".mp4",
}
files = list(PATH.rglob("*"))
for file in files:
if file.suffix.lower() in extensions:
rel = str(file.relative_to(PATH))
if not db.exists(rel):
result = subprocess.call(["lib/par2", "create", str(file)])
if result == 0:
db.set(rel, "done")
else:
continue
db.dump()