|
|
|
@ -3,27 +3,42 @@
|
|
|
|
|
import requests |
|
|
|
|
from datetime import datetime |
|
|
|
|
from services import art_services, data_services |
|
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
raw_art_data = data_services.get_json("https://api.craigoates.net/api/1.0/Artwork") |
|
|
|
|
cd_totals = art_services.get_creation_date_totals(raw_art_data) |
|
|
|
|
print(cd_totals) |
|
|
|
|
cat_totals = art_services.get_db_column_totals(raw_art_data, "category") |
|
|
|
|
print(cat_totals) |
|
|
|
|
med_totals = art_services.get_db_column_totals(raw_art_data, "medium") |
|
|
|
|
print(med_totals) |
|
|
|
|
width_totals = art_services.get_dimension_totals(raw_art_data, "dimensions", "width") |
|
|
|
|
print(width_totals) |
|
|
|
|
height_totals = art_services.get_dimension_totals(raw_art_data, "dimensions", "height") |
|
|
|
|
print(height_totals) |
|
|
|
|
depth_totals = art_services.get_dimension_totals(raw_art_data, "dimensions", "depth") |
|
|
|
|
print(depth_totals) |
|
|
|
|
# The intention is for this to be accessible from other projects. |
|
|
|
|
directory = str(f"{Path.home()}/coblob-data") |
|
|
|
|
|
|
|
|
|
raw_art_data = data_services.get_json( |
|
|
|
|
"https://api.craigoates.net/api/1.0/Artwork") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_creation_date_totals(raw_art_data), |
|
|
|
|
f"{directory}/art_creation_dates.json") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_db_column_totals(raw_art_data, "category"), |
|
|
|
|
f"{directory}/art_category_totals.json") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_db_column_totals(raw_art_data, "medium"), |
|
|
|
|
f"{directory}/art_medium_total.json") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_dimension_totals(raw_art_data, "dimensions", "width"), |
|
|
|
|
f"{directory}/art_width_totals.json") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_dimension_totals(raw_art_data, "dimensions", "height"), |
|
|
|
|
f"{directory}/art_height_totals.json") |
|
|
|
|
|
|
|
|
|
data_services.store_json( |
|
|
|
|
art_services.get_dimension_totals(raw_art_data, "dimensions", "depth"), |
|
|
|
|
f"{directory}/art_depth_totals.json") |
|
|
|
|
|
|
|
|
|
# Use for console priting for the moment. |
|
|
|
|
date = datetime.now().strftime('%d/%m/%Y') |
|
|
|
|
time = datetime.now().strftime("%H:%M") |
|
|
|
|
|
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
main() |
|
|
|
|