Closed htilly closed 4 years ago
tmdbsimple supports these movie lists:
Would you like to contribute code and unit tests for get lists?
Easy way to manage seen movies...
def getmovie(genres=878, votecount=800, averagescore=5.5, fromdate='1970-01-01', page=500):
listof=[]
discover = tmdb.Discover()
kwargs = {'page': page, 'vote_count.gte': votecount, 'vote_average.gte': averagescore, 'release_date.gte': fromdate, 'with_genres': genres}
response = discover.movie(**kwargs)
pageint = discover.total_pages
for i in range(1, pageint+1):
kwargs = {'page': i, 'vote_count.gte': votecount, 'vote_average.gte': averagescore, 'release_date.gte': fromdate, 'with_genres': genres}
response = discover.movie(**kwargs)
numofres = len(discover.results)
for p in range(1, numofres): listof.append(discover.results[p]['id'])
if len(listof) > 0:
num = random.randint(0, len(listof))
with open("/home/icbosk/Programs/Videospider/list.txt", 'r') as f:
content = f.readlines()
content = [x.strip() for x in content]
if str(listof[num-1]) in content:
getmovie()
else:
with open("/home/icbosk/Programs/Videospider/list.txt", 'a') as f: f.write(str(str(listof[num-1])+"\n"))
return (listof[num-1])
else:
print("No movie found! Change parameters!")
sys.exit()
tmdbsimple
currently implements TMDB v3, where lists of movies are supported. See https://developers.themoviedb.org/3/lists/get-list-details.
When TMDB v4 is implemented per #63, lists of both movies and TV series will be supported. See https://developers.themoviedb.org/4/list/get-list.
import tmdbsimple as tmdb
tmdb.API_KEY = '<your api key>'
SESSION_ID = '<your session id>'
kwargs = {
'name': 'My List',
'description': 'My list of movies',
}
lst = tmdb.Lists(session_id=SESSION_ID)
lst.list_create(**kwargs)
lst.info()
{'created_by': 'celiao',
'description': 'My list of movies',
'favorite_count': 0,
'id': '7054530',
'items': [],
'item_count': 0,
'iso_639_1': 'en',
'name': 'My List',
'poster_path': None}
THE_MATRIX = 603
lst.add_item(media_id=THE_MATRIX)
lst.info()
{'created_by': 'celiao',
'description': 'My list of movies',
'favorite_count': 0,
'id': '7054530',
'items': [{'poster_path': '/f89U3ADr1oiB1s9GkdPOEpXUk5H.jpg',
'popularity': 36.618,
'vote_count': 17524,
'video': False,
'media_type': 'movie',
'id': 603,
'adult': False,
'backdrop_path': '/ByDf0zjLSumz1MP1cDEo2JWVtU.jpg',
'original_language': 'en',
'original_title': 'The Matrix',
'genre_ids': [28, 878],
'title': 'The Matrix',
'vote_average': 8.1,
'overview': 'Set in the 22nd century, The Matrix tells the story of a computer hacker who joins a group of underground insurgents fighting the vast and powerful computers who now rule the earth.',
'release_date': '1999-03-30'}],
'item_count': 1,
'iso_639_1': 'en',
'name': 'My List',
'poster_path': None}
Does it support get lists? For both Movies and TV Shows? I.e. my saved watchlists?
https://developers.themoviedb.org/3/lists/get-list-details