fix: asset_position undefined, logfile encode
This commit is contained in:
parent
9394b7860f
commit
59e1f72ea2
@ -67,11 +67,11 @@ try:
|
|||||||
# For each asset in the project (might be multiple images)
|
# For each asset in the project (might be multiple images)
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
asset_type = asset["asset_type"]
|
asset_type = asset["asset_type"]
|
||||||
|
asset_position = asset["position"]
|
||||||
|
|
||||||
# If the asset is an image
|
# If the asset is an image
|
||||||
if asset_type == "image":
|
if asset_type == "image":
|
||||||
asset_image_url = asset["image_url"]
|
asset_image_url = asset["image_url"]
|
||||||
asset_position = asset["position"]
|
|
||||||
|
|
||||||
# Generate a download filename
|
# Generate a download filename
|
||||||
filename = artist_directory + slugify(project_name[:60] + "_" + project_hash_id + "_" + str(asset_position)) + "." + extensionFromUrl(asset_image_url)
|
filename = artist_directory + slugify(project_name[:60] + "_" + project_hash_id + "_" + str(asset_position)) + "." + extensionFromUrl(asset_image_url)
|
||||||
|
3
util.py
3
util.py
@ -4,6 +4,7 @@ import time
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import codecs
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from headers import *
|
from headers import *
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ def logMsg(msg, mode, artist_name):
|
|||||||
print(col + f"[{timestamp}][{artist_name}]: " + msg)
|
print(col + f"[{timestamp}][{artist_name}]: " + msg)
|
||||||
|
|
||||||
# Log to logfile
|
# 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.write(prefix + " " + "[" + timestamp + "]: " + msg + "\n")
|
||||||
logfile.close()
|
logfile.close()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user