From 9479bd4ffadcf53924c390a0a48f949814d38f61 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Tue, 11 Jun 2013 19:51:03 +0200 Subject: [PATCH] Attempt to fix MAL updater crashing syncplay gui --- syncplay/client.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index 1ca833b..3733105 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -466,17 +466,20 @@ class MalUpdater(object): self._lastHookUpdate = None def _updateMal(self): - self._fileDuration = 0 # Disable playingHook - if(libMal and self._filename and self.__username and self.__password): - manager = libMal.Manager(self.__username, self.__password) - results = manager.findEntriesOnMal(self._filename) - if(len(results) > 0): - result = results[0] - message = "Updating MAL with: \"{}\", episode: {}".format(result.mainTitle, result.episodeBeingWatched) - self._ui.showMessage(message) - options = {"tags": ["syncplay"]} - manager.updateEntryOnMal(result, options) - self._filename = "" # Make sure no updates will be performed until switch + try: + self._fileDuration = 0 # Disable playingHook + if(libMal and self._filename and self.__username and self.__password): + manager = libMal.Manager(self.__username, self.__password) + results = manager.findEntriesOnMal(self._filename) + if(len(results) > 0): + result = results[0] + message = "Updating MAL with: \"{}\", episode: {}".format(result.mainTitle, result.episodeBeingWatched) + reactor.callFromThread(self._ui.showMessage,(message),) + options = {"tags": ["syncplay"]} + manager.updateEntryOnMal(result, options) + self._filename = "" # Make sure no updates will be performed until switch + except: + reactor.callFromThread(self._ui.showMessage, ("MAL Update failure"),) class SyncplayUserlist(object): def __init__(self, ui, client):