Documentation
¶
Index ¶
- Variables
- type ChannelMapping
- type ChannelMappingUpdate
- type ChannelsProvider
- func (p *ChannelsProvider) GetCustomMapping(ctx context.Context, lineupID string) (map[string]string, error)
- func (p *ChannelsProvider) ListDeviceChannels(ctx context.Context) (map[string]DVRDeviceChannel, error)
- func (p *ChannelsProvider) ListLineupStations(ctx context.Context, lineupID string) ([]DVRStation, error)
- func (p *ChannelsProvider) ListLineups(ctx context.Context) ([]DVRLineup, error)
- func (p *ChannelsProvider) PutCustomMapping(ctx context.Context, lineupID string, patch map[string]string) error
- func (p *ChannelsProvider) RedownloadGuideLineup(ctx context.Context, lineupID string) error
- func (p *ChannelsProvider) RefreshDevices(ctx context.Context) error
- func (p *ChannelsProvider) RefreshGuideStations(ctx context.Context) error
- func (p *ChannelsProvider) ReloadDeviceLineup(ctx context.Context, deviceID string) error
- func (p *ChannelsProvider) Type() ProviderType
- type ConfigState
- type DVRDeviceChannel
- type DVRLineup
- type DVRProvider
- type DVRStation
- type InstanceConfig
- type JellyfinProvider
- func (p *JellyfinProvider) GetCustomMapping(context.Context, string) (map[string]string, error)
- func (p *JellyfinProvider) ListDeviceChannels(context.Context) (map[string]DVRDeviceChannel, error)
- func (p *JellyfinProvider) ListLineupStations(context.Context, string) ([]DVRStation, error)
- func (p *JellyfinProvider) ListLineups(context.Context) ([]DVRLineup, error)
- func (p *JellyfinProvider) PutCustomMapping(context.Context, string, map[string]string) error
- func (p *JellyfinProvider) RedownloadGuideLineup(context.Context, string) error
- func (p *JellyfinProvider) RefreshDevices(context.Context) error
- func (p *JellyfinProvider) RefreshGuideStations(context.Context) error
- func (p *JellyfinProvider) ReloadDeviceLineup(ctx context.Context, deviceID string) error
- func (p *JellyfinProvider) Type() ProviderType
- type LineupSyncResult
- type ProviderType
- type ReverseSyncRequest
- type ReverseSyncResult
- type Service
- func (s *Service) GetChannelMapping(ctx context.Context, channelID int64) (ChannelMapping, error)
- func (s *Service) GetState(ctx context.Context) (ConfigState, error)
- func (s *Service) ListChannelMappings(ctx context.Context, enabledOnly bool, includeDynamic bool) ([]ChannelMapping, error)
- func (s *Service) ListChannelMappingsPaged(ctx context.Context, enabledOnly bool, includeDynamic bool, limit int, ...) ([]ChannelMapping, int, error)
- func (s *Service) ListLineups(ctx context.Context, refresh bool) ([]DVRLineup, error)
- func (s *Service) ReloadLineup(ctx context.Context) error
- func (s *Service) ReloadLineupForPlaylistSync(ctx context.Context) (bool, bool, string, error)
- func (s *Service) ReverseSync(ctx context.Context, req ReverseSyncRequest) (ReverseSyncResult, error)
- func (s *Service) ReverseSyncChannel(ctx context.Context, channelID int64, req ReverseSyncRequest) (ReverseSyncResult, error)
- func (s *Service) Sync(ctx context.Context, req SyncRequest) (SyncResult, error)
- func (s *Service) TestConnection(ctx context.Context) (TestResult, error)
- func (s *Service) UpdateChannelMapping(ctx context.Context, channelID int64, update ChannelMappingUpdate) (ChannelMapping, error)
- func (s *Service) UpdateConfig(ctx context.Context, instance InstanceConfig) (ConfigState, error)
- type Store
- type SyncMode
- type SyncRequest
- type SyncResult
- type TestResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrDVRSyncConfig = errors.New("dvr sync configuration error") ErrSyncAlreadyRunning = errors.New("dvr sync already running") )
var (
ErrUnsupportedProvider = errors.New("unsupported dvr provider")
)
Functions ¶
This section is empty.
Types ¶
type ChannelMapping ¶
type ChannelMapping struct {
ChannelID int64 `json:"channel_id"`
GuideNumber string `json:"guide_number"`
GuideName string `json:"guide_name"`
Enabled bool `json:"enabled"`
DVRInstanceID int64 `json:"dvr_instance_id"`
DVRLineupID string `json:"dvr_lineup_id,omitempty"`
DVRLineupChannel string `json:"dvr_lineup_channel,omitempty"`
DVRStationRef string `json:"dvr_station_ref,omitempty"`
DVRCallsignHint string `json:"dvr_callsign_hint,omitempty"`
}
ChannelMapping stores per-channel DVR lineup association metadata.
type ChannelMappingUpdate ¶
type ChannelMappingUpdate struct {
DVRLineupID string `json:"dvr_lineup_id"`
DVRLineupChannel string `json:"dvr_lineup_channel"`
DVRStationRef string `json:"dvr_station_ref"`
DVRCallsignHint string `json:"dvr_callsign_hint"`
}
ChannelMappingUpdate is a write payload for one published channel mapping.
type ChannelsProvider ¶
type ChannelsProvider struct {
// contains filtered or unexported fields
}
ChannelsProvider implements DVRProvider against Channels DVR server APIs.
func NewChannelsProvider ¶
func NewChannelsProvider(baseURL string, client *http.Client) *ChannelsProvider
func (*ChannelsProvider) GetCustomMapping ¶
func (*ChannelsProvider) ListDeviceChannels ¶
func (p *ChannelsProvider) ListDeviceChannels(ctx context.Context) (map[string]DVRDeviceChannel, error)
func (*ChannelsProvider) ListLineupStations ¶
func (p *ChannelsProvider) ListLineupStations(ctx context.Context, lineupID string) ([]DVRStation, error)
func (*ChannelsProvider) ListLineups ¶
func (p *ChannelsProvider) ListLineups(ctx context.Context) ([]DVRLineup, error)
func (*ChannelsProvider) PutCustomMapping ¶
func (*ChannelsProvider) RedownloadGuideLineup ¶
func (p *ChannelsProvider) RedownloadGuideLineup(ctx context.Context, lineupID string) error
func (*ChannelsProvider) RefreshDevices ¶
func (p *ChannelsProvider) RefreshDevices(ctx context.Context) error
func (*ChannelsProvider) RefreshGuideStations ¶
func (p *ChannelsProvider) RefreshGuideStations(ctx context.Context) error
func (*ChannelsProvider) ReloadDeviceLineup ¶
func (p *ChannelsProvider) ReloadDeviceLineup(ctx context.Context, deviceID string) error
func (*ChannelsProvider) Type ¶
func (p *ChannelsProvider) Type() ProviderType
type ConfigState ¶
type ConfigState struct {
Instance InstanceConfig `json:"instance"`
CachedLineups []DVRLineup `json:"cached_lineups,omitempty"`
CachedLineupsAt int64 `json:"cached_lineups_at,omitempty"`
LastSync *SyncResult `json:"last_sync,omitempty"`
}
ConfigState is the API view of DVR integration state.
type DVRDeviceChannel ¶
type DVRDeviceChannel struct {
Key string `json:"key"`
DeviceID string `json:"device_id,omitempty"`
Number string `json:"number,omitempty"`
Name string `json:"name,omitempty"`
CallSign string `json:"call_sign,omitempty"`
StationRef string `json:"station_ref,omitempty"`
}
DVRDeviceChannel represents one provider device channel entry.
type DVRProvider ¶
type DVRProvider interface {
Type() ProviderType
ListLineups(ctx context.Context) ([]DVRLineup, error)
ReloadDeviceLineup(ctx context.Context, deviceID string) error
RefreshGuideStations(ctx context.Context) error
RedownloadGuideLineup(ctx context.Context, lineupID string) error
ListDeviceChannels(ctx context.Context) (map[string]DVRDeviceChannel, error)
ListLineupStations(ctx context.Context, lineupID string) ([]DVRStation, error)
GetCustomMapping(ctx context.Context, lineupID string) (map[string]string, error)
PutCustomMapping(ctx context.Context, lineupID string, patch map[string]string) error
RefreshDevices(ctx context.Context) error
}
DVRProvider encapsulates one provider implementation.
type DVRStation ¶
type DVRStation struct {
StationRef string `json:"station_ref"`
LineupChannel string `json:"lineup_channel,omitempty"`
CallSign string `json:"call_sign,omitempty"`
Name string `json:"name,omitempty"`
}
DVRStation represents one station entry inside a lineup.
type InstanceConfig ¶
type InstanceConfig struct {
ID int64 `json:"id"`
Provider ProviderType `json:"provider"`
ActiveProviders []ProviderType `json:"active_providers,omitempty"`
BaseURL string `json:"base_url"`
ChannelsBaseURL string `json:"channels_base_url,omitempty"`
JellyfinBaseURL string `json:"jellyfin_base_url,omitempty"`
DefaultLineupID string `json:"default_lineup_id,omitempty"`
SyncEnabled bool `json:"sync_enabled"`
SyncCron string `json:"sync_cron,omitempty"`
SyncMode SyncMode `json:"sync_mode"`
PreSyncRefreshDevices bool `json:"pre_sync_refresh_devices"`
JellyfinAPIToken string `json:"jellyfin_api_token,omitempty"`
JellyfinAPITokenConfigured bool `json:"jellyfin_api_token_configured,omitempty"`
JellyfinTunerHostID string `json:"jellyfin_tuner_host_id,omitempty"`
UpdatedAt int64 `json:"updated_at"`
}
InstanceConfig stores one DVR integration endpoint configuration.
type JellyfinProvider ¶
type JellyfinProvider struct {
// contains filtered or unexported fields
}
JellyfinProvider implements DVRProvider against Jellyfin Live TV APIs.
func NewJellyfinProvider ¶
func NewJellyfinProvider(instance InstanceConfig, client *http.Client) *JellyfinProvider
func (*JellyfinProvider) GetCustomMapping ¶
func (*JellyfinProvider) ListDeviceChannels ¶
func (p *JellyfinProvider) ListDeviceChannels(context.Context) (map[string]DVRDeviceChannel, error)
func (*JellyfinProvider) ListLineupStations ¶
func (p *JellyfinProvider) ListLineupStations(context.Context, string) ([]DVRStation, error)
func (*JellyfinProvider) ListLineups ¶
func (p *JellyfinProvider) ListLineups(context.Context) ([]DVRLineup, error)
func (*JellyfinProvider) PutCustomMapping ¶
func (*JellyfinProvider) RedownloadGuideLineup ¶
func (p *JellyfinProvider) RedownloadGuideLineup(context.Context, string) error
func (*JellyfinProvider) RefreshDevices ¶
func (p *JellyfinProvider) RefreshDevices(context.Context) error
func (*JellyfinProvider) RefreshGuideStations ¶
func (p *JellyfinProvider) RefreshGuideStations(context.Context) error
func (*JellyfinProvider) ReloadDeviceLineup ¶
func (p *JellyfinProvider) ReloadDeviceLineup(ctx context.Context, deviceID string) error
func (*JellyfinProvider) Type ¶
func (p *JellyfinProvider) Type() ProviderType
type LineupSyncResult ¶
type LineupSyncResult struct {
LineupID string `json:"lineup_id"`
ConfiguredChannels int `json:"configured_channels"`
ResolvedChannels int `json:"resolved_channels"`
UpdatedCount int `json:"updated_count"`
ClearedCount int `json:"cleared_count"`
UnchangedCount int `json:"unchanged_count"`
AppliedCount int `json:"applied_count"`
}
LineupSyncResult captures one lineup's sync work.
type ProviderType ¶
type ProviderType string
ProviderType identifies one DVR provider implementation.
const ( ProviderChannels ProviderType = "channels" ProviderJellyfin ProviderType = "jellyfin" )
type ReverseSyncRequest ¶
type ReverseSyncRequest struct {
DryRun bool `json:"dry_run"`
LineupID string `json:"lineup_id,omitempty"`
IncludeDynamic bool `json:"include_dynamic,omitempty"`
}
ReverseSyncRequest controls pull direction sync (DVR -> hdhriptv mappings).
type ReverseSyncResult ¶
type ReverseSyncResult struct {
StartedAt int64 `json:"started_at"`
FinishedAt int64 `json:"finished_at"`
DurationMS int64 `json:"duration_ms"`
DryRun bool `json:"dry_run"`
Provider string `json:"provider"`
BaseURL string `json:"base_url"`
HDHRDeviceID string `json:"hdhr_device_id,omitempty"`
LineupID string `json:"lineup_id"`
DeviceChannelCount int `json:"device_channel_count"`
FilteredChannelCount int `json:"filtered_channel_count"`
CandidateCount int `json:"candidate_count"`
ImportedCount int `json:"imported_count"`
UnchangedCount int `json:"unchanged_count"`
MissingTunerCount int `json:"missing_tuner_count"`
MissingMappingCount int `json:"missing_mapping_count"`
MissingStationRefCount int `json:"missing_station_ref_count"`
Warnings []string `json:"warnings,omitempty"`
}
ReverseSyncResult summarizes a reverse sync run.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates provider access, sync operations, and mapping persistence.
func NewService ¶
func (*Service) GetChannelMapping ¶
func (*Service) ListChannelMappings ¶
func (*Service) ListChannelMappingsPaged ¶
func (*Service) ListLineups ¶
func (*Service) ReloadLineupForPlaylistSync ¶
ReloadLineupForPlaylistSync performs playlist-sync-triggered lineup refresh with provider-aware gating and optional multi-provider fan-out. Missing Jellyfin credentials are treated as explicit non-fatal skips.
func (*Service) ReverseSync ¶
func (s *Service) ReverseSync(ctx context.Context, req ReverseSyncRequest) (ReverseSyncResult, error)
func (*Service) ReverseSyncChannel ¶
func (s *Service) ReverseSyncChannel( ctx context.Context, channelID int64, req ReverseSyncRequest, ) (ReverseSyncResult, error)
func (*Service) Sync ¶
func (s *Service) Sync(ctx context.Context, req SyncRequest) (SyncResult, error)
func (*Service) TestConnection ¶
func (s *Service) TestConnection(ctx context.Context) (TestResult, error)
func (*Service) UpdateChannelMapping ¶
func (s *Service) UpdateChannelMapping( ctx context.Context, channelID int64, update ChannelMappingUpdate, ) (ChannelMapping, error)
func (*Service) UpdateConfig ¶
func (s *Service) UpdateConfig(ctx context.Context, instance InstanceConfig) (ConfigState, error)
type Store ¶
type Store interface {
GetDVRInstance(ctx context.Context) (InstanceConfig, error)
UpsertDVRInstance(ctx context.Context, instance InstanceConfig) (InstanceConfig, error)
ListChannelsForDVRSync(ctx context.Context, dvrInstanceID int64, enabledOnly bool, includeDynamic bool) ([]ChannelMapping, error)
ListChannelsForDVRSyncPaged(ctx context.Context, dvrInstanceID int64, enabledOnly bool, includeDynamic bool, limit, offset int) ([]ChannelMapping, int, error)
GetChannelDVRMapping(ctx context.Context, dvrInstanceID, channelID int64) (ChannelMapping, error)
UpsertChannelDVRMapping(ctx context.Context, mapping ChannelMapping) (ChannelMapping, error)
DeleteChannelDVRMapping(ctx context.Context, dvrInstanceID, channelID int64) error
}
Store describes persistence operations required by DVR integration.
type SyncRequest ¶
type SyncRequest struct {
DryRun bool `json:"dry_run"`
IncludeDynamic bool `json:"include_dynamic,omitempty"`
}
SyncRequest controls sync execution behavior.
type SyncResult ¶
type SyncResult struct {
StartedAt int64 `json:"started_at"`
FinishedAt int64 `json:"finished_at"`
DurationMS int64 `json:"duration_ms"`
DryRun bool `json:"dry_run"`
Provider string `json:"provider"`
BaseURL string `json:"base_url"`
HDHRDeviceID string `json:"hdhr_device_id,omitempty"`
SyncMode SyncMode `json:"sync_mode"`
DeviceChannelCount int `json:"device_channel_count"`
FilteredChannelCount int `json:"filtered_channel_count"`
UpdatedCount int `json:"updated_count"`
ClearedCount int `json:"cleared_count"`
UnchangedCount int `json:"unchanged_count"`
MissingTunerCount int `json:"missing_tuner_count"`
UnresolvedCount int `json:"unresolved_count"`
Lineups []LineupSyncResult `json:"lineups"`
Warnings []string `json:"warnings,omitempty"`
PatchPreview map[string]map[string]string `json:"patch_preview,omitempty"`
}
SyncResult summarizes one sync run.
type TestResult ¶
type TestResult struct {
Reachable bool `json:"reachable"`
Provider string `json:"provider"`
BaseURL string `json:"base_url"`
DeviceChannelCount int `json:"device_channel_count"`
FilteredChannelCount int `json:"filtered_channel_count"`
HDHRDeviceID string `json:"hdhr_device_id,omitempty"`
HDHRDeviceFilterActive bool `json:"hdhr_device_filter_active"`
}
TestResult summarizes provider connectivity.