#anime #plex #webhook #my-anime-list #scrobble

bin+lib plex-mal-scrobbler

Update anime watch progress to MyAnimeList using Plex webhooks

3 releases

0.1.2 Nov 30, 2023
0.1.1 Nov 10, 2023
0.1.0 Oct 10, 2023

#1226 in Command line utilities

21 downloads per month

AGPL-3.0-only

33KB
334 lines

PlexMALScrobbler

PlexMALScrobbler is a Plex webhook listener, which will update anime watch progress to MyAnimeList using it's API.

Installation

Requirements

  • Requires Plex Pass to work (webhooks)
  • Plex on same server
  • MAL API account

From crates.io

  1. Install PlexMALScrobbler: cargo install plex-mal-scrobbler
  2. Copy config.yml.sample sample file to ~/.config/plex-mal-scrobbler/config.yml
  3. See Configure for configuration
  4. Configure Plex to send webhooks to PlexMALScrobbler
  5. When running the program for the first time
    1. You will be asked to visit a page to allow API access for your account
    2. After allowing access, app redirect URL specified in the API settings will be opened
    3. The program wants you to copy the code parameter value from the URL
  6. Run the program again to start scrobbling
  7. See Usage

From source

  1. Clone this repo: git clone https://gitlab.com/miicat/plex-mal-scrobbler.git
  2. Compile the program: cargo build --release
  3. Copy the compiled program (plex-mal-scrobbler/target/release/plex-mal-scrobbler) to a folder you will run the program in (e.g. ~/plexmalscrobbler/)
  4. Copy config.yml.sample sample file to ~/.config/plex-mal-scrobbler/config.yml
  5. See Configure for configuration
  6. Configure Plex to send webhooks to PlexMALScrobbler
  7. When running the program for the first time
    1. You will be asked to visit a page to allow API access for your account
    2. After allowing access, app redirect URL specified in the API settings will be opened
    3. The program wants you to copy the code parameter value from the URL
  8. Run the program again to start scrobbling
  9. See Usage

Configure

config.yml

The file should be in ~/.config/plex-mal-scrobbler/config.yml, it will contain your MAL API tokens and other scrobbling related settings

  • mal_client_id is MAL client_id obtained from MAL API page. See [Obtaining MAL API key](###Obtaining MAL API key)
  • plex_users is a list of users to scrobble. Comment the line out, if you want to scrobble all users (note that all scrobbles will be made for your account)
  • plex_libraries is a list of libraries to scrobble. Comment the line out, if you want to scrobble all libraries (not recommended)
  • scrobble_last_ep if enabled, the program will mark anime as complete, after watching last episode
  • require_match if enabled, the program will scrobble anime only if the title matches some anime in your watching list
  • port port the program will listen on. By default it's 8000
  • Following fields will be filled by the program, please do not edit
    • mal_access_token
    • mal_refresh_token
    • mal_token_expires_in
  • test is testing flag, will print anime update info and won't scrobble if enabled

Example configuration:

mal_client_id: abcd123456789efghijk
plex_users:
  - MyNeatUserName22
plex_libraries:
  - Anime
  - Other animes
scrobble_last_ep: false
require_match: false
test: false

Obtaining MAL API key

  1. Go to MAL API page
  2. Click Create ID
  3. Select other from App Type dropdown field
  4. Select non-commercial from Commercial / Non-Commercial dropdown field
  5. Fill all other required fields and submit the form
  6. If not shown after submitting, click Edit button for the just created MAL API ID/client
  7. The text next to Client ID is your mal_client_id

Plex webhook

Plex will send webhooks to your URL whenever you play, pause, stop or scrobble videos on your Plex server. Plex sends scrobble webhook, when you have watched past the 90% mark.

PlexMALScrobbler as the name suggests will only act when getting scrobble webhook.

  1. Login to Plex
  2. Go to: Settings -> Webhooks (link)
  3. Click Add webhook
  4. Type the URL, where your program will be listening for the webhook to the URL field
    1. The URL will most likely be http://127.0.0.1:8000/plex/webhook
  5. Click Save Changes to save the webhook

Usage

PlexMALScrobbler will try to match the anime to an anime on your currently watching list

  1. Have PlexMALScrobbler running in the background
  2. Add anime you are watching to your currently watching list
  3. Watch anime (past the 90% mark, usually around 20min in)
  4. Anime wathing progress will be automatically updated

Contributing

PlexMALScrobbler is free, open-source software licensed under AGPLv3.

You can open issues for bugs you've found or features you think are missing. You can also submit pull requests to this repository.

Authors and acknowledgment

Support

If you want to support me, feel free to use paypal Donate

License

This library is licensed under AGPLv3

Dependencies

~21–52MB
~899K SLoC