Skip to content

Commit

Permalink
Updated logging #61
Browse files Browse the repository at this point in the history
thomas committed Jan 10, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4e1ff63 commit bd7d44d
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions plugins/letterboxd.py
Original file line number Diff line number Diff line change
@@ -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)

12 changes: 6 additions & 6 deletions plugins/trakt.py
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit bd7d44d

Please sign in to comment.