A Python program which parses the data in the coblob database and transforms into a format which the co-data project can use. One of the main goals of this project is to reduce the load on the CPU in the co-data project. https://www.craigoates.net/Software/project/17
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

44 lines
1.4 KiB

#!/usr/bin/python3
import requests
from datetime import datetime
from services import art_services, data_services
from pathlib import Path
def main():
# 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")
if __name__ == "__main__":
main()