Documentation
¶
Overview ¶
Package subtitlefile is the subtitle file name grammar, <stem>.<language>[.sdh][.forced][.<N>].<ext>, and which video in a folder owns a name. The names land on SMB and NFS shares that media servers read, so the segment order is a compatibility contract: Parse must read back every name Build writes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrZeroTag = errors.New("subtitlefile: a name needs a language") ErrTagUnreadable = errors.New("subtitlefile: the language segment reads back as another language") ErrOrdinal = errors.New("subtitlefile: an ordinal is from 1 to 999,999,999") ErrNotWritable = errors.New("subtitlefile: no writer produces this extension") )
The refusals of Build.
Functions ¶
func Build ¶
Build is the name of n beside a video whose stem is stem. It writes HI as .sdh (Jellyfin reads .hi after a language it does not know as Hindi) and both flags when both are set. Parse(stem, name) is n for every name Build returns: a Tag whose segment reads back as another language (language FilenameTag "cht" is Cholon but reads as Traditional Chinese) is ErrTagUnreadable.
func IsVideo ¶
IsVideo reports whether name, in any ASCII case, is a video file with a non-empty Stem, so Owner never sees the empty stem that would own every name beginning with a dot.
func Owner ¶
Owner is the video stem among stems that owns name: the longest one that, followed by ".", prefixes it, so Movie.Extended.en.srt belongs to Movie.Extended beside Movie. stems holds the Stem of each IsVideo name in the folder, so two videos sharing a stem (Movie.mkv, Movie.mp4) appear twice and own none of its names. False: no video owns name.
Types ¶
type Ext ¶
type Ext uint8
Ext is a subtitle extension the inventory reads. ExtVobSub (.sub) is on disk only: no writer produces it and timing.ParseCues refuses its payload.
type Name ¶
type Name struct {
Tag language.Tag
Ordinal int // 0: unnumbered; 1 to 999,999,999
Flags language.Flags
Ext Ext
}
Name is what a subtitle file name says beside its video's stem.
func Parse ¶
Parse reads name as a subtitle of the video whose stem is stem: the first segment after "<stem>." is always the language (language.ReadFilename, so "sdh" there is Southern Kurdish and "hi" Hindi), then hi, sdh or cc as HI and forced or foreign as Forced in either order, then an ordinal from 1 with no leading zero, then an extension subtitleext.OnDisk accepts. "<stem>.srt" is the zero Tag. False: name is not this grammar.