m3uparser

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2024 Alexandre Pires

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	// M3U8Version3 represents version 3 of the M3U8 format.
	M3U8Version3 = 3
)

Variables

View Source
var (
	M3U8Directives = []string{

		"EXTM3U",
		"EXTINF",
		"PLAYLIST",
		"EXTGRP",
		"EXTALB",
		"EXTART",
		"EXTGENRE",
		"EXTM3A",
		"EXTBYT",
		"EXTBIN",
		"EXTENC",
		"EXTIMG",

		"EXT-X-START",
		"EXT-X-INDEPENDENT-SEGMENTS",
		"EXT-X-PLAYLIST-TYPE",
		"EXT-X-TARGETDURATION",
		"EXT-X-VERSION",
		"EXT-X-MEDIA-SEQUENCE",
		"EXT-X-MEDIA",
		"EXT-X-STREAM-INF",
		"EXT-X-BYTERANGE",
		"EXT-X-DISCONTINUITY",
		"EXT-X-DISCONTINUITY-SEQUENCE",
		"EXT-X-GAP",
		"EXT-X-KEY",
		"EXT-X-MAP",
		"EXT-X-PROGRAM-DATE-TIME",
		"EXT-X-DATERANGE",
		"EXT-X-I-FRAMES-ONLY",
		"EXT-X-SESSION-DATA",
		"EXT-X-SESSION-KEY",
		"EXT-X-ENDLIST",

		"EXTVLCOPT",

		"KODIPROP",

		"M3UPROXYHEADER",
	}
)

Functions

This section is empty.

Types

type M3UEntries added in v0.0.3

type M3UEntries []M3UEntry

func (M3UEntries) RemoveByTvgTag added in v0.0.3

func (entries M3UEntries) RemoveByTvgTag(tag string, value string)

func (M3UEntries) SearchByTvgTag added in v0.0.7

func (entries M3UEntries) SearchByTvgTag(tag string, value string) *M3UEntry

func (M3UEntries) SearchIndexByTvgTag added in v0.0.7

func (entries M3UEntries) SearchIndexByTvgTag(tag string, value string) int

type M3UEntry

type M3UEntry struct {
	URI      string     `json:"uri"`      // The URI of the media.
	Duration int        `json:"duration"` // The duration of the media in seconds (if available).
	Title    string     `json:"title"`    // The title of the media (if available).
	Tags     M3UTags    `json:"tags"`     // Additional tags associated with the entry.
	TVGTags  M3UTvgTags `json:"tvg_tags"` // Additional tags associated with the entry.
}

M3UEntry represents a single entry in the M3U file.

func (*M3UEntry) AddTag added in v0.0.12

func (entry *M3UEntry) AddTag(tag string, value string)

func (*M3UEntry) ClearTags added in v0.0.12

func (entry *M3UEntry) ClearTags()

func (*M3UEntry) RemoveTags added in v0.0.12

func (entry *M3UEntry) RemoveTags(tag string)

func (*M3UEntry) SearchTags added in v0.0.7

func (entry *M3UEntry) SearchTags(tag string) []M3UTag

func (*M3UEntry) String

func (entry *M3UEntry) String() string

type M3UPlaylist

type M3UPlaylist struct {
	Version int        // The version of the M3U (EXTM3U).
	Entries M3UEntries // The list of media entries in the playlist.
	Tags    M3UTags    // Additional tags associated with the entry.
}

M3UPlaylist represents the parsed M3U playlist.

func ParseM3UFile

func ParseM3UFile(filePath string) (*M3UPlaylist, error)

ParseM3UFile reads an M3U file and returns a parsed M3UPlaylist.

func (*M3UPlaylist) EntriesString added in v0.0.3

func (playlist *M3UPlaylist) EntriesString() string

func (*M3UPlaylist) GetEntries

func (playlist *M3UPlaylist) GetEntries() M3UEntries

func (*M3UPlaylist) GetVersion

func (playlist *M3UPlaylist) GetVersion() int

func (*M3UPlaylist) RemoveEntryByTvgTag added in v0.0.3

func (playlist *M3UPlaylist) RemoveEntryByTvgTag(tag, value string)

func (*M3UPlaylist) SearchEntryByTitle added in v0.0.7

func (playlist *M3UPlaylist) SearchEntryByTitle(title string) *M3UEntry

func (*M3UPlaylist) SearchEntryByTvgTag added in v0.0.7

func (playlist *M3UPlaylist) SearchEntryByTvgTag(tag, value string) *M3UEntry

func (*M3UPlaylist) SearchEntryByURI added in v0.0.7

func (playlist *M3UPlaylist) SearchEntryByURI(uri string) *M3UEntry

func (*M3UPlaylist) SearchEntryIndexByTvgTag added in v0.0.7

func (playlist *M3UPlaylist) SearchEntryIndexByTvgTag(tag, value string) int

func (*M3UPlaylist) StreamCount added in v0.0.7

func (playlist *M3UPlaylist) StreamCount() int

func (*M3UPlaylist) String

func (playlist *M3UPlaylist) String() string

type M3UTag

type M3UTag struct {
	Tag   string
	Value string
}

type M3UTags added in v0.0.3

type M3UTags []M3UTag

func (M3UTags) GetValue added in v0.0.3

func (tags M3UTags) GetValue(tag string) string

type M3UTvgTag added in v0.0.3

type M3UTvgTag struct {
	Tag   string
	Value string
}

func (*M3UTvgTag) String added in v0.0.3

func (tag *M3UTvgTag) String() string

type M3UTvgTags added in v0.0.3

type M3UTvgTags []M3UTvgTag

func ParseTVGTags added in v0.0.3

func ParseTVGTags(data string) M3UTvgTags

func (M3UTvgTags) GetValue added in v0.0.3

func (tags M3UTvgTags) GetValue(tag string) string

func (M3UTvgTags) String added in v0.0.3

func (tags M3UTvgTags) String() string

Jump to

Keyboard shortcuts

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