Ejemplo n.º 1
0
    def filter(certification: Certification) -> bool:
        '''
        Checks whether a film's certification is within the configured
        allowable range of certifications. The configurable settings
        are:
            The maximum age/maturity of a film allowed.
            Are unrated films allowed.
            Are Not-Yet-Rated films allowed (for new/pre-release trailers).

        :param certification:
        :return:
        '''
        passed = False
        #
        maximum_allowed_certification = Settings.get_rating_limit_setting()

        # if Rating._logger.isEnabledFor(LazyLogger.DEBUG_EXTRA_VERBOSE):
        #    Rating._logger.enter('rating:', rating, 'limit:', maximum_allowed_certification)

        if maximum_allowed_certification == Certification.UNRATED_RANK:
            # All films are allowed
            passed = True
        elif certification.get_rank() <= maximum_allowed_certification:
            passed = True
        elif certification.get_rank() == Certification.NOT_YET_RATED_RANK:
            passed = True

        return passed
    def get_rating_limit_string_from_setting(self):
        # type: () ->  str
        """

        :return:
        """
        rating_limit = Settings.get_rating_limit_setting()
        # return TmdbSettings._rating_limit_string_for_setting[rating_limit]
        return 'R'