Documentation
¶
Overview ¶
Package medialib provides higher-level abstractions for media library services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found in library")
ErrNotFound is returned when a media item is not found in the library.
Functions ¶
This section is empty.
Types ¶
type ArrLibrary ¶
type ArrLibrary interface {
// ImportByFilePath translates path to the arr service's view and sends a
// DownloadedMoviesScan (Radarr) or DownloadedEpisodesScan (Sonarr) command,
// triggering the arr service's normal download-completion import pipeline.
ImportByFilePath(ctx context.Context, path string) error
// GetInfo returns structured media metadata for the item at path.
// Returns ErrNotFound if no item is identified.
GetInfo(ctx context.Context, path string) (MediaInfo, error)
// GetPosterImage returns the raw poster image bytes and MIME type for the
// media item at path. Returns ErrNotFound if the media item at path cannot
// be identified in the library. Returns nil bytes and empty MIME type (with
// no error) when a media item is found but no poster is available or the
// image type is not JPEG or PNG. Other errors indicate the library service
// is unreachable or returned an unexpected failure.
GetPosterImage(ctx context.Context, path string) (imageBytes []byte, mimeType string, err error)
}
ArrLibrary is a unified interface for refreshing a media item in the backing library service (Radarr for movies, Sonarr for shows). It abstracts the type-specific lookup-and-refresh calls so workflow steps need no media-type switch.
type Episode ¶
type Episode struct {
// ID is the internal database ID assigned by the backing TV library service.
ID int64
// SeriesID is the internal database ID of the series this episode belongs to.
// Used internally by the Sonarr client for series-level refresh.
SeriesID int64
Title string
// Year is the series premiere year, sourced from the library service's series metadata.
Year int
SeriesTitle string
SeasonNumber int
EpisodeNumber int
}
Episode represents an episode entry in a TV library service.
func (*Episode) GetEpisodeNumber ¶
GetEpisodeNumber returns the episode's episode number.
func (*Episode) GetSeasonNumber ¶
GetSeasonNumber returns the episode's season number.
func (*Episode) GetSeriesTitle ¶
GetSeriesTitle returns the episode's series title.
type EpisodeLibrary ¶
type EpisodeLibrary interface {
GetEpisodeByFilePath(ctx context.Context, path string) (Episode, error)
}
EpisodeLibrary provides operations for episode media items.
type MediaInfo ¶
type MediaInfo interface {
GetID() int64
GetTitle() string
GetYear() int
GetSeriesTitle() string // movies return ""
GetSeasonNumber() int // movies return 0
GetEpisodeNumber() int // movies return 0
}
MediaInfo exposes typed getters for per-media metadata.
type MediaType ¶
type MediaType string
MediaType identifies whether a media file is a movie or a TV show episode.
func (MediaType) JSONSchema ¶
func (MediaType) JSONSchema() *jsonschema.Schema
JSONSchema returns a JSON Schema for MediaType restricting values to the valid types.
type Movie ¶
type Movie struct {
// ID is the internal database ID assigned by the backing movie library service.
ID int64
Title string
Year int
}
Movie represents a movie entry in a movie library service.
func (*Movie) GetEpisodeNumber ¶
GetEpisodeNumber returns 0 for movies.
func (*Movie) GetSeasonNumber ¶
GetSeasonNumber returns 0 for movies.
func (*Movie) GetSeriesTitle ¶
GetSeriesTitle returns "" for movies.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
artwork
Package artwork provides shared utilities for fetching poster images from arr-style media library services (Radarr, Sonarr).
|
Package artwork provides shared utilities for fetching poster images from arr-style media library services (Radarr, Sonarr). |
|
Package radarr provides a Radarr client implementing medialib.MovieLibrary.
|
Package radarr provides a Radarr client implementing medialib.MovieLibrary. |
|
Package sonarr provides a Sonarr client implementing medialib.EpisodeLibrary.
|
Package sonarr provides a Sonarr client implementing medialib.EpisodeLibrary. |