summaryrefslogtreecommitdiff
path: root/rust/scripts/populate/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'rust/scripts/populate/api.py')
-rw-r--r--rust/scripts/populate/api.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/rust/scripts/populate/api.py b/rust/scripts/populate/api.py
new file mode 100644
index 0000000..5cc24d3
--- /dev/null
+++ b/rust/scripts/populate/api.py
@@ -0,0 +1,21 @@
+import lyricsgenius
+import parser
+import os
+
+
+genius = lyricsgenius.Genius(
+ "0uSA9UFGsiO2WozVmbWPhyhOoVmUNuM3PXRt9rvWhptHBMgSO5CZBxGUMkwet5mv"
+)
+
+
+def download_albums(albums):
+ [get_album_json(artist[0], album)
+ for artist in albums for album in artist[1]]
+
+
+def get_album_json(artist_name, album_name):
+ if os.path.isfile(parser.getLink(album_name)):
+ return
+
+ album = genius.search_album(album_name, artist_name)
+ album.save_lyrics()