Skip to content

Commit

Permalink
key for cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mBaratta96 committed Aug 6, 2023
1 parent 0e4d3d3 commit c038e3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions letterboxd_stats/web_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ def _get_tmdb_id_from_web(link: str, is_diary: bool):

def get_tmdb_id(link: str, is_diary=False):
tmdb_id_cache = shelve.open(cache_path, writeback=False, protocol=5)
if link in tmdb_id_cache:
id = tmdb_id_cache[link]
key = link.split("/")[-1]
if key in tmdb_id_cache:
id = tmdb_id_cache[key]
else:
try:
id = _get_tmdb_id_from_web(link, is_diary)
tmdb_id_cache[link] = id
tmdb_id_cache[key] = id
except ValueError as e:
print(e)
id = None
Expand Down

0 comments on commit c038e3a

Please sign in to comment.