Help us shape the future of Go! Take the 2026 Go Developer Survey

view

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package view holds shared HTML view models for Outtake pages and widgets.

Index

Constants

View Source
const (
	// ClipSortCreatedDesc lists newest created clips first.
	ClipSortCreatedDesc = catalog.SortCreatedDesc
	// ClipSortCreatedAsc lists oldest created clips first.
	ClipSortCreatedAsc = catalog.SortCreatedAsc
	// ClipSortUpdatedDesc lists recently modified clips first.
	ClipSortUpdatedDesc = catalog.SortUpdatedDesc
	// ClipSortUpdatedAsc lists oldest modified clips first.
	ClipSortUpdatedAsc = catalog.SortUpdatedAsc
	// ClipSortNameAsc lists clips by display name A-Z.
	ClipSortNameAsc = catalog.SortNameAsc
	// ClipSortNameDesc lists clips by display name Z-A.
	ClipSortNameDesc = catalog.SortNameDesc
)
View Source
const (
	// DefaultGIFWidth is the GIF export width used when a clip carries none.
	DefaultGIFWidth = 480
	// DefaultGIFFPS is the GIF export frame rate used when a clip carries none.
	DefaultGIFFPS = 10
)
View Source
const (
	// MediaSortTitleAsc lists titles A-Z.
	MediaSortTitleAsc = library.SortTitleAsc
	// MediaSortTitleDesc lists titles Z-A.
	MediaSortTitleDesc = library.SortTitleDesc
	// MediaSortYearDesc lists newest years first.
	MediaSortYearDesc = library.SortYearDesc
	// MediaSortYearAsc lists oldest years first.
	MediaSortYearAsc = library.SortYearAsc
	// MediaSortAddedDesc lists recently added titles first.
	MediaSortAddedDesc = library.SortAddedDesc
	// MediaSortAddedAsc lists oldest added titles first.
	MediaSortAddedAsc = library.SortAddedAsc

	// JumpOtherKey is the mark for a jump target that is neither a letter, a year, nor a month.
	JumpOtherKey = library.JumpOtherKey
)
View Source
const (
	// PlaceholderNoLimit names a limit that is off.
	PlaceholderNoLimit = "No limit"
	// PlaceholderClipMaximum names a longest clip left to the installation.
	PlaceholderClipMaximum = "Installation maximum"
)

Placeholders of an empty limit field.

View Source
const FormerUser = "Former user"

FormerUser names the owner of a clip whose account was removed.

Variables

This section is empty.

Functions

func AnySelectable added in v0.4.0

func AnySelectable(items []ClipItem) bool

AnySelectable reports whether a list holds a card its viewer may change, which its bulk actions can select.

Parameters:

  • items: The cards.

Returns:

  • selectable: True when any card is not read only.

func ApplySource added in v0.4.0

func ApplySource(item *ClipItem, source library.SourceInfo)

ApplySource fills in what a clip card knows from probing its source.

It sets the audio tracks the source offers, whether the card shows the HDR choice, and the source length the window is checked against. A source that could not be probed leaves them empty.

Parameters:

  • item: The card to fill in.
  • source: What probing the clip's source turned up.

func AudioTrackLabel added in v0.3.0

func AudioTrackLabel(stream library.AudioStream) string

AudioTrackLabel builds a short description of an audio stream.

Parameters:

  • stream: Probed audio stream.

Returns:

  • label: Language, codec, layout, and title joined for display.

func BarStyle added in v0.4.0

func BarStyle(percent float64) string

BarStyle returns the inline style that sizes a progress bar.

The width is written to a tenth of a percent, so a slow encode's bar still moves between polls.

Parameters:

  • percent: How far to draw the bar, from 0 to 100.

Returns:

  • style: The bar's inline style, such as "width: 42.6%".

func ClipTypeLabel

func ClipTypeLabel(clipType clip.Type) string

ClipTypeLabel is the user-facing name for a clip type.

Parameters:

  • clipType: Clip type recorded for the clip.

Returns:

  • label: The display name, or Video Clip for a type that is neither kind.

func ContextWithFailure added in v0.4.0

