renamer

package
v0.13.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 movie files.

Index

Constants

View Source
const DefaultFileFormat = "{Movie Title} ({Release Year}) {Quality Full}"

DefaultFileFormat is used when a library has no naming_format set.

View Source
const DefaultFolderFormat = "{Movie Title} ({Release Year})"

DefaultFolderFormat is used when a library has no folder_format set.

Variables

This section is empty.

Functions

func Apply

func Apply(format string, m Movie, q plugin.Quality) string

Apply returns the formatted filename (without extension) for the given movie, quality, and format string. Substitution variables:

{Movie Title}          → movie.Title
{Movie CleanTitle}     → filesystem-safe version of movie.Title (delete colon strategy)
{Original Title}       → movie.OriginalTitle
{Release Year}         → movie.Year
{Quality Full}         → quality.Name  (e.g. "Bluray-1080p")
{MediaInfo VideoCodec} → quality.Codec (e.g. "x265")
{Edition}              → movie.Edition (e.g. "Director's Cut"); empty when untagged

func ApplyWithOptions

func ApplyWithOptions(format string, m Movie, q plugin.Quality, colon ColonReplacement) string

ApplyWithOptions is like Apply but allows specifying the colon replacement strategy.

func CleanTitle

func CleanTitle(title string) string

CleanTitle strips characters that are problematic on common filesystems while preserving readability. Colons are replaced with " - " (space-dash). Used for {Movie CleanTitle} with the default space-dash strategy.

func CleanTitleColon

func CleanTitleColon(title string, colon ColonReplacement) string

CleanTitleColon is like CleanTitle but applies the specified colon replacement.

func DestPath

func DestPath(libraryRoot, fileFormat, folderFormat string, m Movie, q plugin.Quality, colon ColonReplacement, sourceExt string) string

DestPath returns the absolute destination path for an imported file.

libraryRoot / FolderName(folderFormat, m) / ApplyWithOptions(fileFormat, m, q, colon) + ext

func FolderName

func FolderName(format string, m Movie) string

FolderName returns the library sub-directory name for a movie using the given folder format template. Pass DefaultFolderFormat for the standard behaviour.

Types

type ColonReplacement

type ColonReplacement string

ColonReplacement controls how colons in movie titles are handled when producing filesystem-safe filenames.

const (
	// ColonDelete removes colons: "Batman: Begins" → "Batman Begins"
	ColonDelete ColonReplacement = "delete"
	// ColonDash replaces colons with a dash: "Batman: Begins" → "Batman- Begins"
	ColonDash ColonReplacement = "dash"
	// ColonSpaceDash replaces ": " with " - ": "Batman: Begins" → "Batman - Begins"
	ColonSpaceDash ColonReplacement = "space-dash"
	// ColonSmart uses space-dash when followed by a space, dash otherwise.
	ColonSmart ColonReplacement = "smart"
)

type Movie

type Movie struct {
	Title         string
	OriginalTitle string
	Year          int
	Edition       string // detected edition of the file; empty = untagged
}

Movie holds the movie metadata the renamer needs.

Jump to

Keyboard shortcuts

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