Skip to content

Commit

Permalink
Use patched version of Genius API by default
Browse files Browse the repository at this point in the history
  • Loading branch information
patkub committed Oct 28, 2024
1 parent 0181826 commit 6d90902
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions songs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
load_dotenv()


def process_song(song, artist, access_keys, experimental):
def process_song(song, artist, access_keys, genius_patch):
"""
Fetch song lyrics, translate to English, and display original and English side-by-side lyrics.
@param song: the name of the song
@param artist: the name of the artist
@param access_keys: dictionary of API access keys
@param experimental: use experimental features
@param genius_patch: use patched version of Genius api
"""
#
# Fetch song lyrics from Genius
#
patched_genius = PatchedGenius if experimental else None
patched_genius = PatchedGenius if genius_patch else None
lyrics_fetcher = FetchLyrics(access_keys["GENIUS_ACCESS_TOKEN"], patched_genius)
song_info = lyrics_fetcher.fetch_lyrics(song, artist)
if song_info is None:
Expand Down Expand Up @@ -60,9 +60,10 @@ def process_song(song, artist, access_keys, experimental):

parser = argparse.ArgumentParser()
parser.add_argument("song", nargs="+")
parser.add_argument('--experimental',
parser.add_argument('--genius-patch',
action=argparse.BooleanOptionalAction,
help='Enable experimental features.\nUses a patched version of Genius API')
default=True,
help='Use patched version of Genius API')
args = parser.parse_args()

song = args.song[0]
Expand All @@ -78,4 +79,4 @@ def process_song(song, artist, access_keys, experimental):
# Fetch song lyrics, translate to English, and display original and English side-by-side lyrics.
#

process_song(song, artist, access_keys, args.experimental)
process_song(song, artist, access_keys, args.genius_patch)

0 comments on commit 6d90902

Please sign in to comment.