func ContextWithFailure(parent context.Context, failure Failure) context.Context

ContextWithFailure stores the failure a page renders in its banner slot.

Parameters:

  • parent: Parent context.
  • failure: The failure to show.

Returns:

  • ctx: Derived context that carries the failure.

func ContextWithManager added in v0.4.0

func ContextWithManager(parent context.Context, manages bool) context.Context

ContextWithManager records whether the viewer manages the installation.

The layout reads it to show the settings only the owner and admins may open. The admin guard, not the layout, refuses everyone else.

Parameters:

  • parent: The request's context.
  • manages: True for the owner or an admin.

Returns:

  • ctx: The context carrying the flag.

func ContextWithOwner added in v0.4.0

func ContextWithOwner(parent context.Context, owns bool) context.Context

ContextWithOwner records whether the viewer owns the installation.

The layout reads it to show the Servers page, which only the owner may open. The owner guard, not the layout, refuses everyone else.

Parameters:

  • parent: The request's context.
  • owns: True for the owner.

Returns:

  • ctx: The context carrying the flag.

func FormatBytes added in v0.4.0

func FormatBytes(size uint64) string

FormatBytes writes a size in decimal units.

Sizes under a kilobyte are counted in bytes. Larger ones take one decimal, left out when it is zero.

Parameters:

  • size: The size in bytes.

Returns:

  • text: Such as "512 bytes", "6 MB", or "18.4 GB".

func FormatClipCreated added in v0.3.0

func FormatClipCreated(created time.Time) string

FormatClipCreated renders a clip timestamp for display, or blank when unset.

Parameters:

  • created: Clip creation time.

Returns:

  • stamp: Formatted UTC timestamp, or an empty string for a zero time.

func GIFFPSOrDefault added in v0.3.0

func GIFFPSOrDefault(fps int) int

GIFFPSOrDefault returns the GIF export frame rate to show.

Parameters:

  • fps: Carried GIF frame rate, where zero means the field was never set.

Returns:

  • value: fps when it was carried, otherwise DefaultGIFFPS.

func GIFWidthOrDefault added in v0.3.0

func GIFWidthOrDefault(width int) int

GIFWidthOrDefault returns the GIF export width to show.

Parameters:

  • width: Carried GIF width, where zero means the field was never set.

Returns:

  • value: width when it was carried, otherwise DefaultGIFWidth.

func MoreClipsURL added in v0.4.0

func MoreClipsURL(path string, query catalog.ClipListQuery, page catalog.ClipPage) string

MoreClipsURL builds the address of a clip list's next page.

The address keeps the list's filters, sort, and Shared view, and names the page's last clip and how many clips came before the next page.

Parameters:

  • path: The list's route, such as /clips.
  • query: Normalized toolbar state the page was read with.
  • page: The page just shown.

Returns:

  • address: The next page's address, empty when no clip follows.

func RemainingLabel added in v0.4.0

func RemainingLabel(started, now time.Time, percent int) string

RemainingLabel says how long an encode has left, from the rate it has had since it started.

Parameters:

  • started: When the encode began, zero when it has not.
  • now: The time to estimate from.
  • percent: How far the encode has got, from 0 to 100.

Returns:

  • label: Such as "2m 34s left", or empty when there is no estimate yet.

func SeasonLabel added in v0.3.0

func SeasonLabel(item plex.MediaItem) string

SeasonLabel returns ParentTitle, or Season N from ParentIndex.

Parameters:

  • item: Media item the session is playing.

Returns:

  • label: The parent title, a season name, or an empty string.

func SessionBrowseURL added in v0.3.0

func SessionBrowseURL(libraryID, itemID, itemTitle, parentID, parentTitle string) string

SessionBrowseURL returns a container browse URL when library and item ids exist.

Parameters:

  • libraryID: Library the container belongs to.
  • itemID: Container to browse.
  • itemTitle: Container title for the link.
  • parentID: Optional show id the container sits under.
  • parentTitle: Optional show title for the link.

Returns:

  • location: Browse URL, or an empty string when an id is missing.

func SessionItemURL added in v0.3.0

