• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python movie.Movie类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testMovieWeekend

	def testMovieWeekend(self):
		m = Movie(121, "Saturday", True, True)

		m.addTicket(20,False)
		price = m.finishPurchase()

		self.assertEquals(price, 17.0)
开发者ID:amreis,项目名称:dojo-ufrgs,代码行数:7,代码来源:testMovie.py


示例2: MovieTest

class MovieTest(unittest.TestCase):
    def setUp(self):
        self.movie = Movie("Test Movie", 5)

    def test_create_movie_get_name_and_rating(self):
        self.assertEqual("Test Movie", self.movie.get_name())
        self.assertEqual(5, self.movie.get_rating())
开发者ID:tblazhev,项目名称:HackBulgaria-Programming101,代码行数:7,代码来源:movie_tests.py


示例3: loadActors

        def loadActors(self, count=100):
                """function to read actors data and create a relationship between actors and movie."""

                actors = self.readArtists("actor", count)
                self.filePointerActors = self.fileHandleActors.tell()

                objActor = Actor("", 0)
                objMovie = Movie("", "", 0)

                for actor in actors:
                        name, title, year = actor
                        
                        # check if actor does not exist else create ID
                        if objActor.getArtistByName(name, self.actorsList) == None:
                                self.artistCounter += 1
                                actorId = self.artistCounter
                                newActor = Actor(actorId, name)
                                self.actorsList.append(newActor)
                                
                                # searches the movie list to check if movies have not been already visualized
                                if not objMovie.doesMovieExist(title, self.moviesList) and \
                                   objMovie.getMovieByName(title, self.moviesList) == None:
                                        self.movieCounter += 1
                                        movieId = self.movieCounter
                                        movie = Movie(movieId, title, year)
                                        self.moviesList.append(movie)

                                        # create relation between actor and  movie
                                        relation = ArtistMovieRelation(actorId, movieId)
                                        self.relationsList.append(relation)
开发者ID:rusheel,项目名称:imdb-data-visualizer,代码行数:30,代码来源:main.py


示例4: loadActresses

        def loadActresses(self, count=100):	
                """function to read actresses data and create a relationship between actress and movie,"""

                # read actresses from file
                actresses = self.readArtists("actress", count)
                self.filePointerActresses = self.fileHandleActresses.tell()
                objActress = Actress("", 0)
                objMovie = Movie("", "", 0)

                for actress in actresses:
                        name, title, year = actress
                        actress = objActress.getArtistByName(name, self.actressesList)

                        # check if actress already not exist then add it
                        if actress == None:
                                self.artistCounter += 1
                                actressId = self.artistCounter
                                newActress = Actress(actressId, name)
                                self.actressesList.append(newActress)
                        else:
                                actressId = actress.getArtistId()

                        # check if movie already exists. only if the movie doesn't exist, it will create an ID and 
                        if not objMovie.doesMovieExist(title, self.moviesList) and \
                           objMovie.getMovieByName(title, self.moviesList) == None:
                                self.movieCounter += 1
                                movieId = self.movieCounter
                                movie = Movie(movieId, title, year)
                                self.moviesList.append(movie)

                                # create relation between actor and  movie
                                relation = ArtistMovieRelation(actressId, movieId)

                                self.relationsList.append(relation)
开发者ID:rusheel,项目名称:imdb-data-visualizer,代码行数:34,代码来源:main.py


示例5: onObjectClick

        def onObjectClick(self, event): 
                """function to get movie details on the movie when clicked."""
                

                tempMovie = Movie(2, 4, "132")
                tempMovie = tempMovie.getMovieByOvalId(event.widget.find_closest(event.x, event.y)[0], self.moviesList)

                # get id's of the artists starring in this movie
                artistmovierelation = ArtistMovieRelation(0,0)
                artistStarring = artistmovierelation.getArtistsByMovieId(tempMovie.getMovieId(), self.relationsList)

                tempActor = Actor("","")
                tempActress = Actress("","")

                # fetches the name of the actor or actress. finds out whether it originated from tbe actor or actress class.

                artistsStartingNames = []
                for artistId in artistStarring:
                        actor = tempActor.getArtistByid(artistId, self.actorsList)
                        if actor != None:
                                artistsStartingNames.append(actor.getArtistName())
                        else:
                                actress = tempActress.getArtistByid(artistId, self.actressesList)
                                if actress != None:
                                        artistsStartingNames.append(actress.getArtistName())

                #  labels to show the film details
                self.movieDetailsVar.set('Title of the Film   : ' + tempMovie.getMovieTitle() + "\n" + "\n" 
                                         "Year Film Released : " + tempMovie.getMovieYear() + "\n"+ "\n" 
                                         "Actor/Actress Name  : " + ", ".join(artistsStartingNames))
