summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scrap/api.py10
-rw-r--r--scrap/main.py9
2 files changed, 12 insertions, 7 deletions
diff --git a/scrap/api.py b/scrap/api.py
index af83bb7..5cc24d3 100644
--- a/scrap/api.py
+++ b/scrap/api.py
@@ -1,4 +1,6 @@
import lyricsgenius
+import parser
+import os
genius = lyricsgenius.Genius(
@@ -7,9 +9,13 @@ genius = lyricsgenius.Genius(
def download_albums(albums):
- [get_album_json(artist[0], album) for artist in albums for album in artist[1]]
+ [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)
- return album.save_lyrics()
+ album.save_lyrics()
diff --git a/scrap/main.py b/scrap/main.py
index 72a9929..eda213a 100644
--- a/scrap/main.py
+++ b/scrap/main.py
@@ -5,11 +5,10 @@ import database
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!")
+ print("downloading data...")
+ api.download_albums(album_data)
+ print("uploading data...")
database.setup()
upload_albums(
get_album_data(),
@@ -17,7 +16,7 @@ def start():
)
database.close()
print("upload finished!")
- print("remember to move the covers directory once you're done!")
+ print("remember to move the covers directory once you're done")
def upload_albums(album_data, artist_names):