func SessionItemURL(id string) string

SessionItemURL returns the media item path when id is set.

Parameters:

  • id: Plex media item id.

Returns:

  • location: Media item URL, or an empty string when the id is unset.

func SortSelected added in v0.3.0

func SortSelected(current, value, fallback string) bool

SortSelected reports whether a sort option is the active one.

Parameters:

  • current: Active sort key, or empty when the query carried none.
  • value: Sort key the option being rendered stands for.
  • fallback: Sort key shown when current is empty.

Returns:

  • selected: True when the option is the active one.

func StatusLabel added in v0.4.0

func StatusLabel(status clip.Status) string

StatusLabel is the user-facing name for a clip's status, as its badge shows it.

A processing clip reads as rendering, the word the export form and the preview use.

Parameters:

  • status: The clip's status.

Returns:

  • label: The badge text, or the status itself for one it does not name.

func ThumbSrc added in v0.3.0

func ThumbSrc(path string) string

ThumbSrc rewrites a Plex thumb path onto the local cache proxy.

Parameters:

  • path: Plex thumb path, which may be empty or malformed.

Returns:

  • proxyURL: Local thumb proxy URL, or empty when the path cannot be proxied.

func TitleJumpKey added in v0.3.0

func TitleJumpKey(titleSort, title string) string

TitleJumpKey returns the first-letter jump key for a title.

Parameters:

  • titleSort: PMS titleSort value, preferred when set.
  • title: Display title used when titleSort is empty.

Returns:

  • key: A through Z, or JumpOtherKey for anything else.

func UsageLabel added in v0.4.0

func UsageLabel(renders int, bytes int64) string

UsageLabel describes what a user's clips take.

Parameters:

  • renders: Renders started in the last seven days.
  • bytes: Bytes the user's clips take.

Returns:

  • label: Such as "3 renders this week · 1.2 GB".

func ViewerManages added in v0.4.0

func ViewerManages(ctx context.Context) bool

ViewerManages reports whether a page's viewer manages the installation.

Parameters:

  • ctx: The render's context.

Returns:

  • manages: True for the owner or an admin, false when nothing recorded it.

func ViewerOwns added in v0.4.0

func ViewerOwns(ctx context.Context) bool

ViewerOwns reports whether a page's viewer owns the installation.

Parameters:

  • ctx: The render's context.

Returns:

  • owns: True for the owner, false when nothing recorded it.

Types

type Audience added in v0.4.0

type Audience struct {
	// Names are the installation's usernames by plex.tv id, nil when they
	// could not be read.
	Names map[int]string
	// Scope is whose clips the viewer may change.
	Scope clip.Scope
}

Audience is who a page shows clip cards to.

func NewAudience added in v0.4.0

func NewAudience(scope clip.Scope, names map[int]string, err error) Audience

NewAudience builds the audience of a page from the usernames it read.

Usernames that could not be read leave every card without an owner's name and offer no sharing, rather than failing the page.

Parameters:

  • scope: Whose clips the viewer may change.
  • names: The installation's usernames by plex.tv id.
  • err: Why the usernames could not be read, or nil.

Returns:

  • audience: The audience.

func (Audience) Apply added in v0.4.0

func (audience Audience) Apply(item *ClipItem, owner int)

Apply marks what the viewer may do with a clip and whose it is.

A clip the viewer may not change is read only. A clip they may change can be shared once the installation has another user to share it with. Another account's clip names its owner.

Parameters:

  • item: The card, changed in place.
  • owner: The plex.tv id of the account that made the clip.

func (Audience) ApplyEach added in v0.4.0

func (audience Audience) ApplyEach(items []ClipItem, jobs []*clip.Job)

ApplyEach marks every card in a list.

Parameters:

  • items: The cards, changed in place, in the order of jobs.
  • jobs: The clips the cards were built from.

func (Audience) Shares added in v0.4.0

func (audience Audience) Shares() bool

Shares reports whether the installation has another user to share clips with.

Returns:

  • shares: True once a second user is known.

type AudioTrackOption

type AudioTrackOption struct {
	Index int
	Label string
}

AudioTrackOption is a probed audio stream in an audio select.

