def timerCallback(self, timer, data=None): log.debug("timerCallback", data) if data and isinstance(data, dict) and timer: # Episode data available, refactor name and description timer.name = str(refactorTitle(timer.name, data)) timer.description = str(refactorDescription(timer.description, data)) timer.dirname = str(refactorDirectory(timer.dirname or config.usage.default_path.value, data)) timer.calculateFilename() msg = _("Success: %s" % (timer.name)) log.debug(msg) timer.log(610, "[SeriesPlugin]" + " " + msg) if config.plugins.seriesplugin.timer_add_tag.value: timer.tags.append(TAG) elif data: msg = _("Failed: %s." % ( str( data ) )) log.debug(msg) timer.log(611, "[SeriesPlugin]" + " " + msg) SeriesPluginTimer.data.append( str(timer.name) + ": " + msg ) else: msg = _("No data available") log.debug(msg) timer.log(612, "[SeriesPlugin]" + " " + msg) SeriesPluginTimer.data.append( str(timer.name) + ": " + msg ) timer.sp_in_queue = False SeriesPluginTimer.counter = SeriesPluginTimer.counter +1 # Maybe there is a better way to avoid multiple Popups from SeriesPlugin import getInstance instance = getInstance() if instance.thread.empty() and instance.thread.finished(): if SeriesPluginTimer.data: msg = "SeriesPlugin:\n" + _("Timer rename has been finished with %d errors:\n") % (len(SeriesPluginTimer.data)) +"\n" +"\n".join(SeriesPluginTimer.data) log.warning(msg) else: if SeriesPluginTimer.counter > 0: msg = "SeriesPlugin:\n" + _("%d timer renamed successfully") % (SeriesPluginTimer.counter) log.success(msg) SeriesPluginTimer.data = [] SeriesPluginTimer.counter = 0 return timer
def bareShowResult(): global loop_data, loop_counter if loop_data: msg = "SeriesPlugin:\n" + _("Finished with errors:\n") +"\n" +"\n".join(loop_data) log.warning(msg) else: if loop_counter > 0: msg = "SeriesPlugin:\n" + _("Lookup of %d episodes was successful") % (loop_counter) log.success(msg) loop_data = [] loop_counter = 0
def bareShowResult(): global loop_data, loop_counter if loop_data: msg = "SeriesPlugin:\n" + _( "Finished with errors:\n") + "\n" + "\n".join(loop_data) log.warning(msg) else: if loop_counter > 0: msg = "SeriesPlugin:\n" + _( "Lookup of %d episodes was successful") % (loop_counter) log.success(msg) loop_data = [] loop_counter = 0
def renamerCallback(self, servicepath, name, short, data=None): log.debug("renamerCallback", name, data) result = None if data and isinstance(data, dict): result = rename(servicepath, name, short, data) elif data and isinstance(data, basestring): msg = _("Failed: %s." % (str(data))) log.debug(msg) self.data.append(name + ": " + msg) else: msg = _("No data available") log.debug(msg) self.data.append(name + ": " + msg) self.counter = self.counter + 1 # Maybe there is a better way to avoid multiple Popups from SeriesPlugin import getInstance instance = getInstance() if instance.thread.empty() and instance.thread.finished(): if self.data: msg = "SeriesPlugin:\n" + _( "Record rename has been finished with %d errors:\n") % ( len(self.data)) + "\n" + "\n".join(self.data) log.warning(msg) else: if self.counter > 0: msg = "SeriesPlugin:\n" + _( "%d records renamed successfully") % (self.counter) log.success(msg) self.data = [] self.counter = 0
def renamerCallback(self, servicepath, name, short, data=None): log.debug("renamerCallback", name, data) result = None if data and isinstance(data, dict): result = rename(servicepath, name, short, data) elif data and isinstance(data, basestring): msg = _("Failed: %s." % ( str( data ) )) log.debug(msg) self.data.append( name + ": " + msg ) else: msg = _("No data available") log.debug(msg) self.data.append( name + ": " + msg ) self.counter = self.counter +1 # Maybe there is a better way to avoid multiple Popups from SeriesPlugin import getInstance instance = getInstance() if instance.thread.empty() and instance.thread.finished(): if self.data: msg = "SeriesPlugin:\n" + _("Record rename has been finished with %d errors:\n") % (len(self.data)) +"\n" +"\n".join(self.data) log.warning(msg) else: if self.counter > 0: msg = "SeriesPlugin:\n" + _("%d records renamed successfully") % (self.counter) log.success(msg) self.data = [] self.counter = 0