Giter VIP home page Giter VIP logo

romaji-renamer's Introduction

Romaji-Renamer

A Bash script to import Anilist and MAL data to your Plex Media Server. This is done with a Plex-Meta-Manager (PMM) metadata file.

Discord : Discord Shield

Here what will be imported for each of your animes :

# TVDB_ID for PMM to import
330692:
  # Title : either Romaji title or English title (in settings) (from Anilist)
  title: "Yuru Camp△"
  # Sort Title : either Romaji title or English title (in settings) (from Anilist)
  sort_title: "Yuru Camp△"
  # original_title : English title or Native Title (from Anilist)
  original_title: "ゆるキャン△"
  # Genre ands tags from Anilist (genres, and tag above > 70% can be changed in settings)
  genre.sync: Anime,Slice of Life,CGDCT,Iyashikei
  # Airing status add as a label : Planned, Airing or Ended (from Anilist)
  label: Planned
  label.remove: Airing,Ended
  # Studio from Anilist                               
  studio: C-Station
  # Season import
  seasons:
    # Season 0 import
    0:
      label.remove: score
    # Season 1 import
    1:
      # Title from Anilist (Romaji or English from the title setting)
      title: "Yuru Camp△"
      # Rating 1 from Anilist or MAL (in settings)
      user_rating: 8.3
      # Add label score to use with PMM overlays and also add the season label (optionnal)
      label: Fall 2021, score
    # Season 2 import
    2:
      # Title from Anilist (Romaji or English from the title setting)
      title: "Yuru Camp△ SEASON 2"
      # Rating 1 from Anilist or MAL (in settings)
      user_rating: 8.5
      # Add label score to use PMM overlays and also add the season label (optionnal)
      label: Fall 2022,score
  # Rating 1 : average rating of the seasons (Anilist or MAL)
    audience_rating: 8.2
  # Rating 2 : average rating of the seasons (Anilist or MAL)
    critic_rating: 8.4

Anilist Posters for animes and seasons can also be downloaded and imported to plex with the PMM assets folder

The seasonal-animes-download.sh can create a list of the new seasonal animes (New as not a sequel anime) and make a collection yml to add them to sonarr.

Designed for Plex TV agent / Plex Movie Agent, Hama is unsupported

How it works:

  • Romaji-Renamer will export your Animes and TVDB/IMDB IDs from Plex with python plexapi
  • Then it will then retrieve their MAL/Anilist IDs from my mapping list https://github.com/Arial-Z/Animes-ID
  • Use the Anilist API and Jikan API to get metadata from Anilist and MAL
  • Create and update a PMM metadata file to import everything in to your Plex when PMM runs.

Docker container avalaible here

https://hub.docker.com/r/arialz/romaji-renamer

Step 1 - Prerequisites

First you need a GNU/Linux OS to run bash script
Requirements: Plex Media Server, Plex-Meta-Manager, Python and JQ

pip install plexapi
  • install python-dotenv
pip install python-dotenv

Step 2 - Download and extract the script

Git clone the main branch or get lastest release : https://github.com/Arial-Z/Romaji-Renamer/releases/latest

Step 3 - Configure the script

  • Extract the script on a desired location.
  • Navigate to its location.
  • Copy default.env to config/.env
  • cd into the config folder and edit .env to fill out the variables.
#Url of the Plex server (Needed)
plex_url=http://127.0.0.1:32400
#Plex token (Needed)
plex_token=zadazdzadazdazdazdazdazd


# Run the animes script (Yes/No)
RUN_ANIMES_SCRIPT=Yes
# Plex animes library name need to be in a double quote (Needed for the animes script)
ANIME_LIBRARY_NAME="Animes"
# Path to the created animes metadata file (Needed for the animes script)
# On docker don't modifify the path "$SCRIPT_FOLDER/pmm/" only the file name if you want
# on python select the path of the pmm install like this :
# PMM_Folder/config/metadata-animes.yml
METADATA_ANIMES=$SCRIPT_FOLDER/pmm/metadata-animes.yml


# Run the movies script (Yes/No)
RUN_MOVIES_SCRIPT=No
# Plex movies animes library name need to be in a double quote (Needed for the movies script)
MOVIE_LIBRARY_NAME="Animes Movies"
# Path to the created movies metadata file (Needed for the movies script)
# On docker don't modifify the path "$SCRIPT_FOLDER/pmm/" only the file name if you want
# on python select the path of the pmm install like this :
# PMM_Folder/config/metadata-animes-movies.yml
METADATA_MOVIES=$SCRIPT_FOLDER/pmm/metadata-animes-movies.yml

# Run the seasonal download script (Yes/No)
RUN_SEASONAL_SCRIPT=No
# Number of animes added to the sesonal animes auto-download collection (Needed for the seasonal-animes-download.sh script)
DOWNLOAD_LIMIT=20
# Path to the created seasonal-animes-download file (Needed for the seasonal-animes-download.sh script)
DOWNLOAD_ANIMES_COLLECTION=$SCRIPT_FOLDER/pmm/seasonal-animes-download.yml


