Skip to content

Commit

Permalink
Add support for rewatching list
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamuko committed Sep 26, 2024
1 parent b3b92bb commit 2331b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Plex webhook service to automatically update your Anilist watching list.

anifunnel is a web server that will consume incoming Plex webhooks and update your Anilist watching list whenever you finish watching an episode. Due to this design, anifunnel only needs to authenticate against Anilist and doesn't require access to your Plex instance. It's also written in Rust to aim for relatively low system resource usage.

The updating logic is rather conservative: the anime must be found within your watching list, and must have a matching episode count. So if you watch the first episode of a show, it will not add the show to your watching list on your own. Likewise, if you watch episode six of a show that matches a title where you have only the first two episodes marked as watched, it will also not update it, as it's looking for an anime that is at five episodes watched.
The updating logic is rather conservative: the anime must be found within your watching (or rewatching) list, and must have a matching episode count. So if you watch the first episode of a show, it will not add the show to your watching list on your own. Likewise, if you watch episode six of a show that matches a title where you have only the first two episodes marked as watched, it will also not update it, as it's looking for an anime that is at five episodes watched.

anifunnel implements fuzzy matching logic to allow the updating the work even if the titles aren't an exact match between your Plex library and Anilist. So for example "Boku no Hero Academia 6" can be matched against "Boku no Hero Academia (2022)" and "Uzaki-chan wa Asobitai! ω" can be matched against "Uzaki-chan wa Asobitai! Double".

Expand Down
10 changes: 5 additions & 5 deletions src/anilist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mutation($id: Int, $progress: Int) {
";
const MEDIALIST_QUERY: &str = "
query MediaListCollection($user_id: Int) {
MediaListCollection(userId: $user_id, status: CURRENT, type: ANIME) {
MediaListCollection(userId: $user_id, status_in: [CURRENT, REPEATING], type: ANIME) {
lists {
entries {
id
Expand Down Expand Up @@ -369,11 +369,11 @@ pub async fn get_watching_list(
let response = send_query(token, query).await?;
let media_list_collection_data =
QueryResponse::<MediaListCollectionData>::parse(response).await?;
let lists = media_list_collection_data.MediaListCollection.lists;
if lists.is_empty() {
return Ok(MediaListGroup::empty());
let mut collected_list = MediaListGroup::empty();
for mut list in media_list_collection_data.MediaListCollection.lists {
collected_list.entries.append(&mut list.entries);
}
Ok(lists[0].clone())
Ok(collected_list)
}

async fn send_query<T>(
Expand Down

0 comments on commit 2331b89

Please sign in to comment.