def spotifyLabelClick(p1): if Spotify().isSpotifyPlaying: song = Spotify().currentSong l = Genius.getLyrics(song.title, song.artist) print(l) destroy_window() input("\n\n\n\n\tPremi invio per uscire") sys.stdout.flush()
def __init__(self, settings): log.debug("__init__") threading.Thread.__init__(self) self.stopping = False self.settings = settings self.spotify = Spotify.Spotify() self.spotify.login(settings.get("spotify_user"), settings.get("spotify_pass")) self.play_thread = None self.pause_thread = None self.resume_thread = None self.stop_thread = None
from Spotify import * import sys import string def doSearch(search_term): print(search_term, end='') this_result = json.loads(s.trackSearch(search_term)) success = True if this_result['num_results'] == 0: success = False return this_result, success s = Spotify() punct = re.sub('\'', '', string.punctuation) phrase = ' '.join(sys.argv[1:]) phrase = re.sub('[' + punct + ']', '', phrase) words = phrase.split(' ') res = [] i = len(words) - 1 idx_last_added = -1 need_to_pop = False added_post_word = False search_term = '' while i >= 0: this_result = [] # start with the last single word search_term = words[i]
import Spotify import Matching import MediaMonkey spotify = Spotify.Spotify() media_monkey = MediaMonkey.MediaMonkey() def find_match_for_album(local_album): if not local_album.name: return None search_results = list( spotify.search_album(local_album.name + ' ' + local_album.artist)) if len(search_results) == 0: search_results = list(spotify.search_album(local_album.name)) return Matching.best_match(search_results, [ Matching.text_matcher(lambda input: input.name, local_album.name, 100), Matching.text_matcher(lambda input: input.first_artist, local_album.artist, 50) ], 100) def find_track_matches_for_album_tracks(local_album): album = find_match_for_album(local_album) if album: album_tracks = list(spotify.get_album_tracks(album.spotify_uri)) for local_track in local_album.tracks: if not local_track.spotify_uri: best_match = Matching.best_match(album_tracks, [ Matching.text_matcher(lambda input: input.name, local_track.name, 100),
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' top.geometry("404x200+775+335") top.title("Get Lyrics") top.configure(background="#212121") top.configure(highlightcolor="black") self.btnGo = Button(top) self.btnGo.place(relx=0.77, rely=0.25, height=49, width=79) self.btnGo.configure(activebackground="#d9d9d9") self.btnGo.configure(background="#212121") self.btnGo.configure(borderwidth="0") self.btnGo.configure(foreground="#ffffff") self.btnGo.configure(text='''Vai!''') self.btnGo.bind( '<Button-1>', lambda e: lyrics_support.btnGoClick( e, self.txtTitle, self.txtArtist)) self.txtArtist = Entry(top) self.txtArtist.place(relx=0.1, rely=0.2, height=21, relwidth=0.53) self.txtArtist.configure(background="#424242") self.txtArtist.configure(borderwidth="0") self.txtArtist.configure(font="TkFixedFont") self.txtArtist.configure(foreground="#ffffff") self.txtArtist.configure(selectbackground="#c4c4c4") self.labelArtist = Label(top) self.labelArtist.place(relx=0.07, rely=0.05, height=21, width=39) self.labelArtist.configure(activebackground="#424242") self.labelArtist.configure(activeforeground="white") self.labelArtist.configure(activeforeground="#ffffff") self.labelArtist.configure(background="#212121") self.labelArtist.configure(foreground="#ffffff") self.labelArtist.configure(text='''Artist''') self.txtTitle = Entry(top) self.txtTitle.place(relx=0.1, rely=0.45, height=21, relwidth=0.53) self.txtTitle.configure(background="#424242") self.txtTitle.configure(borderwidth="0") self.txtTitle.configure(font="TkFixedFont") self.txtTitle.configure(foreground="#ffffff") self.txtTitle.configure(selectbackground="#c4c4c4") self.labelTitle = Label(top) self.labelTitle.place(relx=0.07, rely=0.35, height=19, width=31) self.labelTitle.configure(activebackground="#f9f9f9") self.labelTitle.configure(background="#212121") self.labelTitle.configure(borderwidth="0") self.labelTitle.configure(foreground="#ffffff") self.labelTitle.configure(text='''Title''') self.labelSpotify = Label(top) self.labelSpotify.place(relx=0.02, rely=0.7, height=60, width=379) self.labelSpotify.configure(activebackground="#f9f9f9") self.labelSpotify.configure(background="#212121") self.labelSpotify.configure(foreground="#ffffff") self.labelSpotify.bind('<Button-1>', lambda e: lyrics_support.spotifyLabelClick(e)) if Spotify.Spotify().isSpotifyPlaying: s = Spotify.Spotify().currentSong output = f"Stai ascoltando:\n{s.title} di {s.artist}.\nClicca qui per avere il testo" self.labelSpotify.configure(text=output)
import argparse from Spotify import * from WikiData import * wikidata = WikiData() spotify = Spotify() def suggestions(query): name = query.title() print('Fetching suggestions for: ') print(name) artists = spotify.search(name) return artists
except: try: with HiddenPrints(): return cls.api.search_song( title.split("feat")[0], artist).lyrics except: try: with HiddenPrints(): return cls.api.search_song( title.split("ft.")[0], artist).lyrics except: pass return "Lyrics not found :/" if __name__ == "__main__": import Spotify as sp songToFind = sp.Song("", "") try: args = parser.parse_args() if args is not None: if args.artist is not None: songToFind.artist = args.artist[0] if args.title is not None: songToFind.title = args.title[0] if songToFind.artist == "" and songToFind.title == "": songToFind = sp.Spotify().currentSong except: pass print(Genius.getLyrics(songToFind.title, songToFind.artist))