Fix missing links and removal of trash data
This commit is contained in:
parent
2cbea8c226
commit
f7aa3da4b0
239 changed files with 88 additions and 996 deletions
21
scripts/utils/files.py
Normal file
21
scripts/utils/files.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import os
|
||||
import yaml
|
||||
|
||||
|
||||
# TODO: Consider not writing these values to the file and rather keeping track in runtime
|
||||
def remove_trash_references(file_path):
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
data = yaml.safe_load(f)
|
||||
data.pop("trash_id", None)
|
||||
data.pop("trash_scores", None)
|
||||
|
||||
|
||||
def clean_files(dirs):
|
||||
for dir in dirs:
|
||||
for root, _, files in os.walk(dir):
|
||||
for filename in files:
|
||||
if not filename.endswith(".yaml"):
|
||||
continue
|
||||
|
||||
file_path = os.path.join(root, filename)
|
||||
remove_trash_references(file_path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue