A script for MPV that automatically updates your AniList based on the file you just watched.
Important
By default, the anime must be set to "watching", "planning" or "rewatching" to update progress. This is done in order to prevent updating the wrong show.
Recommendation: Check out the configuration options in your anilistUpdater.conf file to customize the script to your needs. See the Configuration section for details.
Tip
In order for the script to work properly, make sure your files are named correctly:
- Either the file or folder its in must have the anime title in it
- The file must have the episode number in it (absolute numbering should work)
- In case of remakes, specify the year of the remake to ensure it updates the proper one
To avoid the script running and making useless API calls, you can set one or more directories in the config file. See the Configuration section below.
For any issues, you can either open an issue on here, or message me on discord (azuredblue)
You will need Python 3 installed, as well as the libraries guessit and requests:
pip install guessit requestsSimply git clone this repository into your mpv scripts folder, or download this repository and extract the contents into your mpv scripts folder.
If you use git clone, you can update by using git pull in the repository folder.
You WILL need an AniList access token for it to work:
- Visit
https://anilist.co/api/v2/oauth/authorize?client_id=20740&response_type=token - Authorize the app
- Copy the token
- Create an
anilistToken.txtfile in thempv-anilist-updaterfolder (if not already there) and paste the token there.
This token is what allows the script to update the anime episode count and make api requests, it is not used for anything else.
Important
The config file is only generated after you run mpv at least once with the script installed. If the file is not created due to lack of write permissions, you can either run mpv as administrator once to generate it, or create the file manually in the appropriate directory. It is recommended to be in the script-opts directory.
When you first run the script, it will automatically create a configuration file called anilistUpdater.conf if it does not already exist. This file is typically created in your mpv script-opts directory where you have mpv installed. If it cannot be created there, it will try the scripts directory or your mpv config directory (e.g. ~/.config/mpv/ on Linux, %APPDATA%/mpv/ on Windows).
Config file search order:
The script checks for the config file in the following order:
script-optsdirectory (recommended)scriptsdirectory (where the script itself is located)- mpv config directory (e.g.
~/.config/mpv/or%APPDATA%/mpv/)
If the config file exists in more than one location, the one in the highest-priority directory (script-opts) will be used. For example, if you have a config in both script-opts and scripts, the one in script-opts will take precedence.
You should edit this file to change any options.
# Use 'yes' or 'no' for boolean options below
# Example for multiple directories (comma or semicolon separated):
# DIRECTORIES=D:/Torrents,D:/Anime
# or
# DIRECTORIES=D:/Torrents;D:/Anime
DIRECTORIES=
EXCLUDED_DIRECTORIES=
UPDATE_PERCENTAGE=85
SET_COMPLETED_TO_REWATCHING_ON_FIRST_EPISODE=no
UPDATE_PROGRESS_WHEN_REWATCHING=yes
SET_TO_COMPLETED_AFTER_LAST_EPISODE_CURRENT=yes
SET_TO_COMPLETED_AFTER_LAST_EPISODE_REWATCHING=yes
ADD_ENTRY_IF_MISSING=no
SILENT_MODE=no- DIRECTORIES: Comma or semicolon separated list of directories. If empty, the script works for every video. Example:
DIRECTORIES=D:/Torrents,D:/Anime- Restricting directories only prevents the script from automatically updating AniList for files outside the specified directories. Manual actions using the keybinds (Ctrl+A, Ctrl+B, Ctrl+D, C) will still work for any file, regardless of its location.
- EXCLUDED_DIRECTORIES: Comma or semicolon separated list of directories. Useful for ignoring paths inside directories from above. Example: EXCLUDED_DIRECTORIES = {"D:/Torrents/Watched", "D:/Anime/Planned"}
- UPDATE_PERCENTAGE: Number (0-100). The percentage of the video you need to watch before it updates AniList automatically. Default is
85. - SET_COMPLETED_TO_REWATCHING_ON_FIRST_EPISODE:
yes/no. Ifyes, when watching episode 1 of a completed anime, set it to rewatching and update progress. Default isno. - UPDATE_PROGRESS_WHEN_REWATCHING:
yes/no. Ifyes, allow updating progress for anime set to rewatching. Default isyes. - SET_TO_COMPLETED_AFTER_LAST_EPISODE_CURRENT:
yes/no. Ifyes, set to COMPLETED after last episode if status was CURRENT. Default isyes. - SET_TO_COMPLETED_AFTER_LAST_EPISODE_REWATCHING:
yes/no. Ifyes, set to COMPLETED after last episode if status was REPEATING (rewatching). Default isyes. - ADD_ENTRY_IF_MISSING:
yes/no. Ifyes, automatically add anime to your list if it's not found in your list during search. Default isno.⚠️ Warning: This can add incorrect anime to your list if the detection is inaccurate. - SILENT_MODE:
yes/no. Ifyes, won't show OSD messages. Default isno.
Note
All boolean options must be yes or no (not true/false).
This script has 4 keybinds:
- Ctrl + a: Manually updates your AniList with the current episode you are watching.
- Ctrl + b: Opens the AniList page of the anime you are watching on your browser. Useful to see if it guessed the anime correctly.
- Ctrl + d: Opens the folder where the current video is playing. Useful if you have "your own" anime library, and navigating through folders is a pain.
- c: Opens a correction overlay for the current file. You can paste/type an AniList URL/ID and optionally override the mapped episode (relative progress). Use
Ctrl+vto paste.
The script will automatically update your AniList when the video you are watching reaches 85% completion (or the percentage you set in the config file).
You can change the keybinds in your input.conf:
A script-binding update_anilist
B script-binding launch_anilist
D script-binding open_folder
C script-binding correct_anime_idIn the case the script gets it wrong, there is a menu pressing c where you can paste the anilist entry of the correct anime and the episode.
For example, if the file is "Attack On Titan - E48" you will need to paste the entry corresponding of that episode and the corresponding episode number for that season (Attack on Titan Third Season, Episode 11)
The script uses Guessit to try to get as much information as possible from the file name.
If the "episode" and "season" guess are before the title, it will consider that title wrong and try to get the title from the name of the folder it is in.
After that, it searches for the show both in your AniList and globally.
If the torrent file has absolute numbering (only episode number), it will try to guess the season and episode by:
- From the first TV or ONA with duration > 21, attempt to build a list of sequels from the main series using relations from the API
- If the episode number is greater than all of those combined, it could've made a mistake or maybe the user doesn't have all necessary entries in the list, so it repeats this process with the global search from before.
- Once we have a filtered list of seasons in order, finding the episode is trivial.
If it doesn't work properly, consider manually changing the episode number to the normal format, or updating that series manually.
This script should work on most formats as long as the name is present in the file itself or the folder name:
Boku no Hero Academia - 152 (1080p).mkv will be detected as S7 E14 and updated accordingly.
E12 - Welcome [F1119374].mkv will work if the folder that it is in has 86 in the name. If it has 86 Part 2 then it should be Episode 1
To see which anime got detected, you can use c or Ctrl+B to launch the AniList page.
For a MyAnimeList version, check out the fork mpv-mal-updater. Take into account this is a fork not maintained by me so I can't guarantee its safety. It may also be outdated or work differently.
This script was inspired by mpv-open-anilist-page by ehoneyse.