def ui_invoke(self): """ Runs authorisation process and invokes the UI. """ try: print(f"{colors.BLUE}Starting auth process...{colors.RESET} \n\n ") self.oauth = self.config.get_oauth() self.token_info = self.oauth.get_access_token(as_dict=True) self.spotify = Spotify(auth=self.token_info["access_token"]) self.init_tray() self.listener_thread.start() self.song_queue = SongQueue() self.image_queue = ImageQueue() self.cache_manager = CacheManager(self.spotify, self.song_queue, self.image_queue) self.spotlight = SpotlightUI(self.spotify, self.song_queue) self.show_spotlight() while True: self.app.exec_() except Exception as ex: print(ex)
def run(self): print(self.config.username) if not self.config.is_valid(): app = QApplication([]) app.setQuitOnLastWindowClosed(True) auth = AuthUI() # ADD TUTORIAL WEBSITE webbrowser.open("https://alfred-spotify-mini-player.com/setup/", 2) while not self.config.is_valid(): auth.show() app.exec_() if auth.isCanceled: sys.exit() try: print("Starting auth process") self.oauth = self.config.get_oauth() self.token_info = self.oauth.get_access_token(as_dict=True) self.spotify = Spotify(auth=self.token_info["access_token"]) self.init_tray() self.listener_thread.start() self.song_queue = SongQueue() self.image_queue = ImageQueue() self.cache_manager = CacheManager(self.spotify, self.song_queue, self.image_queue) self.spotlight = SpotlightUI(self.spotify, self.song_queue) self.show_spotlight() while True: self.app.exec_() except Exception as ex: print(ex)
def __init__(self, addonhandle, addonname, addonbaseurl, parameters, settings): self.addonname = addonname self.baseurl = 'http://www.laola1.tv/' + settings.language( ) + '-' + settings.location() + '/' self.addonhandle = addonhandle self.addonbaseurl = addonbaseurl self.settings = settings self.cacheManager = CacheManager( xbmc.translatePath('special://home/userdata/addon_data/' + self.addonname + '/cache')) self.type = self.get_param(parameters, 'type') self.url = self.get_param(parameters, 'url') id = self.get_param(parameters, 'id') if id is None: self.idParts = [] else: self.idParts = self.split_id_parts(id)
def run(self): print(self.config.username) if not self.config.is_valid(): app = QApplication([]) app.setQuitOnLastWindowClosed(True) auth = AuthUI() # ADD TUTORIAL WEBSITE webbrowser.open("https://alfred-spotify-mini-player.com/setup/", 2) while not self.config.is_valid(): auth.show() app.exec_() if auth.isCanceled: sys.exit() try: print("Starting auth process") # sets up a Spotify username env var which is referenced elsewhere environ["SPOTIFY_USERNAME"] = self.config.username # TODO Change this to something permanent self.oauth = self.config.get_oauth() self.token_info = self.oauth.get_access_token(as_dict=True) SpotifySingleton(self.token_info["access_token"]) # Instantiate Singleton Object self.spotify = SpotifySingleton.get_instance() self.init_tray() self.listener_thread.start() self.song_queue = SongQueue() self.image_queue = ImageQueue() self.cache_manager = CacheManager(self.spotify, self.song_queue, self.image_queue) self.spotlight = SpotlightUI(self.spotify, self.song_queue, self.spotifyclient) self.show_spotlight() while True: self.app.exec_() except Exception as ex: print(ex)