func AudioTrackOptions added in v0.3.0

func AudioTrackOptions(streams []library.AudioStream) []AudioTrackOption

AudioTrackOptions maps probed audio streams onto select options.

Parameters:

  • streams: Probed audio streams.

Returns:

  • options: One form option per stream, in probe order.

type ClipItem

type ClipItem struct {
	ID         string
	Name       string
	MediaID    string
	MediaTitle string
	ClipType   clip.Type
	Status     clip.Status
	Progress   int
	// BarPercent is how far the progress bar is drawn, which moves between
	// the whole percents Progress counts.
	BarPercent float64
	CreatedAt  string
	// FileVersion changes whenever the clip is rendered again, so the file
	// URL changes with it. Chromium reuses media it loaded for a URL within
	// the same page without asking the server, whatever the cache headers say.
	FileVersion   string
	StartTime     time.Duration
	Duration      time.Duration
	Quality       string
	ProfileName   string
	Profiles      []profile.ProfileOption
	FileExists    bool
	AudioIndex    int
	AudioTracks   []AudioTrackOption
	CropBlackBars bool
	PreserveHDR   bool
	SourceHDR     bool
	// SDRExists reports that the clip's SDR version is stored, so the card
	// plays it where the clip's HDR file cannot be shown.
	SDRExists bool
	// Stage is which encode of a running render Progress counts.
	Stage clip.Stage
	// Remaining says how long the running encode has left, empty until there
	// is an estimate.
	Remaining string
	// OutputFormat is what the clip's own file holds, zero when never read.
	OutputFormat clip.Format
	// SDRFormat is what the clip's SDR version holds, zero when never read.
	SDRFormat     clip.Format
	MediaDuration time.Duration
	Width         int
	FPS           int
	MaxDur        time.Duration
	Error         string
	// ErrorDetails is the technical report behind Error, empty when Error
	// says all there is.
	ErrorDetails string
	// OwnerName names the account that made the clip, empty when it is the
	// viewer's own.
	OwnerName string
	// Shared reports that the clip's owner shares it with the installation's
	// other users.
	Shared bool
	// ReadOnly reports that the viewer may play and download the clip but
	// not change it.
	ReadOnly bool
	// CanShare reports that the viewer may share the clip or make it private.
	CanShare bool
}

ClipItem is one clip card on the clips list and media item pages.

func NewClipItem added in v0.3.0

func NewClipItem(
	job *clip.Job,
	options []profile.ProfileOption,
	limit time.Duration,
	fileExists bool,
) ClipItem

NewClipItem maps a job onto a card the clips list and a clip update both show.

Parameters:

  • job: Render the card is built from.
  • profiles: Profiles the card offers as a quality choice.
  • limit: Longest clip the installation accepts.
  • fileExists: Whether the job's output is still on disk.

Returns:

  • item: Page model for the clip card.

func NewClipItems added in v0.3.0

func NewClipItems(
	jobs []*clip.Job,
	options []profile.ProfileOption,
	limit time.Duration,
	fileExists func(string) bool,
) []ClipItem

NewClipItems maps jobs onto the cards the clips list and a media item page show.

Both resolve the profiles and the output checks the same way for every row.

Parameters:

  • jobs: Renders to show.
  • options: Profiles every card offers as a quality choice.
  • limit: Longest clip the installation accepts.
  • fileExists: Whether a file is still stored, asked of each job's output and of its SDR version when it may have one.

Returns:

  • items: One page model per clip, in the order the clips were given.

func (*ClipItem) CanPlay

func (item *ClipItem) CanPlay() bool

CanPlay reports whether a completed clip file is available for preview.

Returns:

  • playable: True when status is completed and the file exists.

func (*ClipItem) DisplayName

func (item *ClipItem) DisplayName() string

DisplayName returns the clip name, or the media title when the name is empty.

Returns:

  • name: The label shown on clip cards.

func (*ClipItem) EndTime

func (item *ClipItem) EndTime() time.Duration

EndTime is the clip end as start plus duration.

Returns:

  • end: StartTime + Duration.

func (*ClipItem) FileBadge added in v0.4.0

