Add additional methods to fetch lyrics

The following inputs can now be used to fetch lyrics:
* artist and track names
* search query
* direct url
This commit is contained in:
Ritiek Malhotra
2020-04-08 21:43:58 +05:30
parent 51da0b7a29
commit 47247f7250
7 changed files with 210 additions and 76 deletions

View File

@@ -12,16 +12,23 @@ class LyricBase(ABC):
"""
@abstractmethod
def __init__(self, artist, track):
"""
This method must set any protected attributes,
which may be modified from outside the class
if the need arises.
"""
pass
@abstractmethod
def get_lyrics(self, linesep="\n", timeout=None):
def from_url(self, url, linesep="\n", timeout=None):
"""
This method must return the lyrics string for the
given track.
"""
pass
@abstractmethod
def from_artist_and_track(self, artist, track, linesep="\n", timeout=None):
"""
This method must return the lyrics string for the
given track.
"""
pass
@abstractmethod
def from_query(self, query, linesep="\n", timeout=None):
"""
This method must return the lyrics string for the
given track.