Versions in this module Expand all Collapse all v0 v0.19.0 Feb 20, 2024 Changes in this version + const FragmentContentType + const FragmentExt + const ManifestName + const MasterPlaylistName + const PlaylistContentType + const PlaylistExt + const SchemeRemote + const SkipChecksum + var ErrStreamNotFound = errors.New("stream not found") + var LibraryBytes = prometheus.NewGauge(prometheus.GaugeOpts{ ... }) + var LibraryRetiredBytes = prometheus.NewCounter(prometheus.CounterOpts{ ... }) + var PopulatedHLSPlaylistFiles = []string + var SDHashRe = regexp.MustCompile(`/([A-Za-z0-9]{96})/`) + var SkipSegment = errors.New("skip fragment") + func GetStreamHasher() hash.Hash + func PopulateHLSPlaylist(t *testing.T, dstPath, sdHash string) + func RegisterMetrics() + func SetLogger(l *zap.SugaredLogger) + func SpawnLibraryCleaning(lib *Library, storageName string, maxSize uint64) chan struct + func StringToSize(s string) uint64 + func WalkStream(baseURI string, getFn StreamGetter, processFn StreamProcessor) error + func WithTimestamp(ts time.Time) func(*Manifest) + func WithVersion(v string) func(*Manifest) + func WithWorkerName(n string) func(*Manifest) + type Config struct + DB db.DBTX + Log logging.KVLogger + Storage Storage + type Library struct + func New(config Config) *Library + func (lib *Library) AddChannel(uri string, priority db.ChannelPriority) (db.Channel, error) + func (lib *Library) AddRemoteStream(stream Stream) error + func (lib *Library) GetAllChannels() ([]db.Channel, error) + func (lib *Library) GetVideo(sdHash string) (db.Video, error) + func (lib *Library) GetVideoURL(sdHash string) (string, error) + func (lib *Library) Retire(v db.Video) error + func (lib *Library) RetireVideos(storageName string, maxSize uint64) (uint64, uint64, error) + func (lib *Library) ValidateStreams(storageName string, offset, limit int32, remove bool) ([]string, []string, error) + type LibraryTestHelper struct + DB *sql.DB + DBCleanup migrator.TestDBCleanup + func (h *LibraryTestHelper) SetupLibraryDB() error + func (h *LibraryTestHelper) TearDownLibraryDB() error + type Manifest struct + ChannelURL string + Checksum string + FfmpegArgs string + Files []string + SDHash string + Size int64 + TID string + TranscodedAt time.Time + TranscodedBy string + URL string + Version string + type Storage interface + Delete func(streamTID string) error + GetURL func(tid string) string + Name func() string + Put func(stream *Stream, _ bool) error + type Stream struct + LocalPath string + Manifest *Manifest + RemoteStorage string + func GenerateDummyStream() *Stream + func InitStream(dir string, remoteStorage string) *Stream + func (s *Stream) Checksum() string + func (s *Stream) ChecksumValid(checksum string) bool + func (s *Stream) GenerateManifest(url, channel, sdHash string, manifestFuncs ...func(*Manifest)) error + func (s *Stream) ReadManifest() error + func (s *Stream) SDHash() string + func (s *Stream) Size() int64 + func (s *Stream) TID() string + func (s *Stream) URL() string + func (s *Stream) Walk(walker StreamWalker) error + type StreamGetter func(path ...string) (io.ReadCloser, error) + type StreamProcessor func(fgName string, r io.ReadCloser) error + type StreamWalker func(fi fs.FileInfo, fullPath, name string) error + type ValidationResult struct + Missing []string + Present []string + URL string + func ValidateStream(baseURL string, failFast bool, skipSegments bool) (*ValidationResult, error)