medialib

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package medialib provides higher-level abstractions for media library services.

Index

Constants

This section is empty.

Variables

View Source
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.
	// expectedSize is the size of the local source file in bytes. It is used
	// as a post-check tiebreaker when the scan command finishes with no
	// successful imports: if the library item's stored file matches
	// expectedSize, the import is treated as having succeeded (typically
	// because the arr service's own completed-download handler raced our
	// scan). A non-positive expectedSize disables the post-check.
	ImportByFilePath(ctx context.Context, path string, expectedSize int64) 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 {
	// contains filtered or unexported fields
}

Episode represents an episode entry in a TV library service. Construct with NewEpisode.

func NewEpisode added in v0.0.6

func NewEpisode(id, seriesID int64, title, seriesTitle string, year, seasonNumber, episodeNumber int) *Episode

NewEpisode returns an Episode populated with the supplied metadata. id and seriesID are the internal database IDs assigned by the backing TV library service. year is the series premiere year.

func (*Episode) GetEpisodeNumber

func (e *Episode) GetEpisodeNumber() int

GetEpisodeNumber returns the episode's episode number.

func (*Episode) GetID

func (e *Episode) GetID() int64

GetID returns the episode's ID.

func (*Episode) GetSeasonNumber

func (e *Episode) GetSeasonNumber() int

GetSeasonNumber returns the episode's season number.

func (*Episode) GetSeriesTitle

func (e *Episode) GetSeriesTitle() string

GetSeriesTitle returns the episode's series title.

func (*Episode) GetTitle

func (e *Episode) GetTitle() string

GetTitle returns the episode's title.

func (*Episode) GetYear

func (e *Episode) GetYear() int

GetYear returns the series premiere year.

func (*Episode) SeriesID

func (e *Episode) SeriesID() int64

SeriesID returns the internal database ID of the series this episode belongs to. Used by the Sonarr client for series-level lookups (e.g. fetching the series poster).

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.

const (
	// MovieType identifies movie files.
	MovieType MediaType = "movie"
	// ShowType identifies TV show episode files.
	ShowType MediaType = "show"
)

func AllMediaTypes added in v0.0.6

func AllMediaTypes() []MediaType

AllMediaTypes returns the canonical list of valid MediaType values. It is the single source of truth shared by runtime validation and JSON Schema generation.

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 {
	// contains filtered or unexported fields
}

Movie represents a movie entry in a movie library service. Construct with NewMovie.

func NewMovie added in v0.0.6

func NewMovie(id int64, title string, year int) *Movie

NewMovie returns a Movie populated with the supplied metadata. id is the internal database ID assigned by the backing movie library service.

func (*Movie) GetEpisodeNumber

func (m *Movie) GetEpisodeNumber() int

GetEpisodeNumber returns 0 for movies.

func (*Movie) GetID

func (m *Movie) GetID() int64

GetID returns the movie's ID.

func (*Movie) GetSeasonNumber

func (m *Movie) GetSeasonNumber() int

GetSeasonNumber returns 0 for movies.

func (*Movie) GetSeriesTitle

func (m *Movie) GetSeriesTitle() string

GetSeriesTitle returns "" for movies.

func (*Movie) GetTitle

func (m *Movie) GetTitle() string

GetTitle returns the movie's title.

func (*Movie) GetYear

func (m *Movie) GetYear() int

GetYear returns the movie's release year.

Directories

Path Synopsis
internal
arrcommand
Package arrcommand provides shared polling logic for waiting on Sonarr/Radarr long-running commands (e.g.
Package arrcommand provides shared polling logic for waiting on Sonarr/Radarr long-running commands (e.g.
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.ArrLibrary.
Package radarr provides a Radarr client implementing medialib.ArrLibrary.
Package sonarr provides a Sonarr client implementing medialib.ArrLibrary.
Package sonarr provides a Sonarr client implementing medialib.ArrLibrary.

Jump to

Keyboard shortcuts

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