2022-04-07 13:53:09 +02:00
|
|
|
#!/bin/python3
|
2022-01-30 03:38:53 +01:00
|
|
|
import yaml
|
|
|
|
import os
|
|
|
|
|
2022-01-30 21:02:18 +01:00
|
|
|
with open("to-grab.yaml", "r") as yamlfile:
|
2022-01-30 03:38:53 +01:00
|
|
|
try:
|
|
|
|
config = yaml.safe_load(yamlfile)
|
|
|
|
|
2022-01-30 21:02:18 +01:00
|
|
|
# Grab artists
|
|
|
|
if "artists" in config:
|
|
|
|
for artist in config["artists"]:
|
|
|
|
print(f"\033[92mGrabbing artist '{artist}'")
|
|
|
|
os.system(f"python3 grab-artist.py '{artist}'")
|
|
|
|
|
|
|
|
# Grab search results
|
|
|
|
if "searches" in config:
|
|
|
|
for search in config["searches"]:
|
|
|
|
print(f"\033[92mGrabbing search results for '{search['terms']}'")
|
|
|
|
|
|
|
|
max_results = ""
|
|
|
|
if "max" in search:
|
|
|
|
max_results = search["max"]
|
|
|
|
|
|
|
|
os.system("python3 grab-search.py '" + search['terms'] + "' " + str(max_results))
|
2022-01-30 03:38:53 +01:00
|
|
|
|
|
|
|
except yaml.YAMLError as exc:
|
|
|
|
print("You fucked up the yaml format.")
|