def performSelfTest(): try: from bs4 import BeautifulSoup except: utilities.log( True, "Failed to import BeautifulSoup. This grabber requires python-bs4") sys.exit(1) found = False lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ lyrics.artist = 'Dire Straits' lyrics.album = 'Brothers In Arms' lyrics.title = 'Money For Nothing' fetcher = LyricsFetcher() found = fetcher.get_lyrics(lyrics) if found: utilities.log(True, "Everything appears in order.") buildLyrics(lyrics) sys.exit(0) utilities.log(True, "The lyrics for the test search failed!") sys.exit(1)
def performSelfTest(): try: import taglib except: utilities.log( True, "Failed to import taglib. This grabber requires " "pytaglib ? TagLib bindings for Python. " "https://github.com/supermihi/pytaglib") sys.exit(1) found = False lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ lyrics.artist = 'Robb Benson' lyrics.album = 'Demo Tracks' lyrics.title = 'Lone Rock' lyrics.filename = os.path.dirname( os.path.abspath(__file__)) + '/examples/taglyrics.mp3' fetcher = LyricsFetcher() found = fetcher.get_lyrics(lyrics) if found: utilities.log(True, "Everything appears in order.") sys.exit(0) utilities.log(True, "The lyrics for the test search failed!") sys.exit(1)
def main(): global debug parser = OptionParser() parser.add_option('-v', "--version", action="store_true", default=False, dest="version", help="Display version and author") parser.add_option('-t', "--test", action="store_true", default=False, dest="test", help="Test grabber with a know good search") parser.add_option('-s', "--search", action="store_true", default=False, dest="search", help="Search for lyrics.") parser.add_option('-a', "--artist", metavar="ARTIST", default=None, dest="artist", help="Artist of track.") parser.add_option('-b', "--album", metavar="ALBUM", default=None, dest="album", help="Album of track.") parser.add_option('-n', "--title", metavar="TITLE", default=None, dest="title", help="Title of track.") parser.add_option('-f', "--filename", metavar="FILENAME", default=None, dest="filename", help="Filename of track.") parser.add_option('-d', '--debug', action="store_true", default=False, dest="debug", help=("Show debug messages")) opts, args = parser.parse_args() lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ if opts.debug: debug = True if opts.version: buildVersion() if opts.test: performSelfTest() if opts.artist: lyrics.artist = opts.artist if opts.album: lyrics.album = opts.album if opts.title: lyrics.title = opts.title if opts.filename: lyrics.filename = opts.filename fetcher = LyricsFetcher() if fetcher.get_lyrics(lyrics): buildLyrics(lyrics) sys.exit(0) else: utilities.log(True, "No lyrics found for this track") sys.exit(1)
def performSelfTest(): found = False lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ lyrics.artist = 'Dire Straits' lyrics.album = 'Brothers In Arms' lyrics.title = 'Money For Nothing' fetcher = LyricsFetcher() found = fetcher.get_lyrics(lyrics) if found: utilities.log(True, "Everything appears in order.") sys.exit(0) utilities.log(True, "The lyrics for the test search failed!") sys.exit(1)
def performSelfTest(): found = False lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ lyrics.artist = 'Dagon' lyrics.album = 'Terraphobic' lyrics.title = 'Cut To The Heart' fetcher = LyricsFetcher() found = fetcher.get_lyrics(lyrics) if found: utilities.log(True, "Everything appears in order.") sys.exit(0) utilities.log(True, "The lyrics for the test search failed!") sys.exit(1)
def performSelfTest(): found = False lyrics = utilities.Lyrics() lyrics.source = __title__ lyrics.syncronized = __syncronized__ lyrics.artist = 'Robb Benson' lyrics.album = 'Demo Tracks' lyrics.title = 'Lone Rock' lyrics.filename = os.path.dirname(os.path.abspath(__file__)) + '/examples/taglyrics.mp3' fetcher = LyricsFetcher() found = fetcher.get_lyrics(lyrics) if found: utilities.log(True, "Everything appears in order.") sys.exit(0) utilities.log(True, "The lyrics for the test search failed!") sys.exit(1)