mapping

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles AniList to provider mappings

func NewManager

func NewManager(db *gorm.DB, preferredProvider string, logger *slog.Logger) *Manager

NewManager creates a new mapping manager

func NewManagerWithDebug

func NewManagerWithDebug(db *gorm.DB, preferredProvider string, debug bool, logger *slog.Logger) *Manager

NewManagerWithDebug creates a new mapping manager with debug flag

func (*Manager) DeleteMapping

func (m *Manager) DeleteMapping(ctx context.Context, anilistID int) error

DeleteMapping removes a mapping from the database

func (*Manager) GetMapping

func (m *Manager) GetMapping(ctx context.Context, anilistID int) (*ProviderMapping, error)

GetMapping retrieves an existing mapping for an AniList ID

func (*Manager) GetOrCreateMapping

func (m *Manager) GetOrCreateMapping(ctx context.Context, anilistID int, title string, mediaType providers.MediaType) (*ProviderMapping, []providers.Media, error)

GetOrCreateMapping retrieves an existing mapping or searches the provider Returns the mapping if it exists, or search results for user selection

func (*Manager) RemapMedia

func (m *Manager) RemapMedia(ctx context.Context, anilistID int, title string, mediaType providers.MediaType) ([]providers.Media, error)

RemapMedia searches for a new provider mapping and updates the database Used when user wants to manually change the mapping

func (*Manager) SaveMapping

func (m *Manager) SaveMapping(ctx context.Context, mapping *ProviderMapping) error

SaveMapping persists a mapping to the database

func (*Manager) SearchProviders

func (m *Manager) SearchProviders(ctx context.Context, title string, mediaType providers.MediaType) ([]SearchResult, error)

SearchProviders searches for anime across providers using smart fallback strategy Returns all matches above the minimum similarity threshold, sorted by score

func (*Manager) SelectMapping

func (m *Manager) SelectMapping(ctx context.Context, anilistID int, providerName string, selected providers.Media) error

SelectMapping saves a user-selected mapping from search results

func (*Manager) SetMinMatchScore

func (m *Manager) SetMinMatchScore(score float64)

SetMinMatchScore sets the minimum similarity score for fuzzy matching

type ProviderMapping

type ProviderMapping struct {
	AniListID       int
	ProviderName    string
	ProviderMediaID string
	Media           *providers.Media // The actual media details from provider
	IsNew           bool             // True if this is a new mapping
}

ProviderMapping represents a mapping result

type SearchResult

type SearchResult struct {
	ProviderName string
	Match        utils.MatchResult
}

SearchResult represents a provider search result with similarity score

Jump to

Keyboard shortcuts

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