Exemple #1
0
    def perform(self, query):
        self.checkValid(query)
        media = query.find_one(node_type = Media)

        movieMetadata = guess_movie_info(media.filename)
        movieMetadata = guessitToPygoo(movieMetadata)

        # FIXME: this is a temporary hack waiting for the pygoo and ontology refactoring
        if len(tolist(movieMetadata.get('language', None))) > 1:
            movieMetadata['language'] = movieMetadata['language'][0]


        averageConfidence = sum(movieMetadata.confidence(prop) for prop in movieMetadata) / len(movieMetadata)

        # put the result of guessit in a form that smewt understands
        movie = query.Movie(confidence = averageConfidence, **movieMetadata)

        msg = u'Found filename information from %s:' % media.filename
        msg += str(movie).decode('utf-8')
        log.debug(msg)

        result = foundMetadata(query, movie)
        #result.display_graph()

        return result
Exemple #2
0
    def perform(self, query):
        self.checkValid(query)

        media = query.find_one(Media)

        episodeMetadata = guess_episode_info(media.filename)
        episodeMetadata = guessitToPygoo(episodeMetadata)

        averageConfidence = sum(episodeMetadata.confidence(prop) for prop in episodeMetadata) / len(episodeMetadata)

        # put the result of guessit in a form that smewt understands
        series = query.Series(title = episodeMetadata.pop('series'))
        episode = query.Episode(allow_incomplete = True, confidence = averageConfidence, series = series, **episodeMetadata)

        result = foundMetadata(query, episode)
        #result.display_graph()

        return result