Merge pull request #1 from Landius/master

fix: asset_position undefined, logfile encode
This commit is contained in:
Leon Etienne 2022-04-19 23:59:41 +02:00 committed by GitHub
commit 0d802da7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -67,11 +67,11 @@ try:
# For each asset in the project (might be multiple images)
for asset in assets:
asset_type = asset["asset_type"]
asset_position = asset["position"]
# If the asset is an image
if asset_type == "image":
asset_image_url = asset["image_url"]
asset_position = asset["position"]
# Generate a download filename
filename = artist_directory + slugify(project_name[:60] + "_" + project_hash_id + "_" + str(asset_position)) + "." + extensionFromUrl(asset_image_url)

View File

@ -4,6 +4,7 @@ import time
from pathlib import Path
import re
import os
import codecs
import urllib.request
from headers import *
@ -47,7 +48,7 @@ def logMsg(msg, mode, artist_name):
print(col + f"[{timestamp}][{artist_name}]: " + msg)
# Log to logfile
logfile = open("./logs/" + slugify(artist_name) + ".txt", "a") # Open existing or create
logfile = codecs.open("./logs/" + slugify(artist_name) + ".txt", "a", 'u8') # Open existing or create
logfile.write(prefix + " " + "[" + timestamp + "]: " + msg + "\n")
logfile.close()