示例#1
0
    def get_matches(self, video):
        matches = set()

        # episode
        if isinstance(video, Episode):
            # series
            if video.series and sanitize(self.series) == sanitize(
                    video.series):
                matches.add('series')
            # season
            if video.season and self.season == video.season:
                matches.add('season')
            # episode
            if video.episode and self.episode == video.episode:
                matches.add('episode')
            # guess
            for release in self.releases:
                matches |= guess_matches(video,
                                         guessit(release, {'type': 'episode'}))
        # movie
        elif isinstance(video, Movie):
            # guess
            for release in self.releases:
                matches |= guess_matches(video,
                                         guessit(release, {'type': 'movie'}))

        # title
        if video.title and sanitize(self.title) == sanitize(video.title):
            matches.add('title')

        return matches
示例#2
0
    def get_matches(self, video):
        matches = set()

        # episode
        if isinstance(video, Episode):
            # series
            if video.series and sanitize(self.series) == sanitize(
                    video.series):
                matches.add("series")
            # season
            if video.season and self.season == video.season:
                matches.add("season")
            # episode
            if video.episode and self.episode == video.episode:
                matches.add("episode")
            # guess
            for release in self.releases:
                matches |= guess_matches(video,
                                         guessit(release, {"type": "episode"}))
        # movie
        elif isinstance(video, Movie):
            # guess
            for release in self.releases:
                matches |= guess_matches(video,
                                         guessit(release, {"type": "movie"}))

        # title
        if video.title and sanitize(self.title) == sanitize(video.title):
            matches.add("title")

        return matches
示例#3
0
    def get_matches(self, video):
        """Get matches."""
        # series name
        matches = guess_matches(
            video, {
                'title': self.series,
                'season': self.season,
                'episode': self.episode,
                'episode_title': self.title,
                'year': self.year,
                'release_group': self.version,
            })

        # resolution
        if video.resolution and self.version and video.resolution in self.version.lower(
        ):
            matches.add('resolution')
        # other properties
        if self.version:
            matches |= guess_matches(video,
                                     guessit(self.version,
                                             {'type': 'episode'}),
                                     partial=True)

        return matches
示例#4
0
    def get_matches(self, video: Episode):
        matches = set()

        # series
        if video.series and sanitize(self.series) == sanitize(video.series):
            matches.add('series')
        # season
        if video.season and self.season == video.season:
            matches.add('season')
        # episode
        if video.episode and self.episode == video.episode:
            matches.add('episode')
        # title
        if video.title and sanitize(self.title) == sanitize(video.title):
            matches.add('title')
        # year
        if video.original_series and self.year is None or video.year and video.year == self.year:
            matches.add('year')
        # release_group
        if (video.release_group and self.version and
                any(r in sanitize_release_group(self.version)
                    for r in get_equivalent_release_groups(sanitize_release_group(video.release_group)))):
            matches.add('release_group')
        # resolution
        if video.resolution and self.version and video.resolution in self.version.lower():
            matches.add('resolution')
        # source
        if video.source and self.version and video.source.lower() in self.version.lower():
            matches.add('source')
        # other properties
        matches |= guess_matches(video, guessit(self.version), partial=True)

        return matches
示例#5
0
def test_guess_matches_episode_no_year(episodes):
    video = episodes['dallas_s01e03']
    guess = {
        'title': video.series,
        'season': video.season,
        'episode': video.episode
    }
    expected = {'series', 'season', 'episode', 'year', 'country'}
    assert guess_matches(video, guess) == expected
示例#6
0
def test_guess_matches_movie(movies):
    video = movies['man_of_steel']
    guess = {
        'title': video.title.upper(),
        'year': video.year,
        'release_group': video.release_group.upper(),
        'screen_size': video.resolution,
        'source': video.source,
        'video_codec': video.video_codec,
        'audio_codec': video.audio_codec
    }
    expected = {
        'title', 'year', 'country', 'release_group', 'resolution', 'source',
        'video_codec', 'audio_codec'
    }
    assert guess_matches(video, guess) == expected
示例#7
0
def test_guess_matches_multiple_sources_no_match(episodes):
    video = episodes['bbt_s07e05']
    guess = {
        'title': video.series,
        'season': video.season,
        'episode': video.episode,
        'year': video.year,
        'episode_title': video.title.upper(),
        'release_group': 'LOL',
        'screen_size': video.resolution,
        'source': [video.source, 'Blu-ray'],
        'video_codec': video.video_codec,
        'audio_codec': video.audio_codec
    }
    expected = {
        'series', 'season', 'episode', 'title', 'year', 'country',
        'release_group', 'resolution', 'video_codec', 'audio_codec'
    }
    assert guess_matches(video, guess) == expected
示例#8
0
    def get_matches(self, video: Episode, hearing_impaired=False):
        matches = set()

        # series
        if video.series and sanitize(self.series) == sanitize(video.series):
            matches.add('series')
        # season
        if video.season and self.season == video.season:
            matches.add('season')
        # episode
        if video.episode and self.episode == video.episode:
            matches.add('episode')
        # source
        if video.source and video.source.lower() in self.source.lower():
            matches.add('source')
        if video.year and self.year == video.year:
            matches.add('year')
        if video.series_tvdb_id and self.tvdb_id == video.series_tvdb_id:
            matches.add('series_tvdb_id')

        # other properties
        matches |= guess_matches(video, guessit(self.full_data), partial=True)

        return matches