コード例 #1
0
ファイル: test_trakt.py プロジェクト: BackSlasher/Flexget
    def test_search_results(self, execute_task):
        task = execute_task('test_search_results')
        entry = task.entries[0]
        assert entry['movie_name'].lower() == 'Harry Potter and The Philosopher\'s Stone'.lower(), 'lookup failed'
        with Session() as session:
            assert len(session.query(TraktMovieSearchResult).all()) == 1, 'should have added one movie to search result'

            # change the search query
            session.query(TraktMovieSearchResult).update({'search': "harry.potter.and.the.philosopher's"})
            session.commit()

            lookupargs = {'title': "harry.potter.and.the.philosopher's"}
            movie = ApiTrakt.lookup_movie(**lookupargs)

            assert movie.imdb_id == entry['imdb_id']
            assert movie.title.lower() == entry['movie_name'].lower()
コード例 #2
0
 def get(self, title, session=None):
     args = lookup_parser.parse_args()
     include_actors = args.pop('include_actors')
     include_translations = args.pop('include_translations')
     kwargs = args
     kwargs['title'] = title
     try:
         movie = at.lookup_movie(session=session, **kwargs)
     except LookupError as e:
         return {'status': 'error', 'message': e.args[0]}, 404
     result = movie.to_dict()
     if include_actors:
         result["actors"] = list_actors(movie.actors)
     if include_translations:
         result["translations"] = get_translations(movie.translate)
     return jsonify(result)
コード例 #3
0
 def get(self, title, session=None):
     args = lookup_parser.parse_args()
     include_actors = args.pop('include_actors')
     include_translations = args.pop('include_translations')
     kwargs = args
     kwargs['title'] = title
     try:
         movie = at.lookup_movie(session=session, **kwargs)
     except LookupError as e:
         raise NotFoundError(e.args[0])
     result = movie.to_dict()
     if include_actors:
         result['actors'] = list_actors(movie.actors)
     if include_translations:
         result['translations'] = get_translations_dict(movie.translations, 'movie')
     return jsonify(result)
コード例 #4
0
    def test_search_results(self, execute_task):
        task = execute_task('test_search_results')
        entry = task.entries[0]
        assert entry['movie_name'].lower() == 'Harry Potter and The Philosopher\'s Stone'.lower(), 'lookup failed'
        with Session() as session:
            assert len(session.query(TraktMovieSearchResult).all()) == 1, 'should have added one movie to search result'

            # change the search query
            session.query(TraktMovieSearchResult).update({'search': "harry.potter.and.the.philosopher's"})
            session.commit()

            lookupargs = {'title': "harry.potter.and.the.philosopher's"}
            movie = ApiTrakt.lookup_movie(session=session, **lookupargs)

            assert movie.imdb_id == entry['imdb_id']
            assert movie.title.lower() == entry['movie_name'].lower()
コード例 #5
0
 def get(self, title, session=None):
     """Trakt movie lookup"""
     args = lookup_parser.parse_args()
     include_actors = args.pop('include_actors')
     include_translations = args.pop('include_translations')
     kwargs = args
     kwargs['title'] = title
     try:
         movie = at.lookup_movie(session=session, **kwargs)
     except LookupError as e:
         raise NotFoundError(e.args[0])
     result = movie.to_dict()
     if include_actors:
         result['actors'] = list_actors(movie.actors)
     if include_translations:
         result['translations'] = get_translations_dict(movie.translations, 'movie')
     return jsonify(result)
コード例 #6
0
ファイル: trakt_lookup.py プロジェクト: Davst/Flexget
 def get(self, title, session=None):
     args = lookup_parser.parse_args()
     include_actors = args.pop('include_actors')
     include_translations = args.pop('include_translations')
     kwargs = args
     kwargs['title'] = title
     try:
         movie = at.lookup_movie(session=session, **kwargs)
     except LookupError as e:
         return {'status': 'error',
                 'message': e.args[0]
                 }, 404
     result = movie.to_dict()
     if include_actors:
         result["actors"] = list_actors(movie.actors)
     if include_translations:
         result["translations"] = get_translations(movie.translate)
     return jsonify(result)