renamer

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package renamer applies naming format templates to produce filesystem-safe filenames for imported TV episode files.

Index

Constants

View Source
const (
	DefaultEpisodeFormat      = "{Series Title} - S{Season:00}E{Episode:00} - {Episode Title} {Quality Full}"
	DefaultDailyEpisodeFormat = "{Series Title} - {Air Date} - {Episode Title} {Quality Full}"
	DefaultAnimeEpisodeFormat = "{Series Title} - S{Season:00}E{Episode:00} - {Absolute Episode:000} - {Episode Title} {Quality Full}"
	DefaultSeriesFolderFormat = "{Series Title} ({Release Year})"
	DefaultSeasonFolderFormat = "Season {Season:00}"
)

Default format constants used when a library has no explicit format configured.

Variables

This section is empty.

Functions

func ApplyEpisodeFormat

func ApplyEpisodeFormat(format string, series Series, episode Episode, quality plugin.Quality, colon ColonReplacement) string

ApplyEpisodeFormat returns the formatted filename (without extension) for the given series, episode, quality, and format string.

Supported tokens:

{Series Title}           → series.Title
{Series CleanTitle}      → filesystem-safe series title
{Original Title}         → series.OriginalTitle
{Release Year}           → series.Year
{Season:00}              → zero-padded season number (e.g. "01")
{Episode:00}             → zero-padded episode number (e.g. "05")
{Absolute Episode:000}   → zero-padded absolute number (e.g. "005")
{Episode Title}          → episode.Title
{Air Date}               → episode.AirDate
{Quality Full}           → quality.Name
{MediaInfo VideoCodec}   → quality.Codec

func ApplyFolderFormat

func ApplyFolderFormat(format string, series Series, colon ColonReplacement) string

ApplyFolderFormat returns the series root folder name.

Supported tokens: {Series Title}, {Series CleanTitle}, {Original Title}, {Release Year}.

func ApplySeasonFolderFormat

func ApplySeasonFolderFormat(format string, seasonNumber int) string

ApplySeasonFolderFormat returns the season sub-folder name.

Supported token: {Season:00}.

func CleanTitle

func CleanTitle(title string, colon ColonReplacement) string

CleanTitle strips characters that are problematic on common filesystems while preserving readability. The colon strategy controls how colons in the title are handled.

func DestPath

func DestPath(
	libraryRoot, episodeFormat, seriesFolderFormat, seasonFolderFormat string,
	series Series, episode Episode,
	quality plugin.Quality, colon ColonReplacement,
	ext string,
) string

DestPath returns the absolute destination path for an imported episode file.

libraryRoot / ApplyFolderFormat(...) / ApplySeasonFolderFormat(...) / ApplyEpisodeFormat(...) + ext

Types

type ColonReplacement

type ColonReplacement string

ColonReplacement controls how colons in series/episode titles are handled when producing filesystem-safe filenames.

const (
	// ColonDelete removes colons: "Title: Subtitle" → "Title Subtitle"
	ColonDelete ColonReplacement = "delete"
	// ColonDash replaces colons with a dash: "Title: Subtitle" → "Title- Subtitle"
	ColonDash ColonReplacement = "dash"
	// ColonSpaceDash replaces ": " with " - ": "Title: Subtitle" → "Title - Subtitle"
	ColonSpaceDash ColonReplacement = "space-dash"
	// ColonSmart is offered by the settings UI; it behaves as ColonSpaceDash
	// (": " → " - ", any other ":" → "-").
	ColonSmart ColonReplacement = "smart"
)

type Episode

type Episode struct {
	SeasonNumber   int
	EpisodeNumber  int
	AbsoluteNumber int
	Title          string
	AirDate        string // "2024-01-15"
}

Episode holds the episode-level metadata the renamer needs.

type Series

type Series struct {
	Title         string
	OriginalTitle string
	Year          int
}

Series holds the series-level metadata the renamer needs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL