From 6d5ebb68e379416cac6981091ebb0c47aec95961 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 11 Mar 2026 21:28:17 -0400 Subject: [PATCH] [videos] Don't spam IMDB with series metadata --- PROJECT.org | 64 ++++++++++++++++++++++++++++++++-- vrobbler/apps/videos/models.py | 4 +-- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/PROJECT.org b/PROJECT.org index 39119d0..aa9d1ae 100644 --- a/PROJECT.org +++ b/PROJECT.org @@ -92,7 +92,7 @@ fetching and simple saving. :LOGBOOK: CLOCK: [2025-07-09 Wed 09:55]--[2025-07-09 Wed 10:15] => 0:20 :END: -* Backlog [8/32] +* Backlog [9/33] ** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :vrobbler:personal:bug:music:scrobbles: ** TODO [#C] Move to using more robust mopidy-webhooks pacakge form pypi :utility:improvement: :PROPERTIES: @@ -454,12 +454,70 @@ wrong. Turns out we're not looking up music tracks properly, again. +** TODO Add sentiment parsing for Scrobbles with notes :vrobbler:project:scrobbles:sentiment: +** TODO Check opencode about a way to present stats like movies per month :vrobbler:scrobbles:stats:personal:project: ** DONE [#B] Auto calc duration if no playback time seconds present :vrobbler:bug:scrobbles:personal:project: :PROPERTIES: :ID: e16228b2-b062-bd00-32e6-b2353e6406e9 :END: -** TODO Add sentiment parsing for Scrobbles with notes :vrobbler:project:scrobbles:sentiment: -** TODO Check opencode about a way to present stats like movies per month :vrobbler:scrobbles:stats:personal:project: +** DONE Fix bug in video find_or_create :vrobbler:personal:project:bug:videos: +:PROPERTIES: +:ID: 10e611a5-fbcf-7473-25f0-c9bad7b79ffd +:END: +The error: +#+begin_src shell + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/scrobbles/views.py", line 493, in jellyfin_webhook + scrobble = jellyfin_scrobble_media(post_data, request.user.id) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/scrobbles/scrobblers.py", line 149, in jellyfin_scrobble_media + media_obj = Video.find_or_create(imdb_id) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/videos/models.py", line 390, in find_or_create + return cls.get_from_imdb_id(source_id, overwrite) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/videos/models.py", line 374, in get_from_imdb_id + video.tv_series = Series.find_or_create( + ^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/videos/models.py", line 203, in find_or_create + vdict, _, cover, genres = lookup_video_from_imdb( + ^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/vrobbler/apps/videos/sources/imdb.py", line 17, in lookup_video_from_imdb + imdb_result = imdb.get_title(imdb_id) + ^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/cinemagoerng/web.py", line 127, in get_title + data = _scrape(spec=spec, context=context, headers=headers) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/cinemagoerng/web.py", line 120, in _scrape + document = fetch(url, headers=request_headers) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/site-packages/cinemagoerng/web.py", line 44, in fetch + with urlopen(request) as response: + ^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 216, in urlopen + return opener.open(url, data, timeout) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 525, in open + response = meth(req, response) + ^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 634, in http_response + response = self.parent.error( + ^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 563, in error + return self._call_chain(*args) + ^^^^^^^^^^^^^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 496, in _call_chain + result = func(*args) + ^^^^^^^^^^^ + File "/usr/local/lib/python3.11/urllib/request.py", line 643, in http_error_default + raise HTTPError(req.full_url, code, msg, hdrs, fp) +urllib.error.HTTPError: HTTP Error 500: Internal Server Error +#+end_src + +- Note taken on [2026-03-11 Wed 20:53] + + It turns out that every time a TV show was scrobbled were were hitting IMDB. + Woof. + ** DONE Update admin page to be easier to use :vrobbler:djadmin:project:personal: :PROPERTIES: :ID: 0779be1f-1ad7-ddc7-8861-d3c7c833cbe9 diff --git a/vrobbler/apps/videos/models.py b/vrobbler/apps/videos/models.py index 5682335..e0901df 100644 --- a/vrobbler/apps/videos/models.py +++ b/vrobbler/apps/videos/models.py @@ -371,9 +371,7 @@ class Video(ScrobblableMixin): setattr(video, k, v) if series_id: - video.tv_series = Series.find_or_create( - imdb_id=series_id, overwrite=overwrite - ) + video.tv_series = Series.find_or_create(imdb_id=series_id) video.save()