开发者ID:rusheel,项目名称:imdb-data-visualizer,代码行数:30,代码来源:main.py


示例6: testGoingWithLotsOfPeopleOnThursday

	def testGoingWithLotsOfPeopleOnThursday(self):
		m = Movie(110, "Thursday", True, True)
		
		for i in range(30):
			m.addTicket(20+i,True)
		
		price = m.finishPurchase()
		self.assertEquals(price,30 * 9)
开发者ID:amreis,项目名称:dojo-ufrgs,代码行数:8,代码来源:testMovie.py


示例7: TestMovieClass

class TestMovieClass(unittest.TestCase):
    def setUp(self):
        self.m = Movie("Best.Movie.Ever.", 2014, 10)

    def test_get_movie_title(self):
        self.assertEqual("Best.Movie.Ever.", self.m.get_title())

    def test_get_movie_year(self):
        self.assertEqual(2014, self.m.get_year())

    def test_get_movie_rating(self):
        self.assertEqual(10, self.m.get_rating())

    @unittest.skip("This works but no point in generating extra movies.")
    def test_save_movie(self):
        self.assertTrue(self.m.save())
开发者ID:EmilianStankov,项目名称:HackBulgaria,代码行数:16,代码来源:test_movie.py


示例8: getMovieInfoByTMDB_ID

 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,代码行数:33,代码来源:tmdb.py


示例9: _loadFactory

    def _loadFactory(self):
        if len(self._plugins) <= 0:
            return

        self._factory = fact.Factory(Movie.getTypeName())
        for plug in self._plugins:
            self._factory.addModule(plug)
开发者ID:uwsbel,项目名称:ChronoRender,代码行数:7,代码来源:movie_factory.py


示例10: TestMovie

class TestMovie(unittest.TestCase):
    """Tests for movie objects"""
    def setUp(self):
        self.movie = Movie('../test.mkv')

    def test_get_extension(self):
        self.assertEqual('.mkv', self.movie.get_extension())

    def test_get_filename(self):
        self.assertEqual('test', self.movie.get_filename())

    def test_get_title(self):
        self.assertEqual(None, self.movie.get_title())

    def test_get_duration(self):
        self.assertEqual('0:21:37', self.movie.get_duration())
开发者ID:EmilianStankov,项目名称:Viridis-Media-Player,代码行数:16,代码来源:movie_tests.py


示例11: load_movies

 def load_movies(self):
     self.cursor.execute("SELECT * FROM movies")
     unparsed_movies = self.cursor.fetchall()
     movies = {}
     if unparsed_movies:
         for unparsed_movie in unparsed_movies:
             #get info from database
             movie_id = unparsed_movie[0]
             title = unparsed_movie[1]
             year = unparsed_movie[2]
             rating = unparsed_movie[3]
             #create a new Movie object and add it to {movie_id: Movie}
             movie = Movie(title, year, rating)
             movie.cast = self.get_actors_in_movie(int(movie_id))
             movies[movie_id] = movie
     return movies
开发者ID:tdhris,项目名称:HackBulgaria,代码行数:16,代码来源:sql_adapter.py


示例12: get_top_movies

    def get_top_movies(self, top_x, min_ratings):
        movie_rows_list = Movie.read_movie_file()

        movie_list_with_min_ratings = []
        for movie in movie_rows_list:
            movie_id = movie[0]
            movie_name = movie[1]

            ratings_list = self.get_movie_rating_list(movie_id)
            # print("movie_id", movie_id)
            # print("ratings", ratings_list)

            if len(ratings_list) >= min_ratings:
                movie_avg_tup = (movie_id, movie_name, self.get_avg_rating(movie_id))
                movie_list_with_min_ratings.append(movie_avg_tup)

        sorted_list = sorted(movie_list_with_min_ratings, key = lambda x: x[2])
        reversed_list = list(reversed(sorted_list))
        # print(sorted_list)
        # print(reversed_list)

        top_x_list = reversed_list[:top_x]
        #print(top_x_list)

        return top_x_list
