unit3d

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package unit3d builds and cleans descriptions shared by Unit3D trackers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendDVDVOBMediaInfoBlock

func AppendDVDVOBMediaInfoBlock(description string, meta api.DescriptionSubject) string

AppendDVDVOBMediaInfoBlock appends DVD VOB MediaInfo when meta contains it.

func BlurayBlock

func BlurayBlock(meta api.DescriptionSubject, appConfig config.Config) string

BlurayBlock renders the Blu-ray metadata section when applicable.

func BuildDescription

func BuildDescription(
	ctx context.Context,
	meta api.DescriptionSubject,
	appConfig config.Config,
	_ config.TrackerConfig,
	logger api.Logger,
	keptDescription string,
	menuImages []api.ScreenshotImage,
	screenshots []api.ScreenshotImage,
) (string, error)

BuildDescription composes the shared Unit3D upload description from prepared metadata and selected images. Existing NFO and known uploader signature blocks are removed; when screenshots are supplied, prior screenshot blocks are replaced. Case-insensitive duplicate top-level parts are skipped. The general MediaInfo payload intended for the upload API is not embedded, though DVD VOB MediaInfo may be rendered as a dedicated block.

func DVDVOBMediaInfoBlock

func DVDVOBMediaInfoBlock(meta api.DescriptionSubject) string

DVDVOBMediaInfoBlock renders MediaInfo for DVD VOB content.

func EpisodeOverviewBlock

func EpisodeOverviewBlock(meta api.DescriptionSubject, appConfig config.Config) string

EpisodeOverviewBlock renders the episode overview section when applicable.

func ResolveLogo(meta api.DescriptionSubject, appConfig config.Config) (string, int)

ResolveLogo returns the configured description logo URL and display width for meta.

func SaveDescriptionDebug

func SaveDescriptionDebug(meta api.DescriptionSubject, tracker string, dbPath string, description string, logger api.Logger)

SaveDescriptionDebug best-effort writes a tracker description diagnostic beneath the database's managed temp directory; newly created files use mode 0600. A blank dbPath is a no-op. Directory-resolution failures are silently ignored; write failures are logged when logger is non-nil, and no error is returned.

func ShouldIncludeTonemappedHeader

func ShouldIncludeTonemappedHeader(meta api.DescriptionSubject, appConfig config.Config, screenshots []api.ScreenshotImage) bool

ShouldIncludeTonemappedHeader reports whether the description should label tonemapped screenshots.

func UppbrrSignatureLink() (string, string)

UppbrrSignatureLink returns the project URL followed by the signature label used in descriptions.

Types

type Image

type Image struct {
	// ImgURL is the BBCode-ready image URL, which may point at a thumbnail.
	ImgURL string
	// RawURL is the direct image URL.
	RawURL string
	// WebURL is the image host's browser-facing page URL when available.
	WebURL string
	// Host is the normalized image-host name.
	Host string
}

Image describes an image extracted from a Unit3D description.

type Note

type Note struct {
	// Kind categorizes the note for downstream handling.
	Kind string
	// Message contains caller-visible detail about the condition.
	Message string
}

Note reports a non-fatal condition encountered while cleaning a Unit3D description.

type Report

type Report struct {
	// Description is the normalized BBCode that remains after cleanup.
	Description string
	// Images contains images removed or identified during cleanup.
	Images []Image
	// Notes contains non-fatal cleanup diagnostics.
	Notes []Note
}

Report contains a cleaned Unit3D description and extracted content.

func CleanDescription

func CleanDescription(description string, site string) Report

CleanDescription normalizes entities and site-local references, removes all image markup from the body, and returns the first non-poster image set. A leading poster-only set does not prevent a later screenshot set from being selected.

func CleanDescriptionBody

func CleanDescriptionBody(description string, site string) Report

CleanDescriptionBody applies the same entity and site-reference normalization as CleanDescription and removes all image markup without returning extracted images.

func CleanDescriptionImages

func CleanDescriptionImages(description string, site string) Report

CleanDescriptionImages returns the first non-poster image set after entity and site-reference normalization without producing a cleaned body.

Jump to

Keyboard shortcuts

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