diff options
author | nil0j <nil.jimeno@estudiant.fjaverianas.com> | 2024-09-26 17:13:42 +0200 |
---|---|---|
committer | nil0j <nil.jimeno@estudiant.fjaverianas.com> | 2024-09-26 17:13:42 +0200 |
commit | 950bb3533cf59e074f485dfbb48fcf931e245ea6 (patch) | |
tree | 23be01e7584d7227451c2c710f1fe1add4dfa499 /scrap/main.py | |
parent | abad2ebad9c78e3978343aa0fc572a87dbf9fa78 (diff) |
update scrap
Diffstat (limited to 'scrap/main.py')
-rw-r--r-- | scrap/main.py | 19 |
1 files changed, 9 insertions, 10 deletions
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 |