Пример #1
0
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
Пример #2
0
 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))
Пример #3
0
 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))
Пример #4
0
 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))
Пример #5
0
 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))
Пример #6
0
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