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


Python Movie.select方法代码示例

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


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

示例1: getMovies

# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def getMovies():
    movies = []

    sel_mov = Movie.select()

    for mov in sel_mov:
        movies.append(mov.__dict__['_data'])

    return jsonify(movies)
开发者ID:EverlessDrop41,项目名称:flask-movie-site,代码行数:11,代码来源:views.py

示例2: handle_data

# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
    def handle_data(self, text):
        if self.break_tag == True:
            return

        if self.start_tag != True or self.tbody_tag != True:
            return

        if self.is_a != True and self.is_td != True:
            return

        movie = self.movies[-1]
        if self.td_index == 0:
            movie.movie_number = text
            print('    processing movie: ' + movie.movie_number)
            if movie.movie_multi_a > 1 and Movie.select().where(Movie.movie_number == movie.movie_number).count() >= 1:
                print('        unique check failed(multi): ' + movie.movie_number)
                movie.movie_status = 'exist'
        elif self.td_index == 1:
            movie.movie_name = text
        elif self.td_index == 2:
            movie.movie_duration = text
        elif self.td_index == 3:
            try:
                movie.movie_release_date = datetime.strptime(text, "%Y-%m-%d").date()
            except ValueError:
                movie.movie_release_date = dt.datetime.fromtimestamp(0).date()

            if movie.movie_release_date == self.last_time:
                if Movie.select().where(Movie.movie_number == movie.movie_number).count() >= 1:
                    print('        unique check failed(last time): ' + movie.movie_number)
                    del self.movies[-1]
                    self.break_tag = True
                    if len(self.movies) == 0:
                        print('******************** no movie update ********************')
            elif movie.movie_release_date < self.last_time:
                print('        unique check failed(last time): ' + movie.movie_number)
                del self.movies[-1]
                self.break_tag = True
                if len(self.movies) == 0:
                    print('******************** no movie update ********************')
        elif self.td_index == 4:
            movie.movie_press = text
开发者ID:liyunhai,项目名称:res-auto,代码行数:44,代码来源:htmlparser.py

示例3: getMovie

# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
def getMovie(id):
    try:
        movie = Movie.select().where(Movie.id == id).dicts().get()
        return jsonify(movie)
    except peewee.DoesNotExist:
        return jsonify({'error': 'Movie not found'})
开发者ID:EverlessDrop41,项目名称:flask-movie-site,代码行数:8,代码来源:views.py

示例4: get_context

# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
 def get_context(self):
     return {
         'movie_list': Movie.select().order_by(Movie.created.desc()).paginate(1, 3)
     }
开发者ID:dommert,项目名称:DangerZone,代码行数:6,代码来源:admin.py

示例5: BeautifulSoup

# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import select [as 别名]
from peewee import *
from models import Movie, Customer, Customer_Movie
import requests
from bs4 import BeautifulSoup
import time

base_url = 'http://www.rottentomatoes.com'

movie_list = Movie.select().where(Movie.fetched == False)

for movie in movie_list:
	url = base_url + movie.href + 'reviews/'
	print movie.name
	print url

	try:
		print "1"
		page = requests.get(url)
		print "2"
		bf = BeautifulSoup(page.content)
		print "3"	
		review_list = bf.find_all('div',{'class','criticinfo'})
		#print "getting " + len(review_list) + " customer info"

		for review in review_list:
			info = review.find('a')
			customer_name = info.text
			customer_href = info.get('href')			 
			print "try to save customer " + customer_name

			try:
开发者ID:bh1091,项目名称:RTBD_Project,代码行数:33,代码来源:movie_to_customer.py


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