def main(): list_id = trakt.get_list_id('My Collection') # update list description trakt.put_oauth_request('users/me/lists/{0}'.format(list_id), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') }) time.sleep(0.5) list_id_rw = trakt.get_list_id('Radarr Watchlist') # update list description trakt.put_oauth_request('users/me/lists/{0}'.format(list_id_rw), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') }) time.sleep(0.5) radarr_collection, radarr_collection_rw = get_radarr_collection() trakt_collection = get_trakt_collection(list_id) trakt_collection_rw = get_trakt_collection(list_id_rw) post_data_add = [] post_data_remove = [] radarr_collection_ord = OrderedDict(sorted(radarr_collection.items(), key=lambda x: x[1], reverse=True)) for imdb in trakt_collection: post_data_remove.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint(trakt.post_oauth_request('users/me/lists/{0}/items/remove'.format(list_id), data={'movies': post_data_remove}).json()) for imdb in radarr_collection_ord: post_data_add.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint(trakt.post_oauth_request('users/me/lists/{0}/items'.format(list_id), data={'movies': post_data_add}).json()) post_data_add = [] post_data_remove = [] for imdb in radarr_collection_rw: if imdb in trakt_collection_rw: continue print('Movie in Radarr but not in Trakt. Will add {0}...'.format(imdb)) post_data_add.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint(trakt.post_oauth_request('users/me/lists/{0}/items'.format(list_id_rw), data={'movies': post_data_add}).json()) for imdb in trakt_collection_rw: if imdb in radarr_collection_rw: continue print('Movie in Trakt but not in Radarr. Will delete {0}...'.format(imdb)) post_data_remove.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint(trakt.post_oauth_request('users/me/lists/{0}/items/remove'.format(list_id_rw), data={'movies': post_data_remove}).json()) movieinfo.save_local_db()
def main(): list_id = trakt.get_list_id(config.TRAKT_LIST_NAME_WATCHED_KIDS) list_api_url = 'users/me/lists/{0}/items'.format(list_id) # update list description trakt.put_oauth_request('users/me/lists/{0}'.format(list_id), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') + '\r\n\r\n' + 'Trakts The most watched movies for the last 7 days with additional filters for KiDS.' + '\r\n' + 'Source code: https://github.com/linaspurinis/trakt.lists' }) time.sleep(0.5) print('List URL - https://trakt.tv/users/me/lists/{0}'.format(list_id)) print('') # delete movies from trakt list no longer in top watched list post_data = [] movies_in_watched_list = get_imdb_ids() trakt_list = get_trakt_ids(list_id) for imdb in trakt_list: #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) list_api_url_rm = 'users/me/lists/{0}/items/remove'.format(list_id) pprint(trakt.post_oauth_request(list_api_url_rm, data={'movies': post_data}).json()) # add missing list to trakt from top watched list post_data = [] for imdb in movies_in_watched_list: print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint(trakt.post_oauth_request(list_api_url, data={'movies': post_data}).json()) movieinfo.save_local_db()
def main(): list_moviemeter_id = trakt.get_list_id(config.TRAKT_LIST_MOVIEMETER_NAME) list_filtered_id = trakt.get_list_id(config.TRAKT_LIST_MOVIEMETER_FILTERED) list_filtered_url = 'users/me/lists/{0}/items'.format(list_filtered_id) list_filtered_url_rm = 'users/me/lists/{0}/items/remove'.format( list_filtered_id) # update list description trakt.put_oauth_request( 'users/me/lists/{0}'.format(list_filtered_id), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') + '\nIMDb Moviemeter Top 100 with filters:' + '\nReleased in last 2 years, imdbRating >= 6, imdbVotes >= 5000, Metacritics >= 50, Rotten >= 50' }) time.sleep(0.5) # delete movies from trakt list no longer in top watched list post_data = [] trakt_moviemeter_list = get_trakt_filtered_ids(list_moviemeter_id) trakt_filtered_list = get_trakt_ids(list_filtered_id) for imdb in trakt_filtered_list: #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint( trakt.post_oauth_request(list_filtered_url_rm, data={ 'movies': post_data }).json()) # add missing list to trakt from top watched list post_data = [] for imdb in trakt_moviemeter_list: print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint( trakt.post_oauth_request(list_filtered_url, data={ 'movies': post_data }).json()) movieinfo.save_local_db()
def main(): list_id = trakt.get_list_id(config.TRAKT_LIST_NAME) list_api_url = 'users/me/lists/{0}/items'.format(list_id) # update list description trakt.put_oauth_request( 'users/me/lists/{0}'.format(list_id), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') + '\r\n\r\n' + FEED_URL + '\r\n' + 'Source code: https://github.com/linaspurinis/trakt.lists' }) time.sleep(0.5) print('List URL - https://trakt.tv/users/me/lists/{0}'.format(list_id)) print('') # delete movies from trakt list no longer in pirated list trakt_list = get_trakt_ids(list_id) pirated_list = get_pirated_ids() post_data = [] for imdb in trakt_list: #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) list_api_url_rm = 'users/me/lists/{0}/items/remove'.format(list_id) pprint( trakt.post_oauth_request(list_api_url_rm, data={ 'movies': post_data }).json()) # add missing list to trakt from pirated list post_data = [] for imdb in pirated_list: print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint( trakt.post_oauth_request(list_api_url, data={ 'movies': post_data }).json())
def main(): list_id = trakt.get_list_id(config.TRAKT_LIST_NAME_ANTICIPATED) list_api_url = 'users/me/lists/{0}/items'.format(list_id) # update list description trakt.put_oauth_request( 'users/me/lists/{0}'.format(list_id), data={ 'description': 'Updated at ' + datetime.today().strftime('%Y-%m-%d') + '\r\nThe most anticipated movies based on the number of lists a movie appears on.' + '\r\nSource: https://trakt.tv/movies/anticipated?limit=100' }) time.sleep(0.5) print('List URL - https://trakt.tv/users/me/lists/{0}'.format(list_id)) print('') # delete movies from trakt list no longer in anticipated list post_data = [] trakt_anticipated_list = get_anticipated_ids() trakt_list = get_trakt_ids(list_id) for imdb in trakt_list: #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) list_api_url_rm = 'users/me/lists/{0}/items/remove'.format(list_id) pprint( trakt.post_oauth_request(list_api_url_rm, data={ 'movies': post_data }).json()) # add missing list to trakt from top watched list post_data = [] for imdb in trakt_anticipated_list: print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint( trakt.post_oauth_request(list_api_url, data={ 'movies': post_data }).json())
def main(): list_id = trakt.get_list_id(config.TRAKT_LIST_MOVIEMETER_NAME) list_api_url = 'users/me/lists/{0}/items'.format(list_id) # update list description trakt.put_oauth_request('users/me/lists/{0}'.format(list_id), data={ 'description': \ 'IMDb Most Popular Movies top 100' + '\r\n\r\n' + 'URL: https://www.imdb.com/chart/moviemeter/' + '\r\n' + 'Source code: https://github.com/linaspurinis/trakt.lists/' + '\r\n\r\nUpdated at ' + datetime.today().strftime('%Y-%m-%d') }) time.sleep(0.5) print('List URL - https://trakt.tv/users/me/lists/{0}'.format(list_id)) print('') # delete movies trakt list trakt_list = get_trakt_ids(list_id) moviemeter_list = get_moviemeter_ids() post_data = [] for imdb in trakt_list: #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) list_api_url_rm = 'users/me/lists/{0}/items/remove'.format(list_id) pprint( trakt.post_oauth_request(list_api_url_rm, data={ 'movies': post_data }).json()) # add missing list to trakt from pirated list post_data = [] for imdb in moviemeter_list: print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) pprint( trakt.post_oauth_request(list_api_url, data={ 'movies': post_data }).json())
def main(): list_id = trakt.get_list_id("My Worst Movies") list_api_url = 'users/me/lists/{0}/items'.format(list_id) bad_ids = [] radarr_collection = get_radarr_collection() i = 0 for imdb in radarr_collection: movieinfo.movie_get_info(imdb) if not movieinfo.local_ratings[imdb].get('imdbRating'): continue # Set 0 if not exists if movieinfo.local_ratings[imdb].get('metaRating'): metaRating = movieinfo.local_ratings[imdb]['metaRating'] else: metaRating = 0 if movieinfo.local_ratings[imdb].get('rottRating'): rottRating = movieinfo.local_ratings[imdb]['rottRating'] else: rottRating = 0 if (movieinfo.local_ratings[imdb]['imdbRating'] < 6 and metaRating < 50 and rottRating < 50): print( "================== bad movie found... {} =================". format(imdb)) bad_ids.append(imdb) print("continuing...") # delete movies from trakt list no longer in bad list trakt_list = get_trakt_ids(list_id) post_data = [] for imdb in trakt_list: if imdb in bad_ids: continue #print('Will delete {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) list_api_url_rm = 'users/me/lists/{0}/items/remove'.format(list_id) pprint( trakt.post_oauth_request(list_api_url_rm, data={ 'movies': post_data }).json()) # add missing list to trakt from pirated list post_data = [] for imdb in bad_ids: if imdb in trakt_list: continue print('Will add {0}...'.format(imdb)) post_data.append({'ids': {'imdb': '{0}'.format(imdb)}}) if not post_data: print('Nothing to add...') print('Result:') pprint( trakt.post_oauth_request(list_api_url, data={ 'movies': post_data }).json()) movieinfo.save_local_db()