library

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: GPL-2.0, GPL-3.0 Imports: 1 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"
	TypeClip    = "clip"
)

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.

Variables

View Source
var KnownSessionMediaTypes = map[string]bool{
	TypeMovie: true, TypeEpisode: true, TypeTrack: true, TypeClip: true, TypePhoto: true,
}

KnownSessionMediaTypes is the set of media types valid as Prometheus label values for session metrics. Unknown values are normalised to "other" by the collector.

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