queue

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLockPath

func GetLockPath() (string, error)

GetLockPath returns the path to the queue lock file

func GetQueuePath

func GetQueuePath() (string, error)

GetQueuePath returns the path to the queue file

Types

type Queue

type Queue struct {
	Items       []*plex.MediaItem `json:"items"`
	LastUpdated time.Time         `json:"last_updated"`
}

Queue represents a persistent download queue

func Load

func Load() (*Queue, error)

Load reads the queue from disk with a shared lock for concurrent read safety

func (*Queue) Add

func (q *Queue) Add(items []*plex.MediaItem) int

Add appends items to the queue, avoiding duplicates by Key Returns the number of items actually added (excluding duplicates)

func (*Queue) Clear

func (q *Queue) Clear() error

Clear removes all items from the queue and deletes the file with exclusive lock

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

IsEmpty returns true if the queue has no items

func (*Queue) Len

func (q *Queue) Len() int

Len returns the number of items in the queue

func (*Queue) Remove

func (q *Queue) Remove(indices []int)

Remove removes items at specified indices from the queue

func (*Queue) RemoveByKeys

func (q *Queue) RemoveByKeys(keys []string) error

RemoveByKeys removes items with matching keys from the persisted queue. This method reloads from disk, removes the specified items, and saves back. This ensures items added by other instances while processing are preserved. The in-memory queue (q) is also updated to reflect the new state.

func (*Queue) Save

func (q *Queue) Save() error

Save writes the queue to disk with exclusive lock and atomic write for concurrent safety

Jump to

Keyboard shortcuts

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