diff --git a/plugins/torrent/deluge_ b/plugins/torrent/deluge_ index cad4312b..f584fc93 100644 --- a/plugins/torrent/deluge_ +++ b/plugins/torrent/deluge_ @@ -256,16 +256,13 @@ class StatClient: def on_one_torrent_info(self, value, torrent_id): log.debug("Got torrent info : {0} -> {1}".format(torrent_id, value)) - if 'state' in value: - state = value['state'] - else: - state = "Error" + state = value.get("state", "Error") - if not (state in self.states): + if state not in self.states: log.warn("State '{0}' is unknown !".format(state)) state = "Other" - self.states[state] = self.states[state] + 1 + self.states[state] += 1 def on_all_torrent_info_fetched(self, res): log.debug("on_all_torrent_info_fetched : {0}".format(self.states)) @@ -390,7 +387,7 @@ if len(sys.argv) > 1: print('Deluge Torrent Munin plugin, version {0}'.format( plugin_version)) sys.exit(0) - elif action != "": + elif action: log.warn("Unknown argument '{0}'".format(action)) sys.exit(1) else: