From 950bb3533cf59e074f485dfbb48fcf931e245ea6 Mon Sep 17 00:00:00 2001 From: nil0j Date: Thu, 26 Sep 2024 17:13:42 +0200 Subject: update scrap --- scrap/main.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'scrap/main.py') diff --git a/scrap/main.py b/scrap/main.py index 46d5853..fbed3cd 100644 --- a/scrap/main.py +++ b/scrap/main.py @@ -1,4 +1,4 @@ -from albums import album_list +from albums import album_data import api import parser import database @@ -6,7 +6,7 @@ import database def start(): print("downloading data...") - api.download_albums(album_list) + api.download_albums(album_data) print("uploading data...") database.setup() @@ -25,23 +25,22 @@ def upload_albums(album_data, artist_names): def get_album_data(): - album_data = [] - artist_id = 0 + result = [] - for artist in album_list: - artist_id += 1 + for artist_id, artist in enumerate(album_data, 1): + album_list = artist[1] - for album in artist[1]: - album_data.append(parser.process_json_file(album, artist_id)) + for album_id, album in enumerate(album_list, 1): + result.append(parser.process_json_file(album, album_id, artist_id)) - return album_data + return result def get_artist_names(): artist_data = [] [artist_data.append( artist[0] - ) for artist in album_list] + ) for artist in album_data] return artist_data -- cgit v1.2.3