当前位置: 首页>>代码示例>>Python>>正文


Python Movie.select方法代码示例

本文整理汇总了Python中movie.Movie.select方法的典型用法代码示例。如果您正苦于以下问题:Python Movie.select方法的具体用法?Python Movie.select怎么用?Python Movie.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在movie.Movie的用法示例。


在下文中一共展示了Movie.select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getMovieInfoByTMDB_ID

# 需要导入模块: from movie import Movie [as 别名]
# 或者: from movie.Movie import select [as 别名]
 def getMovieInfoByTMDB_ID(self, tmdb_id=''):
     self.domain = 'movie'
     self.action = 'getInfo'
     if tmdb_id:
         self.tmdb_id = tmdb_id
     
     try:    
         movie_list = Movie.select(Movie.q.tmdb_id==self.tmdb_id)
         if movie_list.count() == 1:
             oMovie = movie_list[0]
         elif movie_list.count() == 0:
             raise SQLObjectNotFound
         else:
             raise AttributeError
     except SQLObjectNotFound:
     
         self.url = "%s%s" % (self.urls.generateURL(self.domain, self.action), self.tmdb_id)        
         self.movie_info = self._getResponse(self.url)
                 
         oMovie = Movie(tmdb_id = self._getKey('id', 0),
                        imdb_id = self._getKey('imdb_id', ''),
                        title = self._getKey('name', ''),
                        year = int(self._getYearFromDate(self._getKey('released', ''))),
                        genre = self._getPrimaryGenre(self._getKey('genres', [])),
                        mpaa = Movie.ratings.index(self._getKey('certification', 'NR')),
                        director = self._getDirector(self._getKey('cast', [])),
                        actors = self._getPrimaryActors(self._getKey('cast', [])),
                        description = self._getKey('overview', ''),
                        length = int(self._getKey('runtime', 0)),
                        poster_URL = self._getPosterURL(self._getKey('posters', '')),
                        )
     
     return oMovie
开发者ID:toddself,项目名称:Movie-Info,代码行数:35,代码来源:tmdb.py

示例2: getMovieIDByName

# 需要导入模块: from movie import Movie [as 别名]
# 或者: from movie.Movie import select [as 别名]
    def getMovieIDByName(self, name):
        self.domain = 'movie'
        self.action = 'search'
        self.searchTerm = quote_plus(name)
        
        try:
            movie_list = Movie.select("""movie.title LIKE '%s'""" % name)
            if movie_list.count() == 1:
                self.tmdb_id = movie_list[0].tmdb_id
            else:
                raise SQLObjectNotFound
        except SQLObjectNotFound:
            self.url = "%s%s" % (self.urls.generateURL(self.domain, self.action), self.searchTerm)

            movie_info = self._getResponse(self.url)
            self.tmdb_id = movie_info['id']
        
        return self.tmdb_id
开发者ID:toddself,项目名称:Movie-Info,代码行数:20,代码来源:tmdb.py


注:本文中的movie.Movie.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。