Exemplo n.º 1
0
def valid_score(release_name, section_name="section_movies"):
    """

    :type release_name: unicode
    :type section_name: unicode
    :return:
    :rtype: bool, None
    """
    release_name = parse_release(release_name)
    if not release_name:
        return None
    try:
        score_min = app.config.get_default(section_name, "score_min", 0, int)
    except (NoOptionError, NoSectionError, ValueError):
        score_min = 0
    try:
        score_max = app.config.get_default(section_name, "score_max", 0, int)
    except (NoOptionError, NoSectionError, ValueError):
        score_max = 0
    if not (score_min and score_max and release_name):
        return False
    try:
        score_votes = app.config.get_default(section_name, "score_votes", 0, int)
    except (NoOptionError, NoSectionError, ValueError):
        score_votes = 0
    if release_name:
        found_score = rating.score(release_name, min_votes=score_votes)
        return bool(found_score)
    return False
Exemplo n.º 2
0
def valid_score(release_info, section_name="section_movie"):
    """ Check services to determine if the release has a score within the
    accepted range defined in the config

    :param section_name: Config section key to use for value lookups
    :param release_info: Release info instance
    :type release_info: ReleaseInfo
    :return: Valid score status
    :rtype: bool
    """
    score_min = app.config.get_default(section_name, "score_min", 0, float)
    score_max = app.config.get_default(section_name, "score_max", 0, float)
    if not (score_min or score_max):
        return None
    score_votes = app.config.get_default(section_name, "score_votes", 0, int)
    found_score = rating.score(release_info.release_title_norm, min_votes=score_votes)
    return bool(found_score)
Exemplo n.º 3
0
def valid_score(release_info, section_name="section_movie"):
    """ Check services to determine if the release has a score within the
    accepted range defined in the config

    :param section_name: Config section key to use for value lookups
    :param release_info: Release info instance
    :type release_info: ReleaseInfo
    :return: Valid score status
    :rtype: bool
    """
    score_min = app.config.get_default(section_name, "score_min", 0, float)
    score_max = app.config.get_default(section_name, "score_max", 0, float)
    if not (score_min or score_max):
        return None
    score_votes = app.config.get_default(section_name, "score_votes", 0, int)
    found_score = rating.score(release_info.release_title_norm,
                               min_votes=score_votes)
    return bool(found_score)
Exemplo n.º 4
0
 def test_score(self):
     self.assertTrue(rating.score(self.title_a) > 2.0)
Exemplo n.º 5
0
 def test_score(self):
     self.assertTrue(rating.score(self.title_a) > 2.0)