thek

package
v0.0.0-...-ace887a Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EpgURL contains the query url for the epg informations
	// %s is the placeholder for the date in the format YYYY-MM-dd
	EpgURL = "https://www.zdf.de/live-tv?airtimeDate=%s"
	// EpgDescriptionURL is the base path to the show description
	EpgDescriptionURL = "https://www.zdf.de%s"
)
View Source
const (
	// RecorderBinary contains the name of the ffmpeg binary
	RecorderBinary = "ffmpeg"
)
View Source
const (
	// Version contains the version of the thek tool
	Version = "0.6.1"
)

Variables

View Source
var (
	// ConfigPath is the path to the config file to use
	ConfigPath string
	// EnableDebugging enables debugging
	EnableDebugging bool
	// EnableJSON enables json output
	EnableJSON bool
	// PrintVersion enables the version printing
	PrintVersion bool
)
View Source
var DateFormat = "2006-01-02"

DateFormat is the used format...douh

View Source
var Streams map[string]string

Streams contains the available streams

Functions

func CheckRecorder

func CheckRecorder() error

CheckRecorder checks if the Recorder binary is available

func FetchDocument

func FetchDocument(url string) (*goquery.Document, error)

FetchDocument fetches the website and returns a goquery Document

func LoadConfigFromFile

func LoadConfigFromFile(path string, config *Config) error

LoadConfigFromFile loads the schedule plan from a file

func LoadStreamsFromFile

func LoadStreamsFromFile(path string, streams *map[string]string) error

LoadStreamsFromFile loads the streams from the given file

func RecordVideo

func RecordVideo(stream, output string, duration time.Duration) error

RecordVideo records the given stream for the given duration and saves it to the given output

func SetupLogging

func SetupLogging(debug, json bool)

SetupLogging creates a logging instance

func WatchStreams

func WatchStreams() error

WatchStreams starts the daemon

Types

type Config

type Config struct {
	// Defaults contains all the default values which can be overwritten in other places
	Defaults struct {
		// DefaultOutputDir is the place where the videos will be saved to
		DefaultOutputDir string `yaml:"output_directory"`
		// DefaultSafetyDuration is the time before and after a video
		DefaultSafetyDuration string `yaml:"safety_duration"`
		// DefaultFileExistAction is the action in case a file already exist
		DefaultFileExistAction string `yaml:"file_exist_action"`
	} `yaml:"defaults"`

	// StationURLS is a station to stream mapping
	StationURLS map[string]string `yaml:"stations"`

	// RecorderSchedule contains all the recording tasks
	RecordingTasks []struct {
		// Station is the tv station to follow
		Station string `yaml:"station,omitempty"`
		// ShowKeywords are the words to look out for (all must match)
		ShowKeywords string `yaml:"show_keywords"`
		// SafetyDuration overwrites Defaults.DefaultSafetyDuration
		SafetyDuration string `yaml:"safety_duration,omitempty"`
		// OutputDir overwrites Defaults.DefaultOutputDir
		OutputDir string `yaml:"output_directory,omitempty"`
		// FileExistAction overwrites Defaults.DefaultFileExistAction
		FileExistAction string `yaml:"file_exist_action"`
	} `yaml:"recording_tasks"`
}

Config represents the config structure

var CurrentConfig Config

CurrentConfig is the current config...

type EpgEntry

type EpgEntry struct {
	Name      string
	SubTitle  string
	StartTime time.Time
	EndTime   time.Time
}

EpgEntry contains informations about a specific program

type Station

type Station struct {
	Name       string
	StreamURL  string
	EpgEntries []*EpgEntry
}

Station contains informations about the station

type StationController

type StationController struct {
	Stations []*Station
}

StationController holds the station array

func (*StationController) Tidy

func (sc *StationController) Tidy() error

Tidy cleans up old data

func (*StationController) UpdateStationsByDates

func (sc *StationController) UpdateStationsByDates(date []time.Time) error

UpdateStationsByDates updates the stations with data from the given dates

Jump to

Keyboard shortcuts

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