开发者ID:ArtyomMinsk,项目名称:What_to_Watch,代码行数:25,代码来源:rating.py


示例13: __init__

 def __init__(self, movie_name):
     super(Controller, self).__init__()
     self.session = login()
     self.movie_name = movie_name
     self.movie = Movie(self.movie_name, self.session)
     #self.url = 'http://s.weibo.com/weibo/'
     self.url = 'http://s.weibo.com/wb/'
     self.page_count = 0
开发者ID:ChainBoy,项目名称:WorkFile-Sonidigg,代码行数:8,代码来源:movie_main.py


示例14: find_movie

	def find_movie(self,user_action):
		self.header_output("Finding....")
		print "\n Example: find iron or find Iron Man 3 \n"
		movies = Movie.read_movies_from_file()
		if user_action != []:
			arg    = user_action.pop(0)
			found  = [x for x in movies if self.search(x,arg)]
			self.movie_table_output(found)
开发者ID:salmanhoque,项目名称:MovieApp_python,代码行数:8,代码来源:interface.py


示例15: Controller

class Controller(object):
    """docstring for Controller"""
    def __init__(self, movie_name):
        super(Controller, self).__init__()
        self.session = login()
        self.movie_name = movie_name
        self.movie = Movie(self.movie_name, self.session)

    def start(self):
        start_time = datetime.datetime.strptime(START_TIME, '%Y-%m-%d-%H')
        end_time = datetime.datetime.strptime(END_TIME, '%Y-%m-%d-%H')
        if start_time < end_time:
            while True:
                time.sleep(3)
                cursor_time = start_time + datetime.timedelta(hours=1)
                timescope = datetime.datetime.strftime(start_time, '%Y-%m-%d-%H') +':' + datetime.datetime.strftime(cursor_time, '%Y-%m-%d-%H')
                url = 'http://s.weibo.com/weibo/'+ quote(self.movie_name) +'&timescope=custom:'+ quote(timescope)
                response = self.session.get(url)
                count = self.get_page_count(response.content)
                self.handle_one_page(url, count, self.movie.id)
                start_time = cursor_time
                if start_time > end_time:
                    break
        else:
            print 'ERROR:Start time must early than end time!'

    def get_page_count(self, content):
        max_count = 0
        result = re.findall(r'&page=\d+', content)
        for index in result:
            info = index.split('=')
            if int(info[1]) > max_count:
                max_count = int(info[1])
        print 'max_page:', max_count
        return max_count

    def handle_one_page(self, url_head, page_count, movie_id):
        for i in xrange(1, page_count + 1):
            page = str(i)
            url = url_head +"&page=" + page
            response = self.session.get(url)
            self.movie.decode_content(response.content, movie_id)
            print "现在是第%s页" % page
            time.sleep(3)
开发者ID:ChainBoy,项目名称:WorkFile-Sonidigg,代码行数:44,代码来源:movie_main.py


示例16: add

	def add(self):
		args = []
		self.header_output("Adding....")
		args.append(raw_input("Enter Movie Name: ").strip())
		args.append(raw_input("Enter Release year: ").strip())
		args.append(raw_input("Enter Movie Rating: ").strip())
		if Movie.add_movie_into_file(args):
			print("\nNew movie has been added to your movie list")
		else:
			print("\nSorry File Error!")
开发者ID:salmanhoque,项目名称:MovieApp_python,代码行数:10,代码来源:interface.py


示例17: rename

def rename(filename):
	filename_without_extension = filename
	extension = ""
	
	if os.path.isdir(filename) == False: 
		filename_without_extension, extension = os.path.splitext(filename)
	    
	query = ImdbQuery.create_query_from_filename(filename_without_extension)
	movie = Movie.create_movie_from_imdb_query(query)
	if movie.title == "None":
