diff --git a/src/__main__.py b/src/__main__.py index 571ca3f..2ba65fb 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -77,8 +77,8 @@ def get_genre(): return genre -def cli(start_at: int = 0): - if start_at <= 2: +def cli(start_at: int = 0, only_lyrics: bool = False): + if start_at <= 2 and not only_lyrics: genre = get_genre() logging.info(f"{genre} has been set as genre.") @@ -89,15 +89,15 @@ def cli(start_at: int = 0): metadata_downloader = MetadataDownloader() metadata_downloader.download({'type': search.type, 'id': search.id}) - if start_at <= 1: + if start_at <= 1 and not only_lyrics: logging.info("creating Paths") url_to_path.UrlPath(genre=genre) - if start_at <= 2: + if start_at <= 2 and not only_lyrics: logging.info("Fetching Download Links") download_links.Download() - if start_at <= 3: + if start_at <= 3 and not only_lyrics: logging.info("starting to download the mp3's") download.Download() @@ -107,4 +107,4 @@ def cli(start_at: int = 0): if __name__ == "__main__": - cli(start_at=0) + cli(start_at=0, only_lyrics=True) diff --git a/src/lyrics/genius.py b/src/lyrics/genius.py index bb9ba86..e4d7a5f 100644 --- a/src/lyrics/genius.py +++ b/src/lyrics/genius.py @@ -19,7 +19,7 @@ session.headers = { } session.proxies = proxies -logger = logging.getLogger("genius") +logger = GENIUS_LOGGER class Song: @@ -80,8 +80,8 @@ class Song: if len(lyrics_soups) != 1: logger.warning(f"number of lyrics_soups doesn't equals 1, but {len(lyrics_soups)} on {self.url}") - lyrics_soup = lyrics_soups[0] - lyrics = lyrics_soup.getText(separator="\n", strip=True) + lyrics = "\n".join([lyrics_soup.getText(separator="\n", strip=True) for lyrics_soup in lyrics_soups]) + print(lyrics) #
With the soundle self.lyrics = lyrics @@ -166,6 +166,6 @@ if __name__ == "__main__": print(song.fetch_lyrics()) """ - songs = search("Psychonaut 4", "Sana-sana-sana - Cura-cura-cura") + songs = search("Zombiez", "WALL OF Z") for song in songs: print(song) diff --git a/src/lyrics_.py b/src/lyrics_.py index 64cbc5c..89df530 100644 --- a/src/lyrics_.py +++ b/src/lyrics_.py @@ -1,7 +1,7 @@ from mutagen.id3 import ID3, USLT from metadata import database as db -import logging -import os + +from src.utils.shared import * from lyrics import genius from src.utils.shared import * @@ -44,7 +44,9 @@ def get_lyrics(file_name): def fetch_single_lyrics(row: dict): - file_ = os.path.join(os.path.expanduser('~/Music'), row['file']) + if "file" in row: + return + file_ = os.path.join(MUSIC_DIR, row['file']) artist = row['artists'][0]['name'] track = row['title']