def nzo_filtered_by_rating(nzo): if Rating.do and cfg.rating_enable() and cfg.rating_filter_enable() and (nzo.rating_filtered < 2): rating = Rating.do.get_rating_by_nzo(nzo.nzo_id) if rating is not None: nzo.rating_filtered = 1 reason = rating_filtered(rating, nzo.filename.lower(), True) if reason is not None: return (2, reason) reason = rating_filtered(rating, nzo.filename.lower(), False) if reason is not None: return (1, reason) return (0, "")
def nzo_filtered_by_rating(nzo: NzbObject) -> Tuple[int, str]: if cfg.rating_enable() and cfg.rating_filter_enable() and (nzo.rating_filtered < 2): rating = sabnzbd.Rating.get_rating_by_nzo(nzo.nzo_id) if rating is not None: nzo.rating_filtered = 1 reason = rating_filtered(rating, nzo.filename.lower(), True) if reason is not None: return 2, reason reason = rating_filtered(rating, nzo.filename.lower(), False) if reason is not None: return 1, reason return 0, ""