コード例 #1
0
ファイル: episodetvdb.py プロジェクト: robmcmullen/smewt
    def perform(self, query):
        self.checkValid(query)
        self.query = query

        ep = query.find_one(Episode)

        log.debug('EpisodeTvdb: finding more info on %s' % ep)
        if ep.get('series') is None:
            raise SmewtException("EpisodeTVDB: Episode doesn't contain 'series' field: %s" % ep)

        # little hack: if we have no season number, add 1 as default season number
        # (helps for series which have only 1 season)
        if ep.get('season') is None:
            ep.season = 1

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startEpisode(ep)

        except SmewtException, e:
            # series could not be found, return a dummy Unknown series instead so we can group them somewhere
            log.warning('Could not find series for file: %s' % query.find_one(Media).filename)
            noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')
            result = MemoryObjectGraph()
            result.Series(title = 'Unknown', loresImage = noposter, hiresImage = noposter)
コード例 #2
0
ファイル: movietmdb.py プロジェクト: robmcmullen/smewt
    def perform(self, query):
        self.checkValid(query)

        log.debug('MovieTvdb: finding more info on %s' % query.find_one(Movie))
        movie = query.find_one(Movie)

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startMovie(movie.title)
        except SmewtException, e:
            # movie could not be found, return a dummy Unknown movie instead so we can group them somewhere
            log.warning('Could not find info for movie: %s' % toUtf8(query.find_one(Media).filename))
            noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')
            result = MemoryObjectGraph()
            result.Movie(title = 'Unknown', loresImage = noposter, hiresImage = noposter)
コード例 #3
0
    def perform(self, query):
        self.checkValid(query)

        log.debug('MovieTvdb: finding more info on %s' % u(query.find_one(Movie)))
        movie = query.find_one(Movie)

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startMovie(movie.title)
        except SmewtException:
            # movie could not be found, return a dummy Unknown movie instead so we can group them somewhere
            log.warning('Could not find info for movie: %s' % u(query.find_one(Media).filename))
            noposter = '/static/images/noposter.png'
            result = MemoryObjectGraph()
            result.Movie(title = 'Unknown', loresImage = noposter, hiresImage = noposter)

        result = foundMetadata(query, result.find_one(Movie))
        return result
コード例 #4
0
ファイル: movietmdb.py プロジェクト: EQ4/smewt
    def perform(self, query):
        self.checkValid(query)

        log.debug("MovieTvdb: finding more info on %s" % u(query.find_one(Movie)))
        movie = query.find_one(Movie)

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startMovie(movie.title)
        except SmewtException:
            # movie could not be found, return a dummy Unknown movie instead so we can group them somewhere
            log.warning("Could not find info for movie: %s" % u(query.find_one(Media).filename))
            noposter = "/static/images/noposter.png"
            result = MemoryObjectGraph()
            result.Movie(title="Unknown", loresImage=noposter, hiresImage=noposter)

        result = foundMetadata(query, result.find_one(Movie))
        return result
コード例 #5
0
ファイル: episodetvdb.py プロジェクト: cantikhuna68/smewt
    def perform(self, query):
        self.checkValid(query)
        self.query = query

        ep = query.find_one(Episode)

        log.debug('EpisodeTvdb: finding more info on %s' % ep)
        if ep.get('series') is None:
            raise SmewtException(
                "EpisodeTVDB: Episode doesn't contain 'series' field: %s" % ep)

        # little hack: if we have no season number, add 1 as default season number
        # (helps for series which have only 1 season)
        if ep.get('season') is None:
            ep.season = 1

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startEpisode(ep)

        except SmewtException:
            # series could not be found, return a dummy Unknown series instead
            # so we can group them somewhere
            log.warning('Could not find series for file: %s' %
                        query.find_one(Media).filename)
            noposter = '/static/images/noposter.png'
            result = MemoryObjectGraph()
            result.Series(title='Unknown',
                          loresImage=noposter,
                          hiresImage=noposter)

        # update the series
        query.delete_node(ep.series.node)
        ep.series = query.add_object(
            result.find_one(Series))  # this add_object should be unnecessary

        series = ep.series
        # and add all the potential episodes
        for found_ep in result.find_all(Episode):
            data = {'series': series}
            data.update(found_ep.literal_items())
            ep = query.Episode(**data)

        return query
コード例 #6
0
ファイル: episodetvdb.py プロジェクト: EQ4/smewt
    def perform(self, query):
        self.checkValid(query)
        self.query = query

        ep = query.find_one(Episode)

        log.debug('EpisodeTvdb: finding more info on %s' % ep)
        if ep.get('series') is None:
            raise SmewtException("EpisodeTVDB: Episode doesn't contain 'series' field: %s" % ep)

        # little hack: if we have no season number, add 1 as default season number
        # (helps for series which have only 1 season)
        if ep.get('season') is None:
            ep.season = 1

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startEpisode(ep)

        except SmewtException:
            # series could not be found, return a dummy Unknown series instead
            # so we can group them somewhere
            log.warning('Could not find series for file: %s' % query.find_one(Media).filename)
            noposter = '/static/images/noposter.png'
            result = MemoryObjectGraph()
            result.Series(title = 'Unknown', loresImage=noposter, hiresImage=noposter)

        # update the series
        query.delete_node(ep.series.node)
        ep.series = query.add_object(result.find_one(Series)) # this add_object should be unnecessary

        series = ep.series
        # and add all the potential episodes
        for found_ep in result.find_all(Episode):
            data = { 'series': series }
            data.update(found_ep.literal_items())
            ep = query.Episode(**data)


        return query