Skip to content

Commit

Permalink
repeating support for update_entry
Browse files Browse the repository at this point in the history
when episode 1 is set as progress while the anime is set as completed it will mark it automatically as being rewatched, when the episode is set to the last one, it will be marked as completed again automatically
  • Loading branch information
prochy-exe committed Dec 30, 2024
1 parent d4de856 commit e550ad1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions alfetcher/al_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def update_entry(anime_id, progress, al_token=None):
except:
user_eps = -1 #allow for 0 as a value

if progress <= user_eps:
if progress <= user_eps and user_eps != total_eps:
print_deb('Not updating, progress is lower or equal than user progress')
return

Expand All @@ -756,7 +756,7 @@ def update_entry(anime_id, progress, al_token=None):
variables = {}
variables['mediaId'] = anime_id
variables['progress'] = progress
if progress == total_eps:
if progress == total_eps and current_status != 'REPEATING':
variables['status'] = 'COMPLETED'
elif progress == 0:
variables['status'] = 'PLANNING'
Expand All @@ -768,6 +768,12 @@ def update_entry(anime_id, progress, al_token=None):
}
"""
else:
variables['status'] = 'CURRENT'
if current_status == 'COMPLETED':
variables['status'] = 'REPEATING'
elif current_status == 'REPEATING':
if progress == total_eps:
variables['status'] = 'COMPLETED'
else:
variables['status'] = 'CURRENT'
make_graphql_request(query, variables, al_token, user_request = True)
print_deb('Updating progress successful')

0 comments on commit e550ad1

Please sign in to comment.