Closed Impre-visible closed 3 years ago
how did u manage to do that?
I do that :
def get_movie(slug):
for film_data in searched_films:
if film_data["slug"] == slug:
return film_data
path = "static/Vu"
film_file_list = os.listdir(path)
film_file_list.sort()
for searched_film in film_file_list:
if not isinstance(searched_film, str):
continue
file_title = searched_film.title()
original_file_title = file_title
size = len(file_title)
file_title = file_title[:size - 4]
try:
search = movie.search(file_title)
except TMDbException:
continue
if not search:
continue
res = search[0]
movie_title = res.title
movie_cover_path = res.poster_path
cover_full_path = f"https://image.tmdb.org/t/p/original{movie_cover_path}"
print(f"titre original : {original_file_title}")
print(f"")
print("titre modifié : "+file_title)
print(f"")
print(f"titre trouvé : {movie_title}")
print(f"")
print(f"lien poster : {cover_full_path}")
print(f"")
print(f"-------------------------")
print(f"")
film_data = {
"title": movie_title,
"cover": cover_full_path,
"slug": original_file_title,
}
searched_films.append(film_data)
Thanks mate!
How can i get only the first title and cover :