organize

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenameFile added in v1.0.0

func RenameFile(filePath string, cfg RenameConfig, author, title, year string) (string, error)

RenameFile renames a file according to the configured pattern. Returns the new file path.

func VerifyEPUBTitle

func VerifyEPUBTitle(epubPath, expectedTitle string, threshold float64) (bool, string, error)

VerifyEPUBTitle checks that the EPUB's dc:title has >= threshold word overlap with the expected title. Returns true if verification passes.

Types

type AudioMeta

type AudioMeta struct {
	Artist string
	Album  string
	Title  string
}

AudioMeta holds extracted audio metadata.

func ExtractAudioMeta

func ExtractAudioMeta(path string) *AudioMeta

ExtractAudioMeta extracts metadata from an audio file. It tries to read ID3v2 tags from MP3 files by parsing the header directly. Falls back to filename parsing if no tags found.

func ExtractAudioMetaFromDir

func ExtractAudioMetaFromDir(dirPath string) *AudioMeta

ExtractAudioMetaFromDir scans a directory for audio files and extracts artist/album from the first valid file found.

type AudiobookScanner

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

AudiobookScanner periodically scans the audiobook directory for untracked files.

func NewAudiobookScanner

func NewAudiobookScanner(cfg *config.Config, database *db.DB, targets *LibraryTargets) *AudiobookScanner

NewAudiobookScanner creates a new audiobook folder scanner.

func (*AudiobookScanner) Start

func (s *AudiobookScanner) Start(ctx context.Context)

Start begins the background scan loop. It blocks until ctx is cancelled.

type EPUBMeta

type EPUBMeta struct {
	Title  string
	Author string
}

EPUBMeta holds extracted EPUB metadata.

func ExtractEPUBMeta

func ExtractEPUBMeta(path string) (*EPUBMeta, error)

ExtractEPUBMeta reads an EPUB file (ZIP archive) and extracts dc:title and dc:creator from the OPF metadata file.

type LibraryTargets

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

LibraryTargets handles importing organized files into external libraries.

func NewLibraryTargets

func NewLibraryTargets(cfg *config.Config) *LibraryTargets

NewLibraryTargets creates a new library targets handler.

func (*LibraryTargets) ABSAutoMatch

func (lt *LibraryTargets) ABSAutoMatch(itemID string)

ABSAutoMatch triggers Audible metadata match for a library item.

func (*LibraryTargets) ABSAutoMatchNewItems

func (lt *LibraryTargets) ABSAutoMatchNewItems(knownIDs map[string]bool)

ABSAutoMatchNewItems scans for new audiobook items and triggers Audible match.

func (*LibraryTargets) ABSCleanupDuplicateEbooks

func (lt *LibraryTargets) ABSCleanupDuplicateEbooks(title string)

ABSCleanupDuplicateEbooks checks for duplicate entries after ebook import. Keeps the Calibre version and removes ABS-only duplicates.

func (*LibraryTargets) ImportAudiobook

func (lt *LibraryTargets) ImportAudiobook()

ImportAudiobook triggers ABS library scan.

func (*LibraryTargets) ImportEbook

func (lt *LibraryTargets) ImportEbook(filePath, title, author string)

ImportEbook copies to Calibre library and triggers scans on ABS and Kavita.

func (*LibraryTargets) ImportManga

func (lt *LibraryTargets) ImportManga(filePath, seriesTitle string)

ImportManga copies to Kavita and Komga manga libraries and triggers scans.

type Organizer

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

Organizer handles post-download file organization.

func NewOrganizer

func NewOrganizer(cfg *config.Config) *Organizer

NewOrganizer creates a new file organizer.

func (*Organizer) OrganizeAudiobook

func (o *Organizer) OrganizeAudiobook(filePath, title, author string) (string, error)

OrganizeAudiobook moves audiobook files into the organized directory structure: {AudiobookDir}/{Author}/{Title}/

func (*Organizer) OrganizeEbook

func (o *Organizer) OrganizeEbook(filePath, title, author string) (string, error)

OrganizeEbook moves an ebook file into the organized directory structure: {EbookDir}/{Author}/{Title}/{file} Also copies to KAVITA_LIBRARY_PATH if configured.

func (*Organizer) OrganizeManga

func (o *Organizer) OrganizeManga(filePath, seriesTitle string) (string, error)

OrganizeManga moves manga files into the organized directory structure: {MangaDir}/{Series}/{file} Also copies to KAVITA_MANGA_LIBRARY_PATH if configured.

type RenameConfig added in v1.0.0

type RenameConfig struct {
	Enabled bool
	Pattern string // e.g., "{author} - {title} ({year}).{ext}"
}

RenameConfig holds configuration for file renaming on import.

Jump to

Keyboard shortcuts

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