mediaserver

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectServerType

func DetectServerType(ctx context.Context, serverURL string) (config.SourceType, error)

DetectServerType probes a server URL to determine if it's Plex or Jellyfin. Returns the detected SourceType or an error if detection fails.

Types

type AuthFlow

type AuthFlow interface {
	// Run executes the authentication flow and returns credentials.
	// The serverURL parameter is the base URL of the media server.
	// Implementations handle their own user interaction (prompting for credentials, etc.)
	Run(ctx context.Context, serverURL string) (*AuthResult, error)
}

AuthFlow defines a generic authentication flow for any media server. Different backends implement this differently: - Plex: PIN-based OAuth flow (display PIN -> user visits plex.tv/link -> poll for token) - Jellyfin: Username/password authentication

func NewAuthFlow

func NewAuthFlow(serverType config.SourceType, logger *slog.Logger) (AuthFlow, error)

NewAuthFlow creates the appropriate AuthFlow based on server type. - Plex: PIN-based OAuth flow (display PIN -> user visits plex.tv/link -> poll for token) - Jellyfin: Username/password authentication

type AuthResult

type AuthResult struct {
	Token    string // Access token for API calls
	UserID   string // User identifier (required for Jellyfin)
	Username string // Display username
}

AuthResult contains the result of a successful authentication

type MediaSource

type MediaSource interface {
	domain.LibraryClient  // Browsing: GetLibraries, GetMovies, GetShows, GetSeasons, GetEpisodes
	domain.PlaybackClient // Playback: ResolvePlayableURL, MarkPlayed/Unplayed
	domain.SearchClient   // Search: Search(query) across all libraries
	domain.PlaylistClient // Playlists: GetPlaylists, CreatePlaylist, AddToPlaylist, etc.

	// GetMediaItem fetches full metadata for a single item.
	// Kept on MediaSource (not in a domain interface) as it's only used
	// by specific features that need detailed item metadata.
	GetMediaItem(ctx context.Context, itemID string) (*domain.MediaItem, error)
}

MediaSource combines all client interfaces that a media server backend must implement. This is the unified interface for browsing, playback, search, and playlist operations.

func NewClient

func NewClient(cfg *config.Config, logger *slog.Logger) (MediaSource, error)

NewClient creates a new MediaSource based on the server type. This factory function abstracts away the specific backend implementation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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