Call debug statements when fetching lyrics

This commit is contained in:
Ritiek Malhotra
2020-05-18 16:28:10 +05:30
parent 9795d7e9b8
commit 85c12a91ef

View File

@@ -81,6 +81,7 @@ class Genius(LyricBase):
""" """
encoded_query = urllib.request.quote(query.replace(" ", "+")) encoded_query = urllib.request.quote(query.replace(" ", "+"))
search_url = self.base_search_url + encoded_query search_url = self.base_search_url + encoded_query
logger.debug('Fetching Genius search results from "{}".'.format(search_url))
metadata = self._fetch_search_page(search_url) metadata = self._fetch_search_page(search_url)
lyric_url = None lyric_url = None
@@ -105,6 +106,7 @@ class Genius(LyricBase):
Returns the lyric string for the track best matching the Returns the lyric string for the track best matching the
given query. given query.
""" """
logger.debug('Fetching lyrics for the search query on "{}".'.format(query))
try: try:
lyric_url = self.best_matching_lyric_url_from_query(query) lyric_url = self.best_matching_lyric_url_from_query(query)
except LyricsNotFoundError: except LyricsNotFoundError:
@@ -127,6 +129,7 @@ class Genius(LyricBase):
""" """
Returns the lyric string for the given URL. Returns the lyric string for the given URL.
""" """
logger.debug('Fetching lyric text from "{}".'.format(url))
lyric_html_page = self._fetch_url_page(url, timeout=timeout) lyric_html_page = self._fetch_url_page(url, timeout=timeout)
lyrics = self._get_lyrics_text(lyric_html_page) lyrics = self._get_lyrics_text(lyric_html_page)
return lyrics.replace("\n", linesep) return lyrics.replace("\n", linesep)