func (item *ClipItem) FileBadge() string

FileBadge names what the clip's own file holds, for a card with no SDR version.

Returns:

  • label: Such as "SDR · 1080p", empty when the file was never read.

func (*ClipItem) GIFFPS

func (item *ClipItem) GIFFPS() int

GIFFPS is the GIF frame rate, or the New export default when unset.

Returns:

  • fps: Stored fps, or 10 when FPS is 0.

func (*ClipItem) GIFWidth

func (item *ClipItem) GIFWidth() int

GIFWidth is the GIF export width, or the New export default when unset.

Returns:

  • width: Stored width, or 480 when Width is 0.

func (*ClipItem) HDRBadge added in v0.4.0

func (item *ClipItem) HDRBadge() string

HDRBadge names the HDR file a card with an SDR version can switch to.

A clip with an SDR version keeps HDR, so its file is HDR even when it was never read.

Returns:

  • label: Such as "HDR · 4K", or "HDR" when the file was never read.

func (*ClipItem) IsActive

func (item *ClipItem) IsActive() bool

IsActive reports whether the clip is still queued or encoding.

Returns:

  • active: True when status is pending or processing.

func (*ClipItem) LacksSDRVersion added in v0.4.0

func (item *ClipItem) LacksSDRVersion() bool

LacksSDRVersion reports a playable HDR clip with no SDR version, such as one rendered before SDR versions existed.

Its card plays the HDR file and says a regenerate makes one.

Returns:

  • lacks: True when the clip keeps HDR from an HDR source but has no SDR version stored.

func (*ClipItem) RendersSDRVersion added in v0.4.0

func (item *ClipItem) RendersSDRVersion() bool

RendersSDRVersion reports that the running render has moved on to the SDR version, so the clip's own encode is done.

Returns:

  • sdr: True while the SDR version encodes.

func (*ClipItem) SDRBadge added in v0.4.0

func (item *ClipItem) SDRBadge() string

SDRBadge names the SDR version a card plays by default.

Returns:

  • label: Such as "SDR · 1080p", or "SDR" when the version was never read.

type ClipProfileItem added in v0.3.0

type ClipProfileItem struct {
	ID        string
	Name      string
	CRF       int
	Preset    string
	AudioKbps int
	MaxWidth  int
	IsDefault bool
	// KeepHDR reports whether a video clip rendered with this profile keeps HDR.
	KeepHDR bool
	// CopyVideo reports whether a video clip rendered with this profile copies
	// a source that fits.
	CopyVideo bool
}

ClipProfileItem is one editable clip profile on the settings page.

func ClipProfileItems added in v0.3.0

func ClipProfileItems(stored []profile.Profile) []ClipProfileItem

ClipProfileItems maps stored clip profiles onto the settings page models.

Parameters:

  • stored: Profiles the page lists.

Returns:

  • items: One page model per profile, in the order the profiles were given.

type Crumb

type Crumb struct {
	Title string
	URL   string
}

Crumb is one step in the media library trail.

func ItemCrumbs added in v0.3.0

func ItemCrumbs(item plex.MediaItem, libs []LibraryItem) []Crumb

ItemCrumbs builds Libraries / library / show / season / title for a media item.

Parameters:

  • item: Media item being rendered.
  • libs: Discovered libraries, used to resolve the library title.

Returns:

  • crumbs: The full trail, ending with the item's own title.

func MediaCrumbs added in v0.3.0

func MediaCrumbs(libs []LibraryItem, libraryID, upID, upTitle, title string) []Crumb

MediaCrumbs builds the library, container, and current title trail for a browse view.

Parameters:

  • libs: Discovered libraries, used to resolve the library title.
  • libraryID: Library the browse view is scoped to.
  • upID: Parent container id to link back to.
  • upTitle: Parent container title.
  • title: Current container title, shown without a link.

Returns:

  • crumbs: Trail from the library root down to the current container.

func SessionTitleParts added in v0.3.0

func SessionTitleParts(item plex.MediaItem) ([]Crumb, int)

SessionTitleParts builds dashboard title crumbs for a live session.

