コード例 #1
0
ファイル: backend.py プロジェクト: HF0/spotifylyrics
def load_lyrics(artist, song, sync=False):
    global current_service

    if current_service == len(services_list2) - 1: current_service = -1

    if sync == True:
        lyrics, url, service_name, timed = s._minilyrics(artist, song)
        current_service = -1

    if sync == True and not lyrics_found(lyrics) or sync == False:
        timed = False
        for i in range(current_service + 1, len(services_list2)):
            lyrics, url, service_name = services_list2[i](artist, song)
            current_service = i
            if lyrics_found(lyrics):
                lyrics = lyrics.replace("&", "&").replace("`", "'").strip()
                break

    #return "Error: Could not find lyrics."  if the for loop doens't find any lyrics
    return (lyrics, url, service_name, timed)
コード例 #2
0
ファイル: backend.py プロジェクト: fr31/spotifylyrics
def load_lyrics(artist, song, sync=False):
    error = "Error: Could not find lyrics."
    global current_service

    if current_service == len(services_list2)-1: current_service = -1

    if sync == True:
        lyrics, url, service_name, timed = s._minilyrics(artist, song)
        current_service = -1

    if sync == True and lyrics == error or sync == False:
        timed = False
        for i in range (current_service+1, len(services_list2)):
            lyrics, url, service_name = services_list2[i](artist, song)
            current_service = i
            if lyrics != error:
                lyrics = lyrics.replace("&", "&").replace("`", "'").strip()
                break

    #return "Error: Could not find lyrics."  if the for loop doens't find any lyrics
    return(lyrics, url, service_name, timed)
コード例 #3
0
        song = result['item']['name']  # song name

        song_id = result['item']['id']  # song's unique id

        artist = result['item']['artists'][0][
            'name']  # only get the first artist

        album = result['item']['album']['name']  # alubm name

        # convert the Full width quote to Half width quote
        # in my case, Taylor Swift's "Don't blame me" was "Don’t blame me", so the minilyrics can't find its lyrics
        song = song.replace('’', '\'')
        artist = artist.replace('’', '\'')

        # get lyrics with timestamps from MiniLyrics
        lyrics, url, service_name, timed = s._minilyrics(artist, song)
        # error message in lyrics if can't get lyrics
        error = "Error: Could not find lyrics."

        if lyrics != error:
            timeline, lrc = s.lyricSplit(lyrics)

        while (is_daemon):
            # update status because search lyrics may take a while
            result = sp.current_playback()

            is_playing = result['is_playing']

            progress_ms = result['progress_ms']

            print(