From 688e6bf30c1a35a68efce71fcaaca0a65f332e54 Mon Sep 17 00:00:00 2001 From: codey Date: Tue, 14 Jan 2025 11:15:20 -0500 Subject: [PATCH] reorder var definitions after try for consistency --- lyric_search_new/sources/cache.py | 4 ++-- lyric_search_new/sources/genius.py | 4 ++-- lyric_search_new/sources/lrclib.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lyric_search_new/sources/cache.py b/lyric_search_new/sources/cache.py index 27db659..da3ba94 100644 --- a/lyric_search_new/sources/cache.py +++ b/lyric_search_new/sources/cache.py @@ -47,9 +47,9 @@ class Cache: Returns: - LyricsResult corresponding to nearest match found (if found), **None** otherwise """ - artist = artist.strip().lower() - song = song.strip().lower() try: + artist = artist.strip().lower() + song = song.strip().lower() logging.info("Searching %s - %s on %s", artist, song, self.label) async with sqlite3.connect(self.cache_db, timeout=2) as db_conn: diff --git a/lyric_search_new/sources/genius.py b/lyric_search_new/sources/genius.py index de07a90..7c4cea4 100644 --- a/lyric_search_new/sources/genius.py +++ b/lyric_search_new/sources/genius.py @@ -38,10 +38,10 @@ class Genius: @song: the song to search """ try: - logging.info("Searching %s - %s on %s", - artist, song, self.label) artist = artist.strip().lower() song = song.strip().lower() + logging.info("Searching %s - %s on %s", + artist, song, self.label) search_term = f'{artist}%20{song}' returned_lyrics = '' async with ClientSession() as client: diff --git a/lyric_search_new/sources/lrclib.py b/lyric_search_new/sources/lrclib.py index de6d560..564e655 100644 --- a/lyric_search_new/sources/lrclib.py +++ b/lyric_search_new/sources/lrclib.py @@ -33,11 +33,11 @@ class LRCLib: @artist: the artist to search @song: the song to search """ - try: - logging.info("Searching %s - %s on %s", - artist, song, self.label) + try: artist = artist.strip().lower() song = song.strip().lower() + logging.info("Searching %s - %s on %s", + artist, song, self.label) returned_lyrics = '' async with ClientSession() as client: async with client.get(self.lrclib_url,