Created
April 21, 2024 22:25
-
-
Save VictorWesterlund/d92a0e7408ef6889920afe4449f22834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
from pathlib import Path | |
ALBUM_DIR = "" | |
def add_to_album(file, root, album): | |
album = bytes(album, "utf-8").decode("unicode-escape") | |
album_path = f"{ALBUM_DIR}/{album}" | |
if not os.path.exists(album_path): | |
os.makedirs(album_path) | |
Path(f"{album_path}/{file}").symlink_to(f"{root}/{file}") | |
with open('') as json_manifest: | |
manifest = json.load(json_manifest) | |
for root, subdirs, files in os.walk("._tst"): | |
for file in files: | |
if (file in manifest): | |
for album in manifest[file]: | |
add_to_album(file, root, album) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment