medialib

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 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.
	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

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.

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.

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

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

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.

type MovieLibrary

type MovieLibrary interface {
	GetMovieByFilePath(ctx context.Context, path string) (Movie, error)
}

MovieLibrary provides operations for movie media items.

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.

Jump to

Keyboard shortcuts

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