def __init__(self, artist, song_name): self.url = ArgumentParser(artist, song_name).buildURL() self.content = Content(self.url) self.formatter = Formatter(self.content.data, song_name) try: self.lyrics = '\n'.join(map(str, self.formatter.getFormatedContent())) except AttributeError: self.lyrics = None return None
class Lyrics(object): logging.basicConfig(format='%(name)s.%(funcName)s:%(lineno)d --- %(levelname)s: %(message)s --- %(asctime)s') logger = logging.getLogger(__name__) def __init__(self, artist, song_name): self.url = ArgumentParser(artist, song_name).buildURL() self.content = Content(self.url) self.formatter = Formatter(self.content.data, song_name) try: self.lyrics = '\n'.join(map(str, self.formatter.getFormatedContent())) except AttributeError: self.lyrics = None return None def getLyrics(self): if (Validator.checkConnection() and Validator.handleRequirements()) is True: return self.lyrics