minor bugfixes with lyrics
This commit is contained in:
parent
6c2d4824e1
commit
fbbcd499c5
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
# <div data-lyrics-container="true" class="Lyrics__Container-sc-1ynbvzw-6 YYrds">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)
|
||||
|
@ -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']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user