Ariaryy / AniName

Batch rename Anime Episode files with customizable formatting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


AniName Logo
AniName

Batch rename Anime Episode files with customizable formatting.

Quick StartUsage and Options

Quick Start

To clone and run this application, you'll need Git and Python installed on your computer. From your command line:

# Clone this repository
git clone https://github.com/Ariaryy/AniName

# Go into the repository
cd AniName

# Install dependencies
pip install -r requirements.txt

# Run the app
python aniname

Usage and Options

General Options

python aniname [OPTIONS]
  -h, --help         show this help message and exit
  -r, --restore      Run the restore utility

Pre-requisite

To run this application you'll need Python installed on your computer.

Anime Folder Formatting

In order for Rename Utility to recognize your Anime folder, rename it to the following format (without square brackets and spaces):

[MyAnimeList ID] S[Season Number] P[Part Number]

Replace the text in the square brackets with the appropriate value (remove spaces).

  • [MyAnimeList ID]: ID of the Anime from MyAnimeList.net
  • S[Season Number]: Season number of the Anime
  • P[Part Number]: Part number of the Anime

S[Season Number] and P[Part Number] are optional. They are used to identify the season and part of the Anime, and rename the files accordingly.

You can retrieve the MyAnimeList ID by following these steps:

  • Visit MyAnimeList.net
  • Use the search bar to search and open your Anime in the site.
  • The URL should look something like this (pay attention to the ID):
    https:​//myanimelist.net/anime/ID/Anime-Name
  • The ID (number) in the URL is the MyAnimeList ID.
  • As an example, here is the URL for the anime Attack on Titan:
    https://myanimelist.net/anime/16498/Shingeki_no_Kyojin
    The MyAnimeList ID for the above example is 16498

Here are a few examples of Anime folder names:

  • Death Note: 1535
  • Attack on Titan Season 1: 16498S01
  • Attack on Titan Season 3 Part 2: 38524S01P02

Anime Folder Names Example

Anime Episodes Formatting

The Rename Utility relies on the episode number to rename Anime episodes, so make sure that the filename of your Anime episodes contains the episode number.

In the event that the rename fails, it is recommended that you rename the files to remove everything except the episode number from the episode files and then retry.

The Bulk Rename Utility or PowerRename utility included with Microsoft PowerToys can be used to automate this process.

Rename Utility

The Rename Utility is used to batch rename Anime episode files.

To use the Rename Utility, open the command line in the app's folder and run:

python aniname

When you launch the Rename Utility, you are asked to press Enter to select your Anime a folder. It refers to the folder containing the Anime(s) the app is to rename.

Alternatively, you can specify the path of the Anime Directory. It refers to the path of the parent folder containing the Anime(s) the app is to rename.

The path can be obtained by opening the folder containing your Anime(s) using File Explorer, right-clicking on the address bar, and selecting Copy address. The path will be copied to the clipboard which can be pasted into the app.

The Rename Utility will scan for directories/subdirectories matching the format mentioned in Anime Folder Formatting. The process of renaming can be started by confirming the Anime(s) found during the scan.

After the rename, a backup of all previous filenames are stored in a folder called ORIGINAL_EPISODE_FILENAMES. This folder is made outside the path entered while using the Rename Utility. The previous filenames can be restored using the Restore Utility.

Config File

When you first run the Rename Utility, a conf.ini file will be created in the following paths for respective platforms:

  • Windows: %APPDATA%\AniName
  • Linux: ~/.local/share/AniName
  • Mac: ~/Library/Application Support/AniName

The conf.ini file allows you to customize how your files are renamed.

Language Options

Available options:

  • season_title_language: Language of the season/anime title.
  • episode_title_language: Language of the episode title.

Available Language values are english, romanji and japanese

Examples of Attack on Titan under different Language values:

  • english: Attack on Titan
  • romanji: Shingeki no Kyojin
  • japanese: 進撃の巨人

Season & Episode Formatting

The formatting options can contain special sequences that will be replaced when renaming. For example, {sn} or {S&sn|}

The field names themselves (the part inside the {}) can also have some special formatting:

  • Conjunction: Text, variables, prefixes can be merged by using a & separator. Example, {E&en}

  • Default: A literal default value can be specified for when the field is empty using a | separator. Example, {pn|00}
    By default, the default value is empty.

  • Double curly braces {{}} can be used to specify a field that will only be used when the left of it is not empty. Example, {sn}{{ - }}{st}
    In the above example, - will not be used that is specified inside {{}} if the season number sn is missing or empty.

  • The special formatting character & can be used as a normal character inside the field by prefixing it with the escape character \.

Available options:

  • episode_format: The format in which the episode filename will be renamed.
  • season_format: The format in which the Anime folder will be renamed.

Available fields:

  • sn: Season number
  • pn: Part number
  • en: Episode number
  • st: Season/Anime title
  • et: Episode title

Season & Episode Format Example Templates

# S01E01 - To You Two Thousand Years Later
# S03P02E01 - The Town Where Everything Began
episode_format = {S&sn|}{P&pn|}{E&en|}{{ - }}{et|}

# E01 - To You Two Thousand Years Later
episode_format = {E&en|}{{ - }}{et|}

# To You Two Thousand Years Later (E01)
episode_format = {et|} ({E&en|})

# 01x01 - To You Two Thousand Years Later
episode_format = {sn&x|}{en|}{{ - }}{et|}

# S01 - Attack on Titan
# S03P02 - Attack on Titan Season 3 Part 2
season_format = {S&sn|}{P&pn|}{{ - }}{st|}

# Attack on Titan (S01)
# Attack on Titan Season 3 Part 2 (S03P02)
season_format = {st|} ({S&sn|}{P&pn|})

# Attack on Titan
# Attack on Titan Season 3 Part 2
# "Anime" will be used if the Season/Anime name is missing/empty
season_format = {st|Anime} 

Restore Utility

The Rename Utility creates a backup of all previous filenames in a folder called ORIGINAL_EPISODE_FILENAMES outside the path used in the app.

It is done as a measure of safety in case you wish to revert to the previous filenames.

The Restore Utility can be used to revert to previous filenames. To use the Restore Utility, open the command line in the app's folder and run:

python aniname -r

Specifiy the path of the ORIGINAL_EPISODE_FILENAMES folder and select the backup file. Confirm to proceed restoring the filenames.

Disclaimer

  • AniName is not affiliated with MyAnimeList.net
  • You are responsible for the usage of this application.

About

Batch rename Anime Episode files with customizable formatting

License:MIT License


Languages

Language:Python 100.0%