/BulkRename

Bulk-rename TV show files for a clean file structure

Primary LanguageC#MIT LicenseMIT

BulkRename

Docker Pulls MIT Licensed Activity ci release GitHub contributors GitHub Sponsors Open Issues Closed Issues

Description

This project is about bulk-renaming of TV show files for a clean file structure.

Sometimes, if you have files named as follows: twd.s1e02.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv, your media server may not be able to match the correct TV show or episodes. Also, this seems messy and being a lazy person, I got tired of renaming them manually and created this tool.

Installation

Install BulkRename with Docker

Please use the following docker-compose.yml file and replace the values with your own.

Basic installation without history saving and SEQ

version: '3.7'
services:
  bulkrename:
    image: ramoy/bulkrename:latest
    container_name: "bulkrename"
    environment:
      ASPNETCORE_URLS: http://*:8080
      SupportedFileEndings: "mkv;mp4;m4v;avi"
      FoldersToIgnore: ".@__thumb"
      TZ: "Europe/Zurich"
    ports:
      - "8080:80"
    volumes:
      - "/share/Downloads/Files://app//Files//" # folder in which your TV show files must be located at the time of renaming
      - "/share/Downloads/Logs://app//Logs//" # optional to have logs available outside docker

With SQL Server as a docker container

If you want to keep your renaming history, you can do this with a JSON file or database (see also PersistanceMode), in this example a SQL Server is used:

version: '3.7'
services:
  ms-sql-server:
    image: mcr.microsoft.com/mssql/server:2022-latest
    container_name: "ms-sql-server"
    environment:
      ACCEPT_EULA: "Y"
      SA_PASSWORD: "SuperStrong@PasswordHere_42"
      MSSQL_PID: Express
      TZ: "Europe/Zurich"
    ports:
      - "1433:1433"
    volumes:
      - "/share/Downloads/BulkRename/Data:/var/opt/mssql"
  bulkrename:
    depends_on:
      - "ms-sql-server"
    image: ramoy/bulkrename:latest
    container_name: "bulkrename"
    environment:
      ASPNETCORE_URLS: http://*:8080
      PersistanceMode: "Database"
      DbServer: "ms-sql-server"
      DbName: "BulkRename_DB_Live"
      DbPort: "1433"
      DbUser: "sa"
      DbPassword: "SuperStrong@PasswordHere_42"
      DbConnectionTimeOutInSeconds: "40"
      SupportedFileEndings: "mkv;mp4;m4v;avi"
      FoldersToIgnore: ".@__thumb"
      SeqUrl: "https://IP_ADRESS:PORT" # only required if SEQ is used
      SeqApiKey: "YOUR_SECRET_API_KEY" # only required if SEQ is used
      TZ: "Europe/Zurich"
    ports:
      - "8080:80"
    volumes:
      - "/share/Downloads/Files://app//Files//" # folder in which your TV show files must be located at the time of renaming

Environment variables

PersistanceMode

The PersistanceMode defines how the history of the renamed files is to be saved. You have the following three options:

Mode Description
None No history is saved, it's the default option if not specified
JSON The renaming history is saved in a json file. You must also specify where the history should be saved by mapping the volume for the //app//RenamingHistory// folder.
Database Requires a database and connection values. Currently, only MS SQL Server is supported.

Note: It has happened before that I have renamed a series, the renaming was not correct, but I only noticed this when I was watching the series. Therefore, the saving of the renaming history was added. If you always check carefully, you may not need this feature.

DbConnectionTimeOutInSeconds

The container usually starts faster than the database, the application tries to establish a connection until the specified time in seconds has elapsed. Only needs to be set if Database has been selected as PersitanceMode.

SeqUrl

BulkRename uses Serilog and Seq for logging, you can add an IP-Address and port if you want to use it. Check out the Seq documentation for more information.

SeqApiKey

You may add an API Key for your application to identify itself or secure your Seq instance. See Seq documentation for details.

SupportedFileEndings

Add here semicolon ';' separated values for endings of video files if you want to limit them. This can be useful for example when there are other files in the folders like subtitles or ReadMe files.

FoldersToIgnore

Add here semicolon ';' separated values for folders which should be ignored. QNAP generates sometimes a '.@__thumb' folder after detecting video files in a folder, which will cause an exception while searching files.

Usage

Folder structure

For the application to recognize the files and rename them correctly, a folder structure must be created according to the following pattern:

/Downloads
  /Files
    /The Walking Dead
      /Season 01
        twd.s1e01.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        twd.s1e02.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        twd.s1e03.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        twd.s1e04.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        twd.s1e05.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        twd.s1e06.GERMAN.5.1.UNTOUCHED.DUBBED.DL.AC3.1080p.WEB-DL.h264-TvR.mkv
        ...

The files must already be sorted by name according to the episode order for the renaming to work correctly. It also supports renaming multiple TV shows and seasons at once, there is no limitation in this regard.

Home Page

This is the home page with the Preview Renaming of TV-Shows (1) button in the middle. Pressing the button takes you to the preview page.

Home

Series overview

On the preview page, the entries are grouped by Series - Season (2), and the original name (3) and the new name after renaming (4) are displayed. If the new file names are correct, the renaming can be performed with Submit Renaming (5).

Series overview

Renamed series overview

If the renaming was successful, this is displayed on the page with the message Successfully renamed files (6). Here the renames are also grouped by series - season (7).

Renamed series overview

History

Call up the history page by pressing History (8). The first time, the page will be empty, but if you press Load History (9), your entire renaming history will be loaded, grouped by series - season - date and time of renaming (10). Once loaded, the history is retained until you restart the application or reload it by pressing the button again.

History

Development

Please read the development documentation if you would like to participate in the development.

Adding new languages

This app can provide multiple languages and includes already the languages English, German, and Hungarian. A new language can be added within a few steps, to do this, please check out the documentation.

Contributors ✨

Roland.
Roland.

🌍
Ramazan Yilmaz
Ramazan Yilmaz

💻
All Contributors
All Contributors

📖