def scrobble(): time_elapsed = int( time.mktime( datetime.utcnow().timetuple())) - self.time_started if(time_elapsed > 120): try: BDD.network.scrobble(self.artist, self.title, int(self.time_started)) if len(BDD.network_cache) > 0: for tup in BDD.network_cache: BDD.network.scrobble(tup[0], tup[1], tup[2]) BDD.network_cache = [] BDD.saveCache() # update cache except: BDD.network_cache.append((self.artist, self.title, int(self.time_started)))
def closeEvent(self, e): from data.bdd import BDD BDD.saveCache() if 'music' in self.loadedModules: self.playerWidget.stop() self.queueManager.saveState() if 'videos' in self.loadedModules: self.managers['videos'].elementViewer.stop() settings.set_option('gui/maximized', self.maximized) settings.MANAGER.save() settings.MANAGER.saveTimer.cancel() print 'Good bye'