Ejemplo n.º 1
0
    def identifier(self):
        if self.metadata is None:
            return None

        if self.identifier_ is None:
            self.identifier_ = Matcher.process(self.metadata)

        return self.identifier_
Ejemplo n.º 2
0
def test_parse():
    cases = [
        ('Show.Name.S05E10-11', [{'season': '05', 'episode_from': '10', 'episode_to': '11'}]),
        ('Show.Name.S05E10E11', [{'season': '05', 'episode': ['10', '11']}]),
        ('Show.Name.5x13', [{'season': '5', 'episode': '13'}])
    ]

    for file_name, expected in cases:
        assert Matcher.parse(file_name) == expected
Ejemplo n.º 3
0
def get_item(key):
    metadata = Metadata.get(key)
    print "metadata:", metadata

    if type(metadata) is Episode:
        guid = Guid.parse(metadata.guid)
        print "guid:", guid

        identifier = Matcher.process(metadata)
        print "identifier:", identifier
Ejemplo n.º 4
0
def get_item(key):
    metadata = Metadata.get(key)
    print "metadata:", metadata

    if type(metadata) is Episode:
        guid = Guid.parse(metadata.guid)
        print "guid:", guid

        identifier = Matcher.process(metadata)
        print "identifier:", identifier
Ejemplo n.º 5
0
    def update_config(cls, valid=None):
        preferences = Dict['preferences'] or {}

        # If no validation provided, use last stored result or assume true
        if valid is None:
            valid = preferences.get('valid', True)

        preferences['valid'] = valid

        Configuration.process(preferences)

        # Ensure preferences dictionary is stored
        Dict['preferences'] = preferences
        Dict.Save()

        # Update plex.metadata.py `Matcher` preferences
        Matcher.set_caper(preferences['matcher'] == 'plex_extended')
        Matcher.set_extend(preferences['matcher'] == 'plex_extended')

        log.info('Preferences updated %s', preferences)
Ejemplo n.º 6
0
    def episodes(cls, episodes):
        result = []

        for episode in episodes:
            _, episodes = Matcher.process(episode)

            for episode_num in episodes:
                result.append({
                    'number': episode_num
                })

        return result