# PMM Asset Folder to import posters (Needed)
ASSET_FOLDER=$SCRIPT_FOLDER/pmm/assets
# Folder where the logs of script are kept (Default is okay change if you want)
LOG_FOLDER=$SCRIPT_FOLDER/config/logs


# Source for RATING 1 (main show and seasons) (MAL / ANILIST)
RATING_1_SOURCE=ANILIST
# Type of rating used in Plex for RATING 1 (audience, critic, user / leave empty to disable)
RATING_1_TYPE=audience
# Source for RATING 2 (main show only) (MAL / ANILIST or leave empty to disable)
RATING_2_SOURCE=MAL
# Type of rating used in Plex for RATING 2 (audience, critic, user / leave empty to disable)
RATING_2_TYPE=critic
# Allow renaming animes (Yes/No)
ALLOW_RENAMING=Yes
# Use the english name as title (and also sort_title) instead of the romaji one, the romaji title will be set as original title (Yes/No)
MAIN_TITLE_ENG=No
# Use the english name as sort_title instead of the romaji one (Yes/No)
SORT_TITLE_ENG=No
# Use the native name as original_title instead of the romaji/english one (Yes/No)
ORIGINAL_TITLE_NATIVE=Yes
# Rename season to the anilist title of that season (Yes/No)
RENAME_SEASONS=Yes
#Grab anilist tags higher or equal than percentage (0-100)
ANILIST_TAGS_P=70
# Download poster (Yes/No)
POSTER_DOWNLOAD=Yes
# Download seasons poster (Yes/No)
POSTER_SEASON_DOWNLOAD=Yes
# Source for poster (MAL / ANILIST)
POSTER_SOURCE=ANILIST
# Ignore seasons title, rating and poster (Yes/No)
IGNORE_SEASONS=No
# Ignore season 1 if it's the only season (Yes/No)
IGNORE_S1=Yes
# Anilist have some full uppercase title, this settings will remove them "86 EIGHTY-SIX" > "86 Eighty-Six" (Yes/No)
REDUCE_TITLE_CAPS=Yes
#Add the anime season to the season label in plex (Fall  2022, Spring 2021, ...)
SEASON_YEAR=No
# Disable anilist tags
DISABLE_TAGS=No
# Mal Data cache time (in days min : 1)
DATA_CACHE_TIME=5

Step 4 - Configure PMM

  • Within your (PMM) config.yml add the following metadata_path, it should look like this with the default filepath:
  Animes:
    metadata_path:
    - file: config/metadata-animes.yml

Configuration finished.

Running the bash script manually or via CRON.

Run the script with bash:

bash path/to/romaji-renamer.sh

You can also add it to CRON and make sure to run it before PMM (be careful it take a little time to run due to API limit rate)

override-ID

Some animes won't be matched and the metadata will be missing, you can see them error in the log, in PMM metadata files or plex directly
Cause are missing MAL ID for the TVDB ID / IMDB ID

Animes

to fix animes ID you can create a request at https://github.com/Anime-Lists/anime-lists/
you can also use the override file, in the config folder copy override-ID-animes.tsv.example to override-ID-animes.tsv and add new entries, it look like this, be carreful to use tab as separator even the empty one (title, studio and ignore_seasons are optional and can be used to force corresponding string)

tvdb-id	anilist-id	Title	Studio	ignore_seasons	notes
114801	6702		A-1 Pictures	yes	Fairy Tail
79685	263	Hajime no Ippo		
76013	627	Major			

create a new line and manually enter the TVDB-ID and MAL-ID, MAL-TITLE

Movies

to fix movies ID you can create a request at https://github.com/Anime-Lists/anime-lists/
you can also use the override file, in the config folder copy override-ID-movies.tsv.example to override-ID-movies.tsv and add new entries, it look like this, be carreful to use tab as separator even the empty one (title and studio are optional and can be used to force corresponding string)

imdb-id	anilist-id	Title	Studio	notes
tt0110008	1030		Studio Ghibli	Pompoko

create a new line and manually enter the IMDB-ID and MAL-ID, MAL-TITLE

Thanks

  • To Plex for Plex
  • To meisnate12 for Plex-Meta-Manager.
  • To plexapi
  • To https://jikan.moe/ for their MAL API.
  • To MAL for being here.
  • To Anilist for being here too.
  • And to a lot of random people from everywhere for all my copy / paste code.

romaji-renamer's People

Contributors

arial-z avatar quafley avatar

Stargazers

Mio. avatar Jamy avatar  avatar sh@rker.dev avatar  avatar Michael Tikoian avatar Nikolas Thiel avatar  avatar kzndotsh avatar

Watchers

 avatar

romaji-renamer's Issues

HAMA Support

Any chance for HAMA support to be added in the future? My currently library is setup with HAMA and I'm not sure about converting it to the plex agent.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.