diff --git a/sabnzbd/api.py b/sabnzbd/api.py index 25e5f9b..6e3e679 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -283,7 +283,8 @@ def _api_queue_rating(output, value, kwargs): audio = setting if type == 'audio' and setting != "-" else None vote = vote_map[setting] if type == 'vote' else None flag = flag_map[setting] if type == 'flag' else None - Rating.do.update_user_rating(value, video, audio, vote, flag, kwargs.get('detail')) + if cfg.rating_enable(): + Rating.do.update_user_rating(value, video, audio, vote, flag, kwargs.get('detail')) return report(output) except: return report(output, _MSG_BAD_SERVER_PARMS) diff --git a/sabnzbd/interface.py b/sabnzbd/interface.py index 7991a3e..f49f163 100644 --- a/sabnzbd/interface.py +++ b/sabnzbd/interface.py @@ -1056,7 +1056,8 @@ class HistoryPage(object): audio = kwargs.get('audio') if kwargs.get('audio') != "-" else None flag = flag_map.get(kwargs.get('rating_flag')) detail = kwargs.get('expired_host') if kwargs.get('expired_host') != '' else None - Rating.do.update_user_rating(kwargs.get('job'), video, audio, flag, detail) + if cfg.rating_enable(): + Rating.do.update_user_rating(kwargs.get('job'), video, audio, flag, detail) except: pass self.__edit_rating = None; diff --git a/sabnzbd/nzbstuff.py b/sabnzbd/nzbstuff.py index a7c6189..a9a5191 100644 --- a/sabnzbd/nzbstuff.py +++ b/sabnzbd/nzbstuff.py @@ -1310,18 +1310,19 @@ class NzbObject(TryList): # Determine if rating information (including site identifier so rating can be updated) # is present in metadata and if so store it def update_rating(self): - try: - def _get_first_meta(type): - values = self.meta.get('x-oznzb-rating-' + type, None) or self.meta.get('x-rating-' + type, None) - return values[0] if values else None - rating_types = ['video', 'videocnt', 'audio', 'audiocnt', 'voteup' ,'votedown', \ - 'spam', 'confirmed-spam', 'passworded', 'confirmed-passworded'] - fields = {} - for k in rating_types: - fields[k] = _get_first_meta(k) - Rating.do.add_rating(_get_first_meta('id'), self.nzo_id, self.meta.get('x-rating-host'), fields) - except: - pass + if cfg.rating_enable(): + try: + def _get_first_meta(type): + values = self.meta.get('x-oznzb-rating-' + type, None) or self.meta.get('x-rating-' + type, None) + return values[0] if values else None + rating_types = ['video', 'videocnt', 'audio', 'audiocnt', 'voteup' ,'votedown', \ + 'spam', 'confirmed-spam', 'passworded', 'confirmed-passworded'] + fields = {} + for k in rating_types: + fields[k] = _get_first_meta(k) + Rating.do.add_rating(_get_first_meta('id'), self.nzo_id, self.meta.get('x-rating-host'), fields) + except: + pass ## end nzo.Mutators ####################################################### ########################################################################### diff --git a/sabnzbd/postproc.py b/sabnzbd/postproc.py index d2fd541..f3082de 100644 --- a/sabnzbd/postproc.py +++ b/sabnzbd/postproc.py @@ -489,13 +489,14 @@ def process_job(nzo): all_ok = all_ok and not empty ## Update indexer with results - if nzo.encrypted > 0: - Rating.do.update_auto_flag(nzo.nzo_id, Rating.FLAG_ENCRYPTED) - if empty: - hosts = map(lambda s: s.host, sabnzbd.downloader.Downloader.do.nzo_servers(nzo)) - if not hosts: hosts = [None] - for host in hosts: - Rating.do.update_auto_flag(nzo.nzo_id, Rating.FLAG_EXPIRED, host) + if cfg.rating_enable(): + if nzo.encrypted > 0: + Rating.do.update_auto_flag(nzo.nzo_id, Rating.FLAG_ENCRYPTED) + if empty: + hosts = map(lambda s: s.host, sabnzbd.downloader.Downloader.do.nzo_servers(nzo)) + if not hosts: hosts = [None] + for host in hosts: + Rating.do.update_auto_flag(nzo.nzo_id, Rating.FLAG_EXPIRED, host) ## Show final status in history if all_ok: