-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
61 lines (51 loc) · 2.05 KB
/
config.py
File metadata and controls
61 lines (51 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ===== USER CONFIGS =====
DEBUG_FLAG = False
ALBUM_TILE_SIZE = 50
CSV_PATH = "CSVNAME.csv"
INPUT_IMAGE_NAME = "IMGNAME.png"
# If you want less colorful album covers, set this to True and adjust the threshold
GREYSCALE_FLAG = True
SATURATION_THRESHOLD = 17 # 0-255, lower means more strict
# Blending original image in
BLEND_FINAL = False
BLEND_ALPHA = 0.2 #percent of how much original img is blended in (0 to 1)
# ONLY WORKS IF BLEND_FINAL IS TRUE
# ADVANCED CONFIGS (optional, normally dont need to change)
# They set up time limits for requests, etc
SLEEP_TIME = 0.05
TIMEOUT_SECONDS = 5
# Number of album covers to ignore from raw album data to make pixel to album mapping be more accurate
K_DELETION = 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# DONT CHANGE BELOW THIS LINE unless u read the code :)
INPUT_IMAGE_PATH = "input/" + INPUT_IMAGE_NAME
OUTPUT_IMAGE_PATH = "output/" + INPUT_IMAGE_NAME
TRIMMED_CSV_PATH = "final.csv"
# CSV HEADERS
SPOTIFY_CSV_HEADERS = [
"Track URI", "Track Name", "Album Name", "Artist Name(s)",
"Release Date", "Duration (ms)", "Popularity", "Explicit",
"Added By", "Added At", "Genres", "Record Label",
"Danceability", "Energy", "Key", "Loudness", "Mode",
"Speechiness", "Acousticness", "Instrumentalness",
"Liveness", "Valence", "Tempo", "Time Signature"
]
# CSV LABELS, used for generating pseudo-unique album keys
TRACK_URI_LABEL = "Track URI"
ALBUM_NAME_LABEL = "Album Name"
FIRST_ARTIST_NAME_LABEL = "Artist Name(s)"
# Folder to store album covers
ALBUM_DATA_FOLDER = "albumCovers"
# Headers to mimic a real browser request
# LLM assistance for this part, I've never worked with request headers before
HEADERS = {
"User-Agent": (
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/120.0.0.0 Safari/537.36"
),
"Accept": "image/avif,image/webp,image/apng,image/*,*/*;q=0.8",
"Referer": "https://open.spotify.com/",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
}