Documentation ¶
Index ¶
- Constants
- Variables
- func Base2Absolute(s, dir string) string
- func Execute()
- func IsZeroLengthTimespan(last, t time.Duration) (b bool)
- func NoSub(s string) string
- func SetPrefered(langs []Lang, l, atm Lang, name string, out *string) bool
- type AudioTrack
- type CreatingLibrary
- type GeneralTrack
- type Lang
- type MediaInfo
- type Meta
- type ProcessedItem
- type ProcessedItemWriter
- type RawMedia
- type RawMediaInfo
- type Task
- func (tsk *Task) Autosub()
- func (tsk *Task) ChooseAudio(f func(i int, track AudioTrack))
- func (tsk *Task) ConcatWAVstoOGG(suffix string)
- func (tsk *Task) Execute()
- func (tsk *Task) PrepareLangs()
- func (tsk *Task) ProcessItem(foreignItem *astisub.Item) (item ProcessedItem)
- func (tsk *Task) Supervisor(foreignSubs *subs.Subtitles, outStream *os.File, write ProcessedItemWriter)
- type VideoTrack
Constants ¶
const ( StrippedSDH = iota Sub Dub CC )
Variables ¶
var AstisubSupportedExt = []string{".srt", ".ass", ".ssa", "vtt", ".stl", ".ttml"}
var CodecToExtension = map[string]string{
"MP3": ".mp3",
"AAC": ".aac",
"WMA": ".wma",
"FLAC": ".flac",
"ALAC": ".m4a",
"Opus": ".opus",
"Vorbis": ".ogg",
"PCM": ".wav",
"WAV": ".wav",
"AIFF": ".aiff",
"RealAudio": ".ra",
"AMR": ".amr",
"MPEG-4 ALS": ".mp4",
"MPEG Audio": ".mp3",
"AC-3": ".ac3",
"DTS": ".dts",
"TrueHD": ".thd",
"E-AC-3": ".eac3",
"MKA": ".mka",
"WebM": ".webm",
"Speex": ".spx",
"Musepack": ".mpc",
}
var MediainfoPath = "mediainfo"
var (
STT string
)
Functions ¶
func Base2Absolute ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func IsZeroLengthTimespan ¶
Types ¶
type AudioTrack ¶
type AudioTrack struct { Type string `json:"@type"` StreamOrder string `json:"StreamOrder"` ID string `json:"ID"` Format string `json:"Format"` FormatCommercialIfAny string `json:"Format_Commercial_IfAny"` FormatSettingsSBR string `json:"Format_Settings_SBR"` FormatAdditionalFeatures string `json:"Format_AdditionalFeatures"` CodecID string `json:"CodecID"` Duration string `json:"Duration"` BitRateMode string `json:"BitRate_Mode"` BitRate string `json:"BitRate"` Channels string `json:"Channels"` ChannelPositions string `json:"ChannelPositions"` ChannelLayout string `json:"ChannelLayout"` SamplesPerFrame string `json:"SamplesPerFrame"` SamplingRate string `json:"SamplingRate"` SamplingCount string `json:"SamplingCount"` FrameRate string `json:"FrameRate"` FrameCount string `json:"FrameCount"` CompressionMode string `json:"Compression_Mode"` StreamSize string `json:"StreamSize"` StreamSizeProportion string `json:"StreamSize_Proportion"` Title string `json:"Title"` LangRaw string `json:"Language"` Language *iso.Language Default string `json:"Default"` AlternateGroup string `json:"AlternateGroup"` }
AudioTrack represents the information about the audio stream in the media file
type CreatingLibrary ¶
CreatingLibrary represents the information about the library used to create the media information
type GeneralTrack ¶
type GeneralTrack struct { Type string `json:"@type"` VideoCount string `json:"VideoCount"` AudioCount string `json:"AudioCount"` FileExtension string `json:"FileExtension"` Format string `json:"Format"` FormatProfile string `json:"Format_Profile"` CodecID string `json:"CodecID"` CodecIDCompatible string `json:"CodecID_Compatible"` FileSize string `json:"FileSize"` Duration string `json:"Duration"` OverallBitRate string `json:"OverallBitRate"` FrameRate string `json:"FrameRate"` FrameCount string `json:"FrameCount"` StreamSize string `json:"StreamSize"` HeaderSize string `json:"HeaderSize"` DataSize string `json:"DataSize"` IsStreamable string `json:"IsStreamable"` Title string `json:"Title"` Collection string `json:"Collection"` Season string `json:"Season"` Track string `json:"Track"` Description string `json:"Description"` RecordedDate string `json:"Recorded_Date"` FileModifiedDate string `json:"File_Modified_Date"` FileModifiedDateLocal string `json:"File_Modified_Date_Local"` EncodedApplication string `json:"Encoded_Application"` Cover string `json:"Cover"` Extra struct { PartID string `json:"Part_ID"` } `json:"extra"` }
GeneralTrack represents the general information about the media file
type Lang ¶
type Lang struct { *iso.Language // Typically a ISO 3166-1 region but can also be a ISO 15924 script Subtag string }
func GuessLangFromFilename ¶
Only 1st subtag found is considered, the others are ignored
func ReadStdLangCode ¶
type MediaInfo ¶
type MediaInfo struct { CreatingLibrary CreatingLibrary GeneralTrack GeneralTrack VideoTrack VideoTrack AudioTracks []AudioTrack }
MediaInfo represents the media information including general, video, and audio tracks
type ProcessedItem ¶
type ProcessedItem struct { ID time.Duration AlreadyDone bool Sound string Time string Source string Image string ForeignCurr string NativeCurr string ForeignPrev string NativePrev string ForeignNext string NativeNext string }
ProcessedItem represents the exported information of a single subtitle item, where Time is the primary field which identifies the item and ForeignCurr is the actual text of the item. The fields NativeCurr, NativePrev and NativeNext will be empty unless a second subtitle file was specified for the export and that second subtitle file is sufficiently aligned with the first.
type ProcessedItemWriter ¶
type ProcessedItemWriter func(*os.File, *ProcessedItem)
ProcessedItemWriter should write an exported item in whatever format is // selected by the user.
type RawMedia ¶
type RawMedia struct { Ref string `json:"@ref"` Track []json.RawMessage `json:"track"` }
type RawMediaInfo ¶
type RawMediaInfo struct { CreatingLibrary CreatingLibrary `json:"creatingLibrary"` Media RawMedia `json:"media"` }
type Task ¶
type Task struct { Log zerolog.Logger Meta Meta OriginalLang string // FIXME what for? Langs []string RefLangs []Lang Targ Lang SeparationLib string STT string TargetChan int UseAudiotrack int TimeoutSTT int TimeoutSep int Offset time.Duration WantDubs bool IsBulkProcess bool DubsOnly bool IsCCorDubs bool TargSubFile string NativeSubFile string NativeSubs *subs.Subtitles MediaPrefix string MediaSourceFile string FieldSep string // defaults to "\t" OutputFileExtension string // defaults to ".tsv" for "\t" and ".csv", otherwise }
func DefaultTask ¶
func (*Task) ChooseAudio ¶
func (tsk *Task) ChooseAudio(f func(i int, track AudioTrack))
func (*Task) ConcatWAVstoOGG ¶
func (*Task) PrepareLangs ¶
func (tsk *Task) PrepareLangs()
func (*Task) ProcessItem ¶
func (tsk *Task) ProcessItem(foreignItem *astisub.Item) (item ProcessedItem)
func (*Task) Supervisor ¶
type VideoTrack ¶
type VideoTrack struct { Type string `json:"@type"` StreamOrder string `json:"StreamOrder"` ID string `json:"ID"` Format string `json:"Format"` FormatProfile string `json:"Format_Profile"` FormatLevel string `json:"Format_Level"` CodecID string `json:"CodecID"` Duration string `json:"Duration"` BitRate string `json:"BitRate"` Width string `json:"Width"` Height string `json:"Height"` SampledWidth string `json:"Sampled_Width"` SampledHeight string `json:"Sampled_Height"` PixelAspectRatio string `json:"PixelAspectRatio"` DisplayAspectRatio string `json:"DisplayAspectRatio"` Rotation string `json:"Rotation"` FrameRateMode string `json:"FrameRate_Mode"` FrameRate string `json:"FrameRate"` FrameRateMinimum string `json:"FrameRate_Minimum"` FrameRateMaximum string `json:"FrameRate_Maximum"` FrameCount string `json:"FrameCount"` ColorSpace string `json:"ColorSpace"` ChromaSubsampling string `json:"ChromaSubsampling"` BitDepth string `json:"BitDepth"` StreamSize string `json:"StreamSize"` Title string `json:"Title"` ColourRange string `json:"colour_range"` ColourRangeSource string `json:"colour_range_Source"` Extra struct { CodecConfigurationBox string `json:"CodecConfigurationBox"` } `json:"extra"` }
VideoTrack represents the information about the video stream in the media file