Skip to content

Commit e3478da

Browse files
committed
Send 1 update if setting the series to completed
Fixes #238
1 parent 272f3f7 commit e3478da

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

plexanisync/anilist.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,14 @@ def __update_episode_incremental(
640640
self, series: AnilistSeries, watched_episode_count: int, anilist_episodes_watched: int, new_status: str,
641641
plex_rating: int
642642
):
643-
# calculate episode difference and iterate up so activity stream lists
644-
# episodes watched if episode difference exceeds 32 only update most
645-
# recent as otherwise will flood the notification feed
643+
# calculate episode difference
646644
episode_difference = watched_episode_count - anilist_episodes_watched
647-
if episode_difference > 32:
645+
# If episode difference exceeds 32 only update most recent as otherwise will flood the notification feed.
646+
# Also set it to the max episode count directly if the series was completed.
647+
if episode_difference > 32 or new_status == "COMPLETED":
648648
self.graphql.update_series(series.anilist_id, watched_episode_count, new_status, plex_rating)
649649
else:
650+
# send 1 update per watched episode for the activity feed
650651
for current_episodes_watched in range(anilist_episodes_watched + 1, watched_episode_count + 1):
651652
self.graphql.update_series(series.anilist_id, current_episodes_watched, new_status, plex_rating)
652653

0 commit comments

Comments
 (0)