extract

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 10 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 extract holds extract status and item types shared by the daemon, hooks, and folders.

Index

Constants

View Source
const (
	WAITING = Status(iota)
	QUEUED
	EXTRACTING
	EXTRACTFAILED
	EXTRACTED
	IMPORTED
	DELETING
	DELETEFAILED // unused
	DELETED
	EXTRACTEDNOTHING
)

Extract Statuses.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extract

type Extract struct {
	Syncthing bool
	// SplitFlac splits FLAC and APE images referenced by a CUE sheet.
	SplitFlac bool
	// APEFormat is ape, wav, or flac. Empty means ape.
	APEFormat xtractr.AudioFormat
	// APECompression is the Monkey's Audio level used when APEFormat is ape.
	// A default of 0 is set to 2000.
	APECompression int
	Retries        uint
	// HookFail is how many webhook or command-hook deliveries failed for this extract.
	HookFail uint
	// HookMessages maps webhook/cmdhook instance slug to Discord message id or Telegram message_id.
	HookMessages map[string]string
	Path         string // Local path (resolved for extraction on this host).
	OutputPath   string // Original path from Starr app (may be UNC/remote — used for ManualImport).
	App          starr.App
	// Name is an optional Starr instance label for logs, hooks, and the dashboard.
	// Empty uses App (Sonarr, Radarr, Folder, …). App stays the dialect for logic.
	Name        string
	URL         string
	Updated     time.Time
	DeleteDelay time.Duration
	DeleteOrig  bool
	Status      Status
	// Due is the next status-timer deadline. The main loop stamps it so HTTP
	// queue snapshots do not read live config or the folder tracker.
	Due     time.Time
	DueKind string
	IDs     map[string]any
	Resp    *xtractr.Response
	XProg   *Progress
	// Note is a short waiting-state caption for the live queue (e.g. no archives yet).
	Note string
	// Event is how an item arrived: fsnotify, polling, later manual. Starr omits it for now.
	Event string
	// PreFiles maps cleaned full paths present in each archive dest before
	// extraction to their Lstat info (nil when the stat failed). Dest folders
	// come from FindCompressedFiles so nested archive dirs are included.
	// Snapshot once per queue item; retries must not fold in leftovers that
	// failed to clear.
	PreFiles map[string]os.FileInfo
	// NoRetry is set for limit errors, remnant_action=off, or exhausted retries.
	// EXTRACTFAILED must not re-enter the retry loop or be promoted to DELETED
	// (that bounces a still-completed Starr item back to WAITING).
	NoRetry bool
	// MaxBytes is the resolved byte cap for this Starr item (0 = unlimited).
	MaxBytes uint64
}

Extract holds data for files being extracted.

func (*Extract) Label

func (e *Extract) Label() string

Label is the human-facing instance name, or the dialect when Name is empty.

type Progress

type Progress struct {
	*xtractr.Progress
	// Extract that exists in the map.
	*Extract
	// Number of archives in this Extract.
	Archives int
	// Number of archives extracted from this Extract.
	Extracted int
	// SpeedBps is the current archive rate over the last sample interval.
	SpeedBps uint64
	// AvgSpeedBps is (completed archive bytes + current have) / extract duration.
	AvgSpeedBps uint64
	// ETA is when the current archive should finish, based on AvgSpeedBps.
	ETA time.Time
	// contains filtered or unexported fields
}

Progress holds the progress for an entire Extract. An Extract is "a new item in a watch folder" or "a download in a starr app". Either may produce multiple xtractr.XFile structs (extractable archives).

func (*Progress) NoteArchiveDone

func (p *Progress) NoteArchiveDone()

NoteArchiveDone folds the finished archive into the extract total and clears the current-speed sample so the next archive starts a new interval.

func (*Progress) NoteSpeed

func (p *Progress) NoteSpeed(now time.Time)

NoteSpeed updates current/average speeds and ETA from byte counts.

func (*Progress) ResetSpeed

func (p *Progress) ResetSpeed()

ResetSpeed clears speed samples for a new extract.

func (*Progress) String

func (p *Progress) String() string

type Status

type Status uint8

Status is our enum for an extract's status.

func (Status) Desc

func (status Status) Desc() string

Desc makes Status human readable.

func (Status) MarshalText

func (status Status) MarshalText() ([]byte, error)

MarshalText turns a status into a word, for a json identifier.

func (Status) String

func (status Status) String() string

String turns a status into a short string.

func (*Status) UnmarshalText

func (status *Status) UnmarshalText(text []byte) error

UnmarshalText turns a json identifier or TOML event ID back into a status.

Jump to

Keyboard shortcuts

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