Skip to content

Commit 2e4fd36

Browse files
committed
remove mark played and unplayed events from jellyfin
1 parent 77c792f commit 2e4fd36

File tree

6 files changed

+13
-31
lines changed

6 files changed

+13
-31
lines changed

src/integrations/tests/test_webhooks_jellyfin.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_invalid_token(self):
2727
def test_tv_episode_mark_played(self):
2828
"""Test webhook handles TV episode mark played event."""
2929
payload = {
30-
"Event": "MarkPlayed",
30+
"Event": "Stop",
3131
"Item": {
3232
"Type": "Episode",
3333
"Name": "The One Where Monica Gets a Roommate",
@@ -71,7 +71,7 @@ def test_tv_episode_mark_played(self):
7171
def test_movie_mark_played(self):
7272
"""Test webhook handles movie mark played event."""
7373
payload = {
74-
"Event": "MarkPlayed",
74+
"Event": "Stop",
7575
"Item": {
7676
"Name": "The Matrix",
7777
"ProductionYear": 1999,
@@ -100,7 +100,7 @@ def test_movie_mark_played(self):
100100
def test_anime_movie_mark_played(self):
101101
"""Test webhook handles movie mark played event."""
102102
payload = {
103-
"Event": "MarkPlayed",
103+
"Event": "Stop",
104104
"Item": {
105105
"Name": "Perfect Blue",
106106
"ProductionYear": 1997,
@@ -129,7 +129,7 @@ def test_anime_movie_mark_played(self):
129129
def test_anime_episode_mark_played(self):
130130
"""Test webhook handles anime episode mark played event."""
131131
payload = {
132-
"Event": "MarkPlayed",
132+
"Event": "Stop",
133133
"Item": {
134134
"Type": "Episode",
135135
"Name": "The Journey's End",
@@ -181,7 +181,7 @@ def test_ignored_event_types(self):
181181
def test_missing_tmdb_id(self):
182182
"""Test webhook handles missing TMDB ID gracefully."""
183183
payload = {
184-
"Event": "MarkPlayed",
184+
"Event": "Stop",
185185
"Item": {
186186
"Type": "Movie",
187187
"ProviderIds": {},
@@ -202,7 +202,7 @@ def test_mark_unplayed(self):
202202
"""Test webhook handles unplayed marks."""
203203
# First mark as played
204204
payload = {
205-
"Event": "MarkPlayed",
205+
"Event": "Stop",
206206
"Item": {
207207
"Name": "The Matrix",
208208
"ProductionYear": 1999,
@@ -234,7 +234,7 @@ def test_mark_unplayed(self):
234234
def test_repeated_watch(self):
235235
"""Test webhook handles repeated watches."""
236236
payload = {
237-
"Event": "MarkPlayed",
237+
"Event": "Stop",
238238
"Item": {
239239
"Type": "Movie",
240240
"ProductionYear": 1999,
@@ -267,7 +267,7 @@ def test_repeated_watch(self):
267267
def test_extract_external_ids(self):
268268
"""Test extracting external IDs from provider payload."""
269269
payload = {
270-
"Event": "MarkPlayed",
270+
"Event": "Stop",
271271
"Item": {
272272
"Type": "Movie",
273273
"Name": "The Matrix",
@@ -293,7 +293,7 @@ def test_extract_external_ids(self):
293293
def test_extract_external_ids_empty(self):
294294
"""Test handling empty provider payload."""
295295
payload = {
296-
"Event": "MarkPlayed",
296+
"Event": "Stop",
297297
"Item": {
298298
"Type": "Movie",
299299
"Name": "The Matrix",
@@ -316,7 +316,7 @@ def test_extract_external_ids_empty(self):
316316
def test_extract_external_ids_missing(self):
317317
"""Test handling missing ProviderIds."""
318318
payload = {
319-
"Event": "MarkPlayed",
319+
"Event": "Stop",
320320
"Item": {
321321
"Type": "Movie",
322322
"Name": "The Matrix",

src/integrations/webhooks/base.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ def _handle_tv_episode(
266266
related_season=season_instance,
267267
end_date=timezone.now().replace(second=0, microsecond=0),
268268
)
269-
elif self._is_unplayed(payload):
270-
app.models.Episode.objects.filter(
271-
item=episode_item,
272-
related_season=season_instance,
273-
).delete()
274269

275270
def _handle_anime(self, media_id, episode_number, payload, user):
276271
"""Handle anime playback event."""
@@ -306,7 +301,3 @@ def _handle_anime(self, media_id, episode_number, payload, user):
306301
def _is_played(self, payload):
307302
"""Check if media is marked as played."""
308303
raise NotImplementedError
309-
310-
def _is_unplayed(self, payload):
311-
"""Check if media is marked as unplayed."""
312-
raise NotImplementedError

src/integrations/webhooks/emby.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,3 @@ def _get_media_type(self, payload):
4242

4343
def _is_played(self, payload):
4444
return payload.get("PlaybackInfo", {}).get("PlayedToCompletion", False) is True
45-
46-
def _is_unplayed(self, _):
47-
return False # Emby doesn't have an unplayed event in webhooks

src/integrations/webhooks/jellyfin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,3 @@ def _get_media_type(self, payload):
4242

4343
def _is_played(self, payload):
4444
return payload["Item"]["UserData"]["Played"]
45-
46-
def _is_unplayed(self, payload):
47-
return payload["Event"] == "MarkUnplayed"

src/integrations/webhooks/plex.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,3 @@ def _get_media_type(self, payload):
6565

6666
def _is_played(self, payload):
6767
return payload["event"] == "media.scrobble"
68-
69-
def _is_unplayed(self, _):
70-
return False # Plex doesn't have an unplayed event in webhooks

src/templates/users/integrations.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <h4 class="text-sm font-medium mb-3">Setup Instructions</h4>
181181
{# djlint:on #}
182182
<li>Payload format: Default</li>
183183
<li>Listen to events only for: Your Jellyfin User</li>
184-
<li>Events: Play, Stop, MarkPlayed and MarkUnplayed</li>
184+
<li>Events: Play and Stop</li>
185185
</ul>
186186
</li>
187187
</ol>
@@ -309,7 +309,7 @@ <h3 class="text-base font-medium">Emby Integration</h3>
309309
<h4 class="text-sm font-medium mb-3">Setup Instructions</h4>
310310
<ol class="list-decimal list-inside space-y-2 text-sm text-gray-300">
311311
<li>In Emby, go to Settings / Notifications</li>
312-
<li>In the Notifications section, click on "Add Notification"
312+
<li>In the Notifications section, click on "Add Notification"</li>
313313
<li>
314314
In the Notification settings:
315315
<ul class="list-disc list-inside ml-6 mt-2 space-y-2 text-gray-400">
@@ -349,7 +349,7 @@ <h4 class="text-sm font-medium mb-3">Setup Instructions</h4>
349349
</li>
350350
</ol>
351351
</div>
352-
</div>
352+
</div>
353353
</div>
354354
{% endblock settings_content %}
355355

0 commit comments

Comments
 (0)