Parameters:

  • item: Media item the session is playing.

Returns:

  • parts: Title crumbs, which may be a single plain-text crumb.
  • year: Release year, reported only for a non-episode.

type ExportForm added in v0.3.0

type ExportForm struct {
	// Type is the export kind: clip, gif, or screenshot.
	Type clip.Type
	// Name is the user-supplied clip name.
	Name string
	// Quality is the selected clip profile id.
	Quality string
	// AudioIndex is the selected audio stream index on the source.
	AudioIndex int
	// Width is the GIF export width in pixels.
	Width int
	// FPS is the GIF export frame rate.
	FPS int
	// CropBlackBars is the trim-black-bars toggle.
	CropBlackBars bool
}

ExportForm is the New export form state on the media item page.

func (ExportForm) ApplyToQuery added in v0.3.0

func (form ExportForm) ApplyToQuery(values url.Values)

ApplyToQuery writes the export form state onto a query string, so a redirect can carry the form as it was submitted.

Parameters:

  • values: Query values to mutate.

type Failure added in v0.4.0

type Failure struct {
	// Message says what went wrong in plain words.
	Message string `json:"message"`
	// Details is the technical report: the version, time, request, reference,
	// and error chain. It is empty when the message says all there is.
	Details string `json:"details"`
}

Failure is an error as a page shows it.

It holds a plain message and the details someone debugging it or reporting an issue needs. The page keeps the details in a collapsed Details section with a copy button.

func FailureFromContext added in v0.4.0

func FailureFromContext(ctx context.Context) Failure

FailureFromContext returns the failure a page renders in its banner slot.

Parameters:

  • ctx: Render context, optionally carrying a failure.

Returns:

  • failure: The stored failure, or an empty one.

func NewNotice added in v0.4.0

func NewNotice(message string) Failure

NewNotice is a failure with a message and no details, for a refusal the message explains in full, such as a field that needs a value.

Parameters:

  • message: The plain message.

Returns:

  • failure: The failure, empty when message is.

func (Failure) Empty added in v0.4.0

func (failure Failure) Empty() bool

Empty reports whether there is nothing to show.

Returns:

  • empty: True when the failure has no message.

type LetterIndex

type LetterIndex = library.LetterIndex

LetterIndex is one first-character jump target on a library section.

type LibraryItem

type LibraryItem struct {
	ID        string
	Title     string
	Type      string
	ThumbPath string
}

LibraryItem is a Plex library in the sidebar and media browse grid.

func LibraryItems added in v0.3.0

func LibraryItems(libs []plex.Library) []LibraryItem

LibraryItems maps Plex libraries onto page models.

Parameters:

  • libs: Plex libraries.

Returns:

  • items: Page models in the order Plex returned them.

type LimitFields added in v0.4.0

type LimitFields struct {
	// Active is the concurrent renders.
	Active string
	// Weekly is the renders per week.
	Weekly string
	// StorageGB is the storage in gigabytes.
	StorageGB string
	// ClipSeconds is the longest clip in seconds.
	ClipSeconds string
}

LimitFields are a limits form's values as text.

func GlobalLimitFields added in v0.4.0

func GlobalLimitFields(limits quota.Limits) LimitFields

GlobalLimitFields fills the global limits form.

A limit that is off is left empty, which its placeholder names.

Parameters:

  • limits: The limits every member has.

Returns:

  • fields: Each limit as text, empty where there is no limit.

func LimitPlaceholders added in v0.4.0

func LimitPlaceholders(global LimitFields) LimitFields

LimitPlaceholders names what each empty limit field stands for.

Parameters:

  • global: The global limits as their form shows them, all empty for the global form itself.

Returns:

  • placeholders: Each global value, or what no limit means for that field.

func OverrideFields added in v0.4.0

func OverrideFields(override quota.Override) LimitFields

OverrideFields fills one user's limits form.

Parameters:

  • override: The user's own limits.

Returns:

  • fields: Each limit as text, empty where the user takes the global one.

type MediaItem

