diff --git a/plugins/letterboxd.py b/plugins/letterboxd.py index 5834f55..a0ee728 100644 --- a/plugins/letterboxd.py +++ b/plugins/letterboxd.py @@ -16,7 +16,7 @@ def get_list(list_id, config=None): config = config or {} while True: - print("Page number: ", page_number) + logger.info("Page number: ", page_number) watchlist = list_id.endswith("/watchlist") likeslist = list_id.endswith("/likes/films") @@ -48,22 +48,22 @@ def get_list(list_id, config=None): if watchlist or likeslist: page = soup.find_all('li', {'class': 'poster-container'}) - else: + else: page = soup.find_all('div', {'class': 'film-detail-content'}) for movie_soup in page: if watchlist or likeslist: movie = {"title": movie_soup.find('img').attrs['alt'], "media_type": "movie"} link = movie_soup.find('div', {'class': 'film-poster'})['data-target-link'] - else: + else: movie = {"title": movie_soup.find('h2', {'class': 'headline-2 prettify'}).find('a').text, "media_type": "movie"} movie_year = movie_soup.find('small', {'class': 'metadata'}) if movie_year is not None: movie["release_year"] = movie_year.text - + link = movie_soup.find('a')['href'] - - + + if config.get("imdb_id_filter", False) or 'release_year' not in movie: logger.info(f"Getting release year and imdb details for: {movie['title']}") @@ -81,8 +81,8 @@ def get_list(list_id, config=None): if movie_year is not None: movie["release_year"] = movie_year.text - - # If a movie doesn't have a year, that means that the movie is only just announced and we don't even know when it's coming out. We can easily ignore these because movies will have a year of release by the time they come out. + + # If a movie doesn't have a year, that means that the movie is only just announced and we don't even know when it's coming out. We can easily ignore these because movies will have a year of release by the time they come out. if 'release_year' in movie: movies.append(movie) diff --git a/plugins/trakt.py b/plugins/trakt.py index a9cb539..f1aa962 100644 --- a/plugins/trakt.py +++ b/plugins/trakt.py @@ -97,11 +97,11 @@ def _get_auth_token(config): user_code = r.json()["user_code"] interval = r.json()["interval"] - print("Authentication with Trakt API required") - print(f"Please visit the following URL to get your access token: {r.json()['verification_url']}") - print() - print(f"Your device code is: {user_code}") - print() + logger.info("Authentication with Trakt API required") + logger.info(f"Please visit the following URL to get your access token: {r.json()['verification_url']}") + logger.info("") + logger.info(f"Your device code is: {user_code}") + logger.info("") # Poll the API until the user has authenticated while True: @@ -119,7 +119,7 @@ def _get_auth_token(config): # Save the access token to a file with open(Trakt._access_token_file, 'w') as f: f.write(access_token) - print("Successfully authenticated with Trakt API") + logger.info("Successfully authenticated with Trakt API") return access_token