library

package
v2.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: GPL-2.0, GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package library declares the Library value type used to represent a Plex library (Movies, TV, Music, etc.) along with the pure classification helpers (IsType, ContentTypeLabel, Build, ItemCountTypes). It depends only on the plexapi wire types; all behaviour here is deterministic and side-effect free.

Index

Constants

View Source
const (
	TypeMovie     = "movie"
	TypeShow      = "show"
	TypeArtist    = "artist"
	TypePhoto     = "photo"
	TypeHomevideo = "homevideo"
)

Library types recognised by the exporter. Values match the Plex server's "type" field on a library directory; they are part of the frozen wire/log/metric contract and must not change.

View Source
const (
	TypeEpisode = "episode"
	TypeTrack   = "track"
)

Session media types observed in Plex playback notifications.

View Source
const (
	PluginIdentifier = "com.plexapp.plugins.library"
	FeatureContent   = "content"
	CountLabelItems  = "items"
)

Plex API identifiers and feature types.

View Source
const MaxLibraries = 256

MaxLibraries bounds the number of library sections the exporter tracks and emits metrics for. Like sessions.MaxTrackedSessions, it caps Prometheus label cardinality (one series set per library) against a compromised or buggy Plex server returning an unbounded list of distinct numeric section IDs in /media/providers.

Variables

This section is empty.

Functions

func ContentTypeLabel

func ContentTypeLabel(libType string) string

ContentTypeLabel returns the plural noun used as the "content_type" Prometheus label for libraries of libType.

func IsType

func IsType(t string) bool

IsType reports whether t is a library type the exporter emits metrics for.

func ItemCountTypes

func ItemCountTypes(libType string) []string

ItemCountTypes returns the `type=` query params to try in order for the given library type. Empty string means no filter (default path).

Types

type Library

type Library struct {
	ID, Name, Type string
	DurationTotal  int64
	StorageTotal   int64
	ItemsCount     int64
}

Library is a Plex library (section) entry. Fields are exported because consumers elsewhere in the exporter read them directly.

func Build

func Build(providers plexapi.MediaProviderResponse, prevItems map[string]int64) []Library

Build extracts library entries from the media providers response, preserving existing item counts from prevItems.

Jump to

Keyboard shortcuts

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