Documentation
¶
Index ¶
- Variables
- func BroadcastLog(key string, logType string, message string)
- func CancelScriptExecution(scriptID int64) error
- func ContainsEPUBFiles(dirPath string) bool
- func DetectWebtoonFromImages(mangaPath, slug string) string
- func DownloadAndStoreImage(slug, coverArtURL string) (string, error)
- func HandleLocalImages(slug, absolutePath string) (string, error)
- func HandleLogsWebSocket(c *websocket.Conn, key string)
- func IndexChapters(slug, path, librarySlug string, dryRun bool) (int, int, []string, int, error)
- func IndexMedia(absolutePath, librarySlug string, dataBackend filestore.DataBackend) (string, error)
- func InitializeIndexer(dataDirectory string, libraries []models.Library, cb filestore.DataBackend)
- func InitializeScraperScheduler()
- func InitializeSubscriptionScheduler()
- func RegisterScraperScript(script *models.ScraperScript) error
- func ReloadScraperScheduler()
- func ReloadSubscriptionScheduler()
- func StartScriptExecution(script *models.ScraperScript, variables map[string]string, createLog bool) (*models.ScraperExecutionLog, error)
- func StopAllIndexers()
- func StopScraperScheduler()
- func StopSubscriptionScheduler()
- type ContentType
- type CronScheduler
- type EPUBMetadata
- type Indexer
- type IndexingExecuteFunc
- type IndexingJob
- type Job
- type LogStreamManager
- type NotificationListener
- type OPF
- type ScraperExecuteFunc
- type ScraperJob
- type SubscriptionExpiryJob
Constants ¶
This section is empty.
Variables ¶
var ( NotifyIndexerStarted func(librarySlug string, libraryName string) NotifyIndexerProgress func(librarySlug string, currentMedia string, progress string) NotifyIndexerFinished func(librarySlug string) NotifyScraperStarted func(scriptID int64, scriptName string) NotifyScraperFinished func(scriptID int64) )
Callback functions for job status notifications (set by handlers package)
var ( DataDirectory = "" IndexMediaFunc func(path, librarySlug string, dataBackend filestore.DataBackend) (string, error) )
Functions ¶
func BroadcastLog ¶
BroadcastLog sends a log message to all connected clients for a key
func CancelScriptExecution ¶
CancelScriptExecution cancels a running script by ID
func ContainsEPUBFiles ¶
ContainsEPUBFiles checks if a directory contains any .epub files
func DetectWebtoonFromImages ¶
DetectWebtoonFromImages attempts to detect if a media is a webtoon by checking the aspect ratio of the middle image in the first chapter. Returns "webtoon" if detected, or empty string if not detected or on error.
func DownloadAndStoreImage ¶ added in v1.8.0
func HandleLocalImages ¶
func HandleLogsWebSocket ¶
HandleLogsWebSocket establishes a WebSocket connection for streaming logs
func IndexChapters ¶
IndexChapters reconciles chapter files on disk with the stored chapter records. Returns added count, deleted count, new chapter slugs, and total file count. If dryRun is true, only counts files without performing database operations.
func IndexMedia ¶
func IndexMedia(absolutePath, librarySlug string, dataBackend filestore.DataBackend) (string, error)
IndexMedia inspects a media directory or file (.cbz/.cbr), syncing metadata and chapters with the database.
func InitializeIndexer ¶
func InitializeIndexer(dataDirectory string, libraries []models.Library, cb filestore.DataBackend)
InitializeIndexer sets up indexers and notifications
func InitializeScraperScheduler ¶
func InitializeScraperScheduler()
InitializeScraperScheduler initializes the scraper scheduler
func InitializeSubscriptionScheduler ¶ added in v1.9.0
func InitializeSubscriptionScheduler()
InitializeSubscriptionScheduler initializes the subscription expiry scheduler
func RegisterScraperScript ¶
func RegisterScraperScript(script *models.ScraperScript) error
RegisterScraperScript registers a single scraper script with the scheduler
func ReloadScraperScheduler ¶
func ReloadScraperScheduler()
ReloadScraperScheduler reloads the scraper scheduler
func ReloadSubscriptionScheduler ¶ added in v1.9.0
func ReloadSubscriptionScheduler()
ReloadSubscriptionScheduler reloads the subscription scheduler
func StartScriptExecution ¶
func StartScriptExecution(script *models.ScraperScript, variables map[string]string, createLog bool) (*models.ScraperExecutionLog, error)
StartScriptExecution begins executing a script and streams logs. If createLog is true, an execution log will be created in the DB and returned. Returns error if the script is already running.
func StopScraperScheduler ¶
func StopScraperScheduler()
StopScraperScheduler stops the scraper scheduler
func StopSubscriptionScheduler ¶ added in v1.9.0
func StopSubscriptionScheduler()
StopSubscriptionScheduler stops the subscription scheduler
Types ¶
type ContentType ¶
type ContentType int
const ( MediaDirectory ContentType = iota LightnovelDirectory SingleMediaFile SingleLightNovelFile Skip )
type CronScheduler ¶
type CronScheduler struct {
// contains filtered or unexported fields
}
CronScheduler manages cron jobs
func NewCronScheduler ¶
func NewCronScheduler() *CronScheduler
NewCronScheduler creates a new cron scheduler
func (*CronScheduler) AddJob ¶
func (s *CronScheduler) AddJob(name string, schedule string, job Job) error
AddJob adds a job with the given schedule
func (*CronScheduler) IsRunning ¶
func (s *CronScheduler) IsRunning() bool
IsRunning returns whether the scheduler is running
func (*CronScheduler) Reload ¶
func (s *CronScheduler) Reload()
Reload stops and restarts the scheduler (useful for reloading jobs)
func (*CronScheduler) RemoveJob ¶
func (s *CronScheduler) RemoveJob(name string)
RemoveJob removes a job by name
type EPUBMetadata ¶
type Indexer ¶
type Indexer struct {
Library models.Library
Scheduler *CronScheduler
SchedulerRunning bool
JobRunning bool
// contains filtered or unexported fields
}
Indexer represents the state of an indexer
func NewIndexer ¶
NewIndexer creates a new Indexer instance
func (*Indexer) RunIndexingJob ¶
RunIndexingJob triggers the indexer job immediately
type IndexingExecuteFunc ¶
IndexingExecuteFunc is the function signature for executing indexing
type IndexingJob ¶
type IndexingJob struct {
Library *models.Library
ExecuteFunc IndexingExecuteFunc
}
IndexingJob represents an indexing job for a library
func (*IndexingJob) Execute ¶
func (j *IndexingJob) Execute() error
Execute runs the indexing for the library
type LogStreamManager ¶
type LogStreamManager struct {
// contains filtered or unexported fields
}
LogStreamManager manages WebSocket connections for log streaming
type NotificationListener ¶
type NotificationListener struct {
// contains filtered or unexported fields
}
cleanupOrphanedDuplicates removes duplicate entries where one or both folders no longer exist on disk NotificationListener listens for notifications and handles them
func (*NotificationListener) Notify ¶
func (nl *NotificationListener) Notify(notification models.Notification)
Notify processes incoming notifications
type OPF ¶
type OPF struct {
Metadata struct {
Meta []struct {
Name string `xml:"name,attr"`
Content string `xml:"content,attr"`
} `xml:"meta"`
Subject []string `xml:"dc:subject"`
} `xml:"metadata"`
Manifest struct {
Item []struct {
ID string `xml:"id,attr"`
Href string `xml:"href,attr"`
Properties string `xml:"properties,attr"`
} `xml:"item"`
} `xml:"manifest"`
}
OPF represents the structure of an EPUB's OPF file
type ScraperExecuteFunc ¶
type ScraperExecuteFunc func(script *models.ScraperScript) error
ScraperExecuteFunc is the function signature for executing a scraper script
type ScraperJob ¶
type ScraperJob struct {
Script *models.ScraperScript
ExecuteFunc ScraperExecuteFunc
}
ScraperJob represents a scraper script job
type SubscriptionExpiryJob ¶ added in v1.9.0
type SubscriptionExpiryJob struct{}
SubscriptionExpiryJob checks for expired subscriptions and downgrades users
func (*SubscriptionExpiryJob) Execute ¶ added in v1.9.0
func (j *SubscriptionExpiryJob) Execute() error
func (*SubscriptionExpiryJob) Name ¶ added in v1.9.0
func (j *SubscriptionExpiryJob) Name() string