#		sys.stdout.write("Query Was: " + query + "\n")
		return "None"
		
	return unicode(movie).encode("utf-8") + extension
开发者ID:Phasip,项目名称:Movie-Renamer,代码行数:14,代码来源:movie_renamer.py


示例18: load_movies_run

 def load_movies_run(self, filepaths):
     renaming_rule = utils.preferences.value("renaming_rule").toString()
     # loop on file paths
     for filepath in filepaths:
         # set loading label text, show current file name
         self.ui.label_loading.setText(QApplication.translate('GUI', "Getting information from ")\
                                        + os.path.split(filepath)[1])
         # create a new movie object
         movie = Movie(filepath)
         # generate new movie name based on renaming rule
         movie.generate_new_name(renaming_rule)
         # add movie to list
         self.movies.append(movie)
         # insert a new row in movie table
         self.ui.table_movies.insertRow(self.ui.table_movies.rowCount())
         # create a table item with original movie file name
         item_original_name = QTableWidgetItem(movie.original_file_name())
         item_original_name.setForeground(QBrush(Qt.black))
         self.ui.table_movies.setItem(self.ui.table_movies.rowCount() - 1, 0, item_original_name)
         # create a table item with new movie file name
         item_new_name = QTableWidgetItem(movie.new_file_name())
         item_new_name.setForeground(QBrush(Qt.black))
         self.ui.table_movies.setItem(self.ui.table_movies.rowCount() - 1, 1, item_new_name)
     self.load_movies_finished.emit()
开发者ID:meloi,项目名称:almoviesrenamer,代码行数:24,代码来源:gui.py


示例19: save_to_ndb

def save_to_ndb(movie_dic):
    save_num = 0

    for m in movie_dic:
        if Movie.query(Movie.name_md5 == m['name_md5']).count() == 0:
            Movie(
                    name_md5=m['name_md5'],
                    name=m['name'],
                    content=m['content'],
                    info=m['info'],
                    href=m['href'],
                    is_email='no'
                ).put()
            save_num += 1
            
    return save_num
开发者ID:gh0star,项目名称:movie_spider,代码行数:16,代码来源:fetch.py


示例20: handle_starttag

 def handle_starttag(self, tag, attrs):
     if tag == 'div':
         for attr in attrs:
             if attr[0] == 'class' and attr[1] == 'info':
                 # <div class="info"> starts a new movie entry.
                 self._output_entry = True
                 self._movie = Movie()
                 self._output_entry_finish_tag = tag
     elif self._output_entry:
         if tag == 'li':
             for attr in attrs:
                 if attr[0] == 'class' and attr[1] == 'title':
                     # <li class="title"> includes movie name
                     self._start_movie_name = True
                 elif attr[0] == 'class' and attr[1] == 'intro':
                     # <li class="intro"> includes movie intro
                     self._output_finish_tag = tag
                     self._grab_data = True
                     self._start_intro = True
         elif tag == 'span':
             for attr in attrs:
                 if attr[0] == 'class' and attr[1] == 'date':
                     # <span class="date"> includes movie view date.
                     self._output_finish_tag = tag
                     self._grab_data = True
                     self._start_date = True
                     #TODO
                     # watched list has
                     #     <dev class="info">
                     #       everything
                     #     </dev>
                     # but wish list has
                     #     <dev class="info">
                     #        movie info
                     #     </dev>
                     #     <li>
                     #        entry creation day
                     #     </li>
                 if attr[0] == 'class' and attr[1].find('rating') >= 0:
                     # <span class="ratingX-t"> has rating information.
                     def GetRating(s):
                         return ((s.split('rating'))[1].split('-'))[0]
                     self._movie.set_rating(int(GetRating(attr[1])))
         elif self._start_movie_name and tag == MOVIE_NAME_START_TAG:
             # movie name tag is encountered. Store next data.
             self._output_finish_tag = tag
             self._grab_data = True
开发者ID:halfprice,项目名称:douban-movie,代码行数:47,代码来源:html_parser.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python Clip.Clip类代码示例发布时间:2022-05-27
下一篇:
Python movemodes.clear_selected_clips函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap