Feat/import gdrp data (#26)

* Some simple code for extracting data from the jsons

* Jupiter Notebook

* Mac specific gitignore

* Fixed finding paths to floders

* Delete src/gdpr_data directory

* Updated gitignore to include my testing file

* Added the standard saving path for the database in the database handler, this way multiple files dont have to be updated when moving database position

* Moved the API usage wrappers into an own file, added a function for getting multiple track_ids at once, this still needs to be tested more

* Further code for extracting data from the gdpr files

* Forgor

* Final&Tested version of get_multiple_tracks_information endpoint

* Further functionality: The code now extracts the id of each listened song and makes a api call to get info about these songs via the multiple tracks api. Furthermore we track the songs witch the call is made for already and skip these

* Added function to map catalouged ids into the play history

* Added args parser to runtime program, cleaned up some code

* Fixed a bug where the database would always try to create tables, eaven if it exists

* Added some small text for clean interface

* Some final fixes to actual code, fixed db bug, reversed the order of database entries

* Some documentation

* Added -export args to docker runtime

* fix
This commit is contained in:
Dominik
2025-03-23 18:48:57 +01:00
committed by GitHub
parent 535225392f
commit ff9d726b47
11 changed files with 412 additions and 90 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
import logging as log
import os
import sqlite3
from enum import Enum
DATABASE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'spotify_scraped.db')
class Table(Enum):
TRACK_INFORMATION = "track_information"
@@ -16,7 +19,7 @@ class Database:
A class to handle the database connection and operations
"""
def __init__(self, db_name):
def __init__(self, db_name: str = DATABASE_PATH):
"""Initialize the connection to the database"""
self.db_name = db_name
self.conn = sqlite3.connect(db_name)