當前位置: 首頁>>代碼示例>>Python>>正文


Python Movie.create_movie_from_imdb_query方法代碼示例

本文整理匯總了Python中movie.Movie.create_movie_from_imdb_query方法的典型用法代碼示例。如果您正苦於以下問題:Python Movie.create_movie_from_imdb_query方法的具體用法?Python Movie.create_movie_from_imdb_query怎麽用?Python Movie.create_movie_from_imdb_query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在movie.Movie的用法示例。


在下文中一共展示了Movie.create_movie_from_imdb_query方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: rename

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
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,代碼行數:16,代碼來源:movie_renamer.py

示例2: test_create_movie_from_query_dots_and_hyphens

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
 def test_create_movie_from_query_dots_and_hyphens(self):
     LOTR_2 = Movie.create_movie_from_imdb_query('lord.of.rings-two.towers')
     self.assertEqual(LOTR_2, 
                 Movie("The Lord of the Rings: The Two Towers", 2002))
開發者ID:Phasip,項目名稱:Movie-Renamer,代碼行數:6,代碼來源:movie_tests.py

示例3: test_create_movie_from_query_no_spaces

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
 def test_create_movie_from_query_no_spaces(self):
     the_dark_knight = Movie.create_movie_from_imdb_query('TheDarkKnight')
     self.assertEqual(the_dark_knight, Movie("The Dark Knight", 2008))
開發者ID:Phasip,項目名稱:Movie-Renamer,代碼行數:5,代碼來源:movie_tests.py

示例4: test_create_movie_from_query_partial_title

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
 def test_create_movie_from_query_partial_title(self):
     the_matrix = Movie.create_movie_from_imdb_query('matrix')
     self.assertEqual(the_matrix, Movie("The Matrix", 1999))
開發者ID:Phasip,項目名稱:Movie-Renamer,代碼行數:5,代碼來源:movie_tests.py

示例5: test_create_movie_from_query_exact_title

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
 def test_create_movie_from_query_exact_title(self):
     the_prestige = Movie.create_movie_from_imdb_query('the prestige')
     self.assertEqual(the_prestige, Movie("The Prestige", 2006))
開發者ID:Phasip,項目名稱:Movie-Renamer,代碼行數:5,代碼來源:movie_tests.py

示例6: rename

# 需要導入模塊: from movie import Movie [as 別名]
# 或者: from movie.Movie import create_movie_from_imdb_query [as 別名]
def rename(filename):
    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)
    return str(movie) + extension
開發者ID:gaurav2793,項目名稱:Movie-Renamer,代碼行數:7,代碼來源:movie_renamer.py


注:本文中的movie.Movie.create_movie_from_imdb_query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。