Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // FormatMP4 is the MP4 container format (.mp4, video/mp4). FormatMP4 = &Format{ Name: "MP4", MIME: "video/mp4", Extension: "mp4", } // FormatMKV is the Matroska container format (.mkv, video/x-matroska). FormatMKV = &Format{ Name: "MKV", MIME: "video/x-matroska", Extension: "mkv", } )
Functions ¶
func SanitizeID ¶
SanitizeID sanitizes a string to be usable as a media ID. Example: "Test.mkv" -> "test-mkv"
Types ¶
type BasicMedia ¶
BasicMedia is a JSON-serializable generic Media.
func NewBasicMedia ¶
func NewBasicMedia(m Media) *BasicMedia
NewBasicMedia wraps Media into BasicMedia.
func (*BasicMedia) Format ¶
func (bm *BasicMedia) Format() *Format
func (*BasicMedia) ID ¶
func (bm *BasicMedia) ID() string
func (*BasicMedia) MarshalJSON ¶
func (bm *BasicMedia) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON data from this struct.
func (*BasicMedia) Meta ¶
func (bm *BasicMedia) Meta() meta.Metadata
func (*BasicMedia) Path ¶
func (bm *BasicMedia) Path() string
func (*BasicMedia) UnmarshalJSON ¶
func (bm *BasicMedia) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshalls JSON data into this struct.
type Format ¶
type Format struct { // Name is the container format name. Name string `json:"name"` // MIME is the format MIME type. MIME string `json:"mime"` // Extension is the format's preferred file extension, **without leading dots**. Extension string `json:"extension"` }
Format is a media file container format.
func FindFormat ¶
FindFormat tries to find a format by its name, returns nil if not found.
func FindFormatMIME ¶
FindFormatMIME tries to find a format by its MIME type, returns nil if not found.
func FindUnsupportedFormat ¶
FindUnsupportedFormat tries to find a format by its MIME type, creating an unsupported Format if not found.
type Media ¶
type Media interface { // ID returns the media ID, alphanumeric, lowercase, non-blank ([a-z0-9-_]). ID() string // Path is the path of this media file, absolute. Path() string // Meta is the metadata object, may be nil. Meta() meta.Metadata // Format is the media format. Format() *Format }
Media is a media file.
Click to show internal directories.
Click to hide internal directories.