type MediaItem struct {
	ID           string
	Title        string
	Type         string
	Duration     time.Duration
	ThumbPath    string
	Browsable    bool
	BrowseURL    string
	Year         int
	Index        int
	ParentIndex  int
	ShowTitle    string
	EpisodeLabel string
	TitleSort    string
	AddedAt      int64
}

MediaItem is one title or container in the media library grid.

func MediaItems added in v0.3.0

func MediaItems(
	items []plex.MediaItem,
	libraryID, parentID, parentTitle string,
) []MediaItem

MediaItems maps Plex media onto page models.

Parameters:

  • items: Plex media items from a listing or a search.
  • libraryID: Section key every card is filed under, which overrides the one the item carries.
  • parentID: Rating key of the container being drilled into.
  • parentTitle: Title of that container, carried on the drill-down link.

Returns:

  • items: Page models in the order Plex returned them.

type MediaProps

type MediaProps struct {
	Items       []MediaItem
	Libraries   []LibraryItem
	Crumbs      []Crumb
	Letters     []LetterIndex
	Query       string
	LibraryID   string
	ParentID    string
	ParentTitle string
	UpID        string
	UpTitle     string
	Sort        string
	Letter      string
	Start       int
	Total       int
	PageSize    int
	HasServer   bool
}

MediaProps is the media library page and its HTMX results fragment.

type Playback

type Playback struct {
	// Playing reports a Plex session on the item.
	Playing bool
	// Paused reports a paused client, whose position is exact.
	Paused bool
	// ViewOffset is the position Plex last reported.
	ViewOffset time.Duration
	// Title is the session's title.
	Title string
	// PositionURL is where the mark buttons read the position fresh.
	PositionURL string
}

Playback is live Plex playback for a media item.

type ServerItem added in v0.3.0

type ServerItem struct {
	Key      string
	Name     string
	Address  string
	Port     int
	Scheme   string
	Local    bool
	Relay    bool
	Selected bool
}

ServerItem is one discovered Plex server connection.

It carries no token: the page posts Key, and the token is looked up again from Plex.

func ServerItems added in v0.3.0

func ServerItems(servers []plex.Server, current plex.Server) []ServerItem

ServerItems maps discovered servers onto the server picker models.

Parameters:

  • servers: Discovered servers.
  • current: Currently bound server, used to mark the selection.

Returns:

  • items: One page model per discovered server, in the order they arrived.

type SessionItem added in v0.3.0

type SessionItem struct {
	ID         string
	MediaID    string
	Parts      []Crumb
	Year       int
	ViewOffset time.Duration
	Duration   time.Duration
}

SessionItem is one live Plex playback session.

func SessionItems added in v0.3.0

func SessionItems(sessions []plex.Session) []SessionItem

SessionItems maps live Plex sessions onto the dashboard models.

Parameters:

  • sessions: Sessions playing right now.

Returns:

  • items: One page model per live session, in the order they arrived.

func (SessionItem) ResumeURL added in v0.3.0

func (item SessionItem) ResumeURL() string

ResumeURL is where the Clip now link points, carrying the playback offset.

Returns:

  • location: Media item URL starting at the offset, or an empty string when the session plays something without a media id.

type UserItem added in v0.4.0

type UserItem struct {
	// Limits are the user's own limits as form text, empty where the user
	// takes the limit every member has.
	Limits LimitFields
	// Username is the Plex username.
	Username string
	// Role is the role's name, such as "Member".
	Role string
	// LastLogin is when the user last logged in, such as "Oct 12, 2026".
	LastLogin string
	// Usage is what the user's clips take, such as "3 renders this week ·
	// 1.2 GB".
	Usage string
	// PlexID is the plex.tv account id the forms post.
	PlexID int
	// Pending is true for an account waiting for approval.
	Pending bool
	// CanApprove shows Approve and Reject.
	CanApprove bool
	// CanRemove shows Remove.
	CanRemove bool
	// CanLimit shows the user's limits form.
	CanLimit bool
	// CanMakeAdmin shows Make Admin.
	CanMakeAdmin bool
	// CanMakeMember shows Make Member.
	CanMakeMember bool
}

UserItem is one user as the users page shows them.

Jump to

Keyboard shortcuts

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