core

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaMeta

type MediaMeta struct {
	Type              MediaType
	NewName           string
	RenameStatus      RenameStatus
	RenameError       string
	IsVirtual         bool
	NeedsDirectory    bool
	MarkedForDeletion bool
}

MediaMeta holds per-node rename intent and results.

Fields:

  • Type: Media classification used for rule selection and statistics.
  • NewName: Proposed final name (filename or directory name). Empty implies no change or unknown format.
  • RenameStatus / RenameError: Outcome of the rename attempt. Error message is only populated when status == RenameStatusError.
  • IsVirtual: True when the node does not (yet) exist on disk; used for synthesized movie directories wrapping loose video files.
  • NeedsDirectory: Signals that a directory must be created before children are renamed beneath it (typically paired with IsVirtual).
  • MarkedForDeletion: True when the file should be deleted during rename operation.

The zero value is meaningful: it encodes an untyped, unprocessed node with no rename proposal.

func EnsureMeta

func EnsureMeta(n *treeview.Node[treeview.FileInfo]) *MediaMeta

EnsureMeta returns the existing *MediaMeta for n, creating and attaching a new instance if needed. The returned pointer is always non-nil.

func GetMeta

func GetMeta(n *treeview.Node[treeview.FileInfo]) *MediaMeta

GetMeta retrieves the existing *MediaMeta attached to n or nil when absent. It is safe to call with a nil node.

func (*MediaMeta) Fail

func (m *MediaMeta) Fail(err error) error

func (*MediaMeta) Success

func (m *MediaMeta) Success()

type MediaType

type MediaType int

MediaType enumerates the semantic classification of a node within the media library hierarchy.

const (
	MediaShow      MediaType = iota // Top‑level TV show directory
	MediaSeason                     // Season directory inside a show
	MediaEpisode                    // Individual episode file (video or subtitle)
	MediaMovie                      // Movie directory (real or virtual)
	MediaMovieFile                  // File inside a movie directory (video or subtitle)
)

type RenameStatus

type RenameStatus int

RenameStatus represents the lifecycle stage of a proposed rename operation. A node starts at RenameStatusNone; after execution it is marked success or error with an accompanying message when relevant.

const (
	RenameStatusNone    RenameStatus = iota // Rename not yet attempted, or no change needed
	RenameStatusSuccess                     // Rename succeeded
	RenameStatusError                       // Rename failed; see RenameError for detail
)

type SimpleFileInfo

type SimpleFileInfo struct {
	// contains filtered or unexported fields
}

SimpleFileInfo implements os.FileInfo for synthetic (virtual) nodes inserted into the tree (e.g. wrapping a standalone movie file in a virtual directory before materialization on disk).

func NewSimpleFileInfo

func NewSimpleFileInfo(name string, isDir bool) *SimpleFileInfo

func (*SimpleFileInfo) IsDir

func (m *SimpleFileInfo) IsDir() bool

func (*SimpleFileInfo) ModTime

func (m *SimpleFileInfo) ModTime() time.Time

func (*SimpleFileInfo) Mode

func (m *SimpleFileInfo) Mode() os.FileMode

func (*SimpleFileInfo) Name

func (m *SimpleFileInfo) Name() string

func (*SimpleFileInfo) Size

func (m *SimpleFileInfo) Size() int64

func (*SimpleFileInfo) Sys

func (m *SimpleFileInfo) Sys() any

Jump to

Keyboard shortcuts

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