summaryrefslogtreecommitdiff
path: root/scrap/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'scrap/main.py')
-rw-r--r--scrap/main.py53
1 files changed, 42 insertions, 11 deletions
diff --git a/scrap/main.py b/scrap/main.py
index 80f4d24..72a9929 100644
--- a/scrap/main.py
+++ b/scrap/main.py
@@ -1,18 +1,49 @@
-import lyricsgenius
-import sys
+from albums import album_data
+import api
+import parser
+import database
-def getAlbum(artist_name, album_name):
- genius = lyricsgenius.Genius(
- "0uSA9UFGsiO2WozVmbWPhyhOoVmUNuM3PXRt9rvWhptHBMgSO5CZBxGUMkwet5mv"
+def start():
+ print("do you want to download the json data from genius? [y, n] ", end="")
+ if input().lower() == "y":
+ api.download_albums(album_data)
+ print("download finished!")
+
+ database.setup()
+ upload_albums(
+ get_album_data(),
+ get_artist_names()
)
- album = genius.search_album(artist_name, album_name)
- album.save_lyrics()
+ database.close()
+ print("upload finished!")
+ print("remember to move the covers directory once you're done!")
+
+
+def upload_albums(album_data, artist_names):
+ database.process_artists(artist_names)
+ database.process_albums(album_data)
+
+
+def get_album_data():
+ album_data = []
+ artist_id = 0
+
+ for artist in album_data:
+ artist_id += 1
+
+ for album in artist[1]:
+ album_data.append(parser.process_json_file(album, artist_id))
+
+ return album_data
-def getJsonLyrics(link):
- for key, value in data.items():
- print(key, value)
+def get_artist_names():
+ artist_data = []
+ [artist_data.append(
+ artist[0]
+ ) for artist in album_data]
+ return artist_data
-getJsonLyrics(sys.argv[1])
+start()