youtube

package
v1.0.1-0...-a7812af Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package youtube provides loading audio from video files for given youtube channels

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelService

type ChannelService interface {
	Get(ctx context.Context, chanID string, feedType ytfeed.Type) ([]ytfeed.Entry, error)
}

ChannelService is an interface for getting channel entries, i.e. the list of videos

type DownloaderService

type DownloaderService interface {
	Get(ctx context.Context, id string, fname string) (file string, err error)
}

DownloaderService is an interface for downloading audio from youtube

type DurationService

type DurationService interface {
	File(fname string) int
}

DurationService is an interface for getting duration of audio file

type FeedFilter

type FeedFilter struct {
	Include string `yaml:"include"`
	Exclude string `yaml:"exclude"`
}

FeedFilter contains filter criteria for the feed

type FeedInfo

type FeedInfo struct {
	Name     string      `yaml:"name"`
	ID       string      `yaml:"id"`
	Type     ytfeed.Type `yaml:"type"`
	Keep     int         `yaml:"keep"`
	Language string      `yaml:"lang"`
	Filter   FeedFilter  `yaml:"filter"`
}

FeedInfo contains channel or feed ID, readable name and other per-feed info

type RSSFileStore

type RSSFileStore struct {
	Location string
	Enabled  bool
}

RSSFileStore is a store for RSS feed files

func (*RSSFileStore) Save

func (s *RSSFileStore) Save(chanID, rss string) error

Save RSS feed file to the FS

type Service

type Service struct {
	Feeds           []FeedInfo
	Downloader      DownloaderService
	ChannelService  ChannelService
	Store           StoreService
	CheckDuration   time.Duration
	RSSFileStore    RSSFileStore
	DurationService DurationService
	KeepPerChannel  int
	RootURL         string
	SkipShorts      time.Duration
}

Service loads audio from youtube channels

func (*Service) Do

func (s *Service) Do(ctx context.Context) error

Do is a blocking function that downloads audio from youtube channels and updates metadata

func (*Service) RSSFeed

func (s *Service) RSSFeed(fi FeedInfo) (string, error)

RSSFeed generates RSS feed for given channel

func (*Service) RemoveEntry

func (s *Service) RemoveEntry(entry ytfeed.Entry) error

RemoveEntry deleted entry from store. Doesn't removes file

func (*Service) StoreRSS

func (s *Service) StoreRSS(chanID, rss string) error

StoreRSS saves RSS feed to file

type StoreService

type StoreService interface {
	Save(entry ytfeed.Entry) (bool, error)
	Load(channelID string, max int) ([]ytfeed.Entry, error)
	Exist(entry ytfeed.Entry) (bool, error)
	RemoveOld(channelID string, keep int) ([]string, error)
	Remove(entry ytfeed.Entry) error
	SetProcessed(entry ytfeed.Entry) error
	ResetProcessed(entry ytfeed.Entry) error
	CheckProcessed(entry ytfeed.Entry) (found bool, ts time.Time, err error)
	CountProcessed() (count int)
}

StoreService is an interface for storing and loading metadata about downloaded audio

Directories

Path Synopsis
Package feed provided parser and downloader for youtube feeds and entries.
Package feed provided parser and downloader for youtube feeds and entries.
Package store provides a store for the youtube service metadata
Package store provides a store for the youtube service metadata

Jump to

Keyboard shortcuts

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