Created
February 14, 2021 15:09
-
-
Save LewisGet/5f7cfec90c0e5f1a7c031131064385aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 shutil | |
import json | |
import os | |
with open(os.path.sep.join(["indexes", "1.12.json"])) as json_file: | |
data = json.load(json_file) | |
for k, v in data['objects'].items(): | |
name = os.path.sep.join((os.path.splitext(k)[0]).split("/")) | |
path = os.path.sep.join(os.path.dirname(name).split("/")) | |
ext = os.path.splitext(k)[1] | |
if os.path.splitext(k)[1] == ".ogg": | |
os.makedirs(path, exist_ok=True) | |
find_dir = "".join(list(v['hash'])[0:2]) | |
hash_file = os.path.sep.join(["objects", find_dir, v['hash']]) | |
shutil.copy(hash_file, os.path.sep.join([name + ext])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment