Skip to content

Commit

Permalink
Metadata Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
UltimaHoarder committed Nov 9, 2020
1 parent 63d8be2 commit 3c26d4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extras/OFRenamer/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def update(filepath):

def start(metadata_filepath, json_settings):
if os.path.getsize(metadata_filepath) > 0:
metadatas = json.load(open(metadata_filepath, encoding='utf-8'))
metadatas = main_helper.import_archive(metadata_filepath)
metadatas2 = prepare_metadata(metadatas).metadata
model_path = up(up(metadata_filepath))
username = os.path.basename(model_path)
Expand Down
8 changes: 4 additions & 4 deletions helpers/main_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def filter_metadata(datas):


def import_archive(archive_path) -> Any:
metadata = []
metadata = {}
if os.path.exists(archive_path):
with open(archive_path, 'r') as outfile:
with open(archive_path, 'r', encoding='utf-8') as outfile:
metadata = json.load(outfile)
return metadata

Expand All @@ -195,8 +195,8 @@ def export_archive(datas, archive_directory, json_settings, rename=True, legacy_
datas2 = ofrenamer.start(archive_path, json_settings)
if datas == datas2:
return
with open(archive_path, 'w') as outfile:
json.dump(datas, outfile)
with open(archive_path, 'w', encoding='utf-8') as outfile:
json.dump(datas, outfile, indent=2)
# if export_type == "csv":
# archive_path = os.path.join(archive_directory+".csv")
# with open(archive_path, mode='w', encoding='utf-8', newline='') as csv_file:
Expand Down

0 comments on commit 3c26d4a

Please sign in to comment.