# PlexMALScrobbler **PlexMALScrobbler** is a [Plex webhook](https://support.plex.tv/articles/115002267687-webhooks/) listener, which will update anime watch progress to [MyAnimeList](http://myanimelist.net/) using it's [API](https://myanimelist.net/apiconfig/references/api/v2). ## Installation ### Requirements * Requires [Plex Pass](https://www.plex.tv/plex-pass/) to work (webhooks) * Plex on same server * MAL API account ### From crates.io 1. Install [PlexMALScrobbler](https://crates.io/crates/plex-mal-scrobbler): `cargo install plex-mal-scrobbler` 2. Copy [config.yml.sample](config.yml.sample) sample file to `~/.config/plex-mal-scrobbler/config.yml` 3. See [Configure](#configure) for configuration 4. [Configure Plex](#plex-webhook) 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](#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](#configure) for configuration 6. [Configure Plex](#plex-webhook) 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](#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](https://myanimelist.net/apiconfig). 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: ```yaml 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](https://myanimelist.net/apiconfig) 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](https://app.plex.tv/desktop/#!/settings/webhooks)) 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 * [Miika Launiainen](https://gitlab.com/miicat) / Miicat_47 ## Support If you want to support me, feel free to use paypal [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/miicat) ## License This library is licensed under AGPLv3