renamer

command module
v0.0.0-...-906ada0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 1 Imported by: 0

README

Renamer

`renamer`` renames files. It is intended to be used for renamed content to standard formats recognized by Plex.

Usage

$ go run . -h
renamer renames files to a standard format.

Usage:
  renamer [flags]

Flags:
  -d, --dir string               Directory to check (default ".")
      --dry-run                  Do not modify any files; instead, print what would be done
  -h, --help                     help for renamer
      --name string              The name of the show
  -o, --output-template string   The template to rename files to, not including any file extension (default "{{ .ShowName }} s{{ .Season }}e{{ .Episode }} - {{ .Title }}")
  -p, --pattern string           Pattern of files to pick up
      --season string            The season the episode is in

The --pattern is a regular expression using named capture groups with the keys episode, season, name and title.

If all files in the target directory match one of the included patterns (and the same pattern), that pattern can be used without providing the --pattern argument. There are a few detectable file patterns, which will hopefully be expanded later.

The --output-pattern is a go template using those variables.

The name and season can be fixed by arugments, in which case they are not required in the input --pattern.

License

My original work

MIT

Open-source license information

The regexps package is licensed under Apache 2.0, being adapted from regroup, adding the ability to provide default arguments and an "exists" struct tag, which differs from the "requires" struct tag in that it requires the capture group to exist, but does not require it to be populated.

This package also allows creating a Regexp opject with a generic argument, instead of passing a pointer to a struct, and changes the public-facing API to be more in-line with the stdlib regexp package.

I have also added the requisite copyright notices to the package, which were not present in the original distribution.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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