db

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package db provides SQLite persistence for librarr: users, library items, download jobs, requests, and related records.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuiltinProfile = fmt.Errorf("built-in quality profiles cannot be deleted")

ErrBuiltinProfile is returned when deleting a built-in profile.

Functions

func ItemToJSON

func ItemToJSON(item models.LibraryItem) map[string]interface{}

func NormalizeLibraryPath added in v1.2.0

func NormalizeLibraryPath(filePath string) string

NormalizeLibraryPath returns a stable absolute path for identity checks. Symlinks are resolved when the target exists; case is intentionally not folded because Linux library filesystems are case-sensitive.

Types

type AddItemOutcome added in v1.2.0

type AddItemOutcome struct {
	ID             int64
	Inserted       bool
	Reason         string
	ContentHash    string
	NormalizedPath string
	ExistingID     int64
}

AddItemOutcome describes whether AddItem inserted a new row or reused an existing file-level identity.

type BlocklistEntry added in v1.0.0

type BlocklistEntry struct {
	ID          int64     `json:"id"`
	Title       string    `json:"title"`
	Source      string    `json:"source"`
	DownloadURL string    `json:"download_url"`
	InfoHash    string    `json:"info_hash"`
	Reason      string    `json:"reason"`
	CreatedAt   time.Time `json:"created_at"`
}

BlocklistEntry represents a blocklisted download.

type DB

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

DB wraps a SQLite database for library tracking and download jobs.

func New

func New(path string) (*DB, error)

New opens (or creates) the SQLite database at the given path.

func (*DB) AddBlocklistEntry added in v1.0.0

func (d *DB) AddBlocklistEntry(title, source, downloadURL, infoHash, reason string) (int64, error)

func (*DB) AddItem

func (d *DB) AddItem(item *models.LibraryItem) (int64, error)

AddItem records a successfully processed book.

func (*DB) AddItemTag added in v1.0.0

func (d *DB) AddItemTag(itemID, tagID int64) error

func (*DB) AddItemWithOutcome added in v1.2.0

func (d *DB) AddItemWithOutcome(item *models.LibraryItem) (AddItemOutcome, error)

AddItemWithOutcome inserts a library item idempotently. Exact canonical destination paths are always unique. Content hashes are also unique within the same media type and file format, which prevents a moved or re-imported file from creating a second row without merging EPUB and MOBI records. The DB mutex serializes the identity check and insert, so concurrent imports within Librarr cannot race between those operations.

func (*DB) AddMonitoredAuthor added in v1.0.0

func (d *DB) AddMonitoredAuthor(name string, intervalDays int) (int64, error)

func (*DB) AddMonitoredAuthorWithOptions added in v1.3.0

func (d *DB) AddMonitoredAuthorWithOptions(name string, intervalDays int, autoAdd bool) (int64, error)

AddMonitoredAuthorWithOptions adds an author with an explicit auto-add flag.

func (*DB) AddReadingHistory added in v1.0.0

func (d *DB) AddReadingHistory(userID int64, bookTitle, author, format string, startedAt, finishedAt *time.Time, rating *int, notes string, libraryItemID *int64) (int64, error)

AddReadingHistory inserts a reading history entry.

func (*DB) AddSeenWorks added in v1.3.0

func (d *DB) AddSeenWorks(authorID int64, works []SeenWork) error

AddSeenWorks records works for an author; keys already present are ignored.

func (*DB) AddWishlistItem

func (d *DB) AddWishlistItem(title, author, mediaType string) (int64, error)

AddWishlistItem adds a monitored item using the default profile.

func (*DB) AddWishlistItemWithOptions added in v1.3.0

func (d *DB) AddWishlistItemWithOptions(item models.WishlistItem) (int64, error)

AddWishlistItemWithOptions adds an item with an explicit profile, monitored flag and provenance. An empty media type means ebook; an empty source means manual.

func (*DB) BackfillLibraryMetadata added in v1.2.0

func (d *DB) BackfillLibraryMetadata(extract func(string) (title, author string)) (int, error)

BackfillLibraryMetadata updates rows whose title still matches the torrent-derived directory name. It deliberately leaves user-renamed rows alone and skips files that are no longer present.

func (*DB) ClearBlocklist added in v1.0.0

func (d *DB) ClearBlocklist() error

func (*DB) ClearFinishedJobs

func (d *DB) ClearFinishedJobs() (int, error)

ClearFinishedJobs removes completed, error, and dead_letter jobs.

func (d *DB) ClearWishlistLink(id int64) error

ClearWishlistLink detaches a wanted row from a library item that no longer exists, sending it back to "missing".

func (*DB) Close

func (d *DB) Close() error

Close closes the database connection.

func (*DB) CountActivity

func (d *DB) CountActivity() (int, error)

CountActivity returns the total number of activity events.

func (*DB) CountItems

func (d *DB) CountItems(mediaType string) (int, error)

CountItems counts library items, optionally filtered by media type.

func (*DB) CountRequests

func (d *DB) CountRequests(userID int64, status string) (int, error)

CountRequests returns the number of requests matching the filters.

func (*DB) CountUnreadNotifications

func (d *DB) CountUnreadNotifications(userID int64) (int, error)

CountUnreadNotifications returns the number of unread notifications for a user.

func (*DB) CountUsers

func (d *DB) CountUsers() (int, error)

CountUsers returns the total number of users.

func (*DB) CreateInviteCode added in v1.1.0

func (d *DB) CreateInviteCode(code string, createdBy int64, role string, maxUses int, expiresAt *float64) (int64, error)

CreateInviteCode generates a new invite code.

func (*DB) CreateNotification

func (d *DB) CreateNotification(n *models.Notification) (int64, error)

CreateNotification inserts a new notification.

func (*DB) CreateQualityProfile added in v1.0.0

func (d *DB) CreateQualityProfile(qp *QualityProfile) (int64, error)

func (*DB) CreateReleaseProfile added in v1.0.0

func (d *DB) CreateReleaseProfile(rp *ReleaseProfile) (int64, error)

func (*DB) CreateRequest

func (d *DB) CreateRequest(req *models.Request) error

CreateRequest inserts a new book request.

func (*DB) CreateTag added in v1.0.0

func (d *DB) CreateTag(name, color string) (int64, error)

func (*DB) CreateUser

func (d *DB) CreateUser(username, passwordHash, role string) (int64, error)

CreateUser inserts a new user. Returns the new user ID.

func (*DB) CreateWebhookConfig added in v1.0.0

func (d *DB) CreateWebhookConfig(c *webhook.Config) (int64, error)

CreateWebhookConfig inserts a new webhook config.

func (*DB) DeleteBlocklistEntry added in v1.0.0

func (d *DB) DeleteBlocklistEntry(id int64) error

func (*DB) DeleteInviteCode added in v1.1.0

func (d *DB) DeleteInviteCode(id int64) error

DeleteInviteCode removes an invite code.

func (*DB) DeleteItem

func (d *DB) DeleteItem(id int64) error

DeleteItem removes a library item by ID.

func (*DB) DeleteItemBySourceID added in v1.1.0

func (d *DB) DeleteItemBySourceID(sourceID string) error

DeleteItemBySourceID removes a library item by its source_id field.

func (*DB) DeleteJob

func (d *DB) DeleteJob(id string) error

DeleteJob removes a download job.

func (*DB) DeleteMonitoredAuthor added in v1.0.0

func (d *DB) DeleteMonitoredAuthor(id int64) error

func (*DB) DeleteNotification

func (d *DB) DeleteNotification(id int64, userID int64) error

DeleteNotification removes a notification by ID (must belong to user).

func (*DB) DeleteQualityProfile added in v1.0.0

func (d *DB) DeleteQualityProfile(id int64) error

DeleteQualityProfile removes a custom profile. Wanted items that used it fall back to the built-in default for their media type.

func (*DB) DeleteReadingHistory added in v1.0.0

func (d *DB) DeleteReadingHistory(id, userID int64) error

DeleteReadingHistory removes a history entry by ID.

func (*DB) DeleteReleaseProfile added in v1.0.0

func (d *DB) DeleteReleaseProfile(id int64) error

func (*DB) DeleteRequest

func (d *DB) DeleteRequest(id string) error

DeleteRequest removes a request by ID.

func (*DB) DeleteTag added in v1.0.0

func (d *DB) DeleteTag(id int64) error

func (*DB) DeleteUser

func (d *DB) DeleteUser(id int64) error

DeleteUser removes a user by ID.

func (*DB) DeleteWebhookConfig added in v1.0.0

func (d *DB) DeleteWebhookConfig(id int64) error

DeleteWebhookConfig removes a webhook config by ID.

func (*DB) DeleteWishlistItem

func (d *DB) DeleteWishlistItem(id int64) error

DeleteWishlistItem removes a wishlist item by ID.

func (*DB) DisableTOTP

func (d *DB) DisableTOTP(userID int64) error

DisableTOTP disables TOTP and clears the secret.

func (*DB) EnableTOTP

func (d *DB) EnableTOTP(userID int64) error

EnableTOTP enables TOTP for a user.

func (*DB) FindByTitle

func (d *DB) FindByTitle(title string) ([]models.LibraryItem, error)

FindByTitle performs a case-insensitive title lookup.

func (*DB) FindItems added in v1.4.0

func (d *DB) FindItems(mediaType, query string, limit, offset int) ([]models.LibraryItem, int, error)

FindItems filters before pagination and returns the matching total. instr treats %, _ and quotes as literal search text rather than LIKE wildcards.

func (*DB) FindWishlistByActiveJob added in v1.3.0

func (d *DB) FindWishlistByActiveJob(jobRef string) (*models.WishlistItem, error)

FindWishlistByActiveJob returns the item whose in-flight grab is jobRef (a download job ID or "torrent:<infohash>"), or nil when none is.

func (*DB) GetActivity

func (d *DB) GetActivity(limit, offset int) ([]models.ActivityEvent, error)

GetActivity returns recent activity, newest first.

func (*DB) GetActivityLog

func (d *DB) GetActivityLog(user, action string, limit, offset int) ([]models.ActivityEntry, error)

GetActivityLog returns paginated activity entries with optional filters.

func (*DB) GetActivityLogCount

func (d *DB) GetActivityLogCount(user, action string) (int, error)

GetActivityLogCount returns the total number of activity entries matching filters.

func (*DB) GetBlocklist added in v1.0.0

func (d *DB) GetBlocklist(limit, offset int) ([]BlocklistEntry, error)

func (*DB) GetDBPath added in v1.0.0

func (d *DB) GetDBPath() string

func (*DB) GetDefaultQualityProfile added in v1.3.0

func (d *DB) GetDefaultQualityProfile(mediaType string) (*QualityProfile, error)

GetDefaultQualityProfile returns the built-in profile for a media type.

func (*DB) GetItem added in v1.3.0

func (d *DB) GetItem(id int64) (*models.LibraryItem, error)

GetItem returns one library item by ID, or sql.ErrNoRows.

func (*DB) GetItemTags added in v1.0.0

func (d *DB) GetItemTags(itemID int64) ([]Tag, error)

func (*DB) GetItems

func (d *DB) GetItems(mediaType string, limit, offset int) ([]models.LibraryItem, error)

GetItems returns a paginated list of library items, newest first.

func (*DB) GetItemsByTag added in v1.0.0

func (d *DB) GetItemsByTag(tagID int64, limit, offset int) ([]models.LibraryItem, error)

func (*DB) GetJob

func (d *DB) GetJob(id string) (*models.DownloadJob, error)

GetJob retrieves a download job by ID.

func (*DB) GetJobs

func (d *DB) GetJobs() ([]models.DownloadJob, error)

GetJobs returns all download jobs.

func (*DB) GetMonitoredAuthor added in v1.3.0

func (d *DB) GetMonitoredAuthor(id int64) (*MonitoredAuthor, error)

GetMonitoredAuthor returns one author by ID.

func (*DB) GetMonitoredAuthors added in v1.0.0

func (d *DB) GetMonitoredAuthors() ([]MonitoredAuthor, error)

func (*DB) GetNotifications

func (d *DB) GetNotifications(userID int64, limit, offset int) ([]models.Notification, error)

GetNotifications returns notifications for a user, newest first.

func (*DB) GetQualityProfile added in v1.0.0

func (d *DB) GetQualityProfile(id int64) (*QualityProfile, error)

func (*DB) GetQualityProfiles added in v1.0.0

func (d *DB) GetQualityProfiles() ([]QualityProfile, error)

func (*DB) GetReadingHistory added in v1.0.0

func (d *DB) GetReadingHistory(userID int64, status string, limit, offset int) ([]ReadingHistoryEntry, error)

GetReadingHistory returns paginated reading history for a user.

func (*DB) GetReadingStats added in v1.0.0

func (d *DB) GetReadingStats(userID int64) (map[string]interface{}, error)

GetReadingStats returns reading statistics for a user.

func (*DB) GetReleaseProfile added in v1.0.0

func (d *DB) GetReleaseProfile(id int64) (*ReleaseProfile, error)

func (*DB) GetReleaseProfiles added in v1.0.0

func (d *DB) GetReleaseProfiles() ([]ReleaseProfile, error)

func (*DB) GetRequest

func (d *DB) GetRequest(id string) (*models.Request, error)

GetRequest retrieves a request by ID.

func (*DB) GetSeriesTracking added in v1.0.0

func (d *DB) GetSeriesTracking() ([]map[string]interface{}, error)

GetSeriesTracking returns all tracked series.

func (*DB) GetStats

func (d *DB) GetStats() (map[string]interface{}, error)

func (*DB) GetTags added in v1.0.0

func (d *DB) GetTags() ([]Tag, error)

func (*DB) GetUploads

func (d *DB) GetUploads(limit, offset int) ([]models.UploadRecord, error)

GetUploads returns recent uploads.

func (*DB) GetUser

func (d *DB) GetUser(id int64) (*models.User, error)

GetUser retrieves a user by ID.

func (*DB) GetUserByUsername

func (d *DB) GetUserByUsername(username string) (*models.User, error)

GetUserByUsername retrieves a user by username (case-insensitive).

func (*DB) GetWebhookConfigs added in v1.0.0

func (d *DB) GetWebhookConfigs() ([]webhook.Config, error)

GetWebhookConfigs returns all webhook configurations.

func (*DB) GetWishlist

func (d *DB) GetWishlist() ([]models.WishlistItem, error)

GetWishlist returns all wishlist items, newest first, with the format and path of the library file currently satisfying each one.

func (*DB) GetWishlistItem added in v1.3.0

func (d *DB) GetWishlistItem(id int64) (*models.WishlistItem, error)

GetWishlistItem returns one item by ID, or sql.ErrNoRows.

func (*DB) HasSourceID

func (d *DB) HasSourceID(sourceID string) bool

HasSourceID checks if a source_id already exists.

func (*DB) IsBlocklisted added in v1.0.0

func (d *DB) IsBlocklisted(downloadURL, infoHash string) bool

func (*DB) LibraryMatchIndex added in v1.2.1

func (d *DB) LibraryMatchIndex() (*library.Index, error)

LibraryMatchIndex builds an ownership index over the whole library so search results and download requests can be checked against what the user already has.

Only the four columns matching needs are read: a library of several thousand books would otherwise drag file paths, metadata blobs and content hashes through memory on every search. Building the index is a single sequential scan and the result is queried by map lookup, so callers should build it once per request and reuse it across every result they annotate.

func (*DB) LibraryPaths added in v1.4.0

func (d *DB) LibraryPaths(mediaType string) (map[string]struct{}, error)

LibraryPaths returns the canonical paths recorded for a media type. A library item may record either an individual file or the directory that contains an imported tree, so callers can use the result to recognize both forms without depending on the item's source ID.

func (*DB) LinkWishlistItem added in v1.3.0

func (d *DB) LinkWishlistItem(id, libraryItemID int64) error

LinkWishlistItem attaches an existing library file to a wanted row without touching the in-flight marker — used by reconciliation when a file arrived by some other route (manual download, an old library, a torrent librarr could not tie to the row).

func (*DB) ListInviteCodes added in v1.1.0

func (d *DB) ListInviteCodes() ([]map[string]interface{}, error)

ListInviteCodes returns all invite codes for admin display.

func (*DB) ListRequests

func (d *DB) ListRequests(userID int64, status string, limit, offset int) ([]models.Request, error)

ListRequests returns requests filtered by optional user ID and status. If userID is 0, all requests are returned (admin view).

func (*DB) ListUsers

func (d *DB) ListUsers() ([]models.User, error)

ListUsers returns all users.

func (*DB) LogActivity

func (d *DB) LogActivity(user, action, target, detail string)

LogActivity appends a user-attributed event to the activity log.

func (*DB) LogEvent

func (d *DB) LogEvent(eventType, title, detail string, libraryItemID *int64, jobID string) error

LogEvent appends an event to the activity log.

func (*DB) MarkAllNotificationsRead

func (d *DB) MarkAllNotificationsRead(userID int64) error

MarkAllNotificationsRead marks all notifications as read for a user.

func (*DB) MarkNZBJobImported added in v1.2.0

func (d *DB) MarkNZBJobImported(nzoID string) error

MarkNZBJobImported flags an NZB job as imported so it is not processed again.

func (*DB) MarkNotificationRead

func (d *DB) MarkNotificationRead(id int64, userID int64) error

MarkNotificationRead marks a single notification as read.

func (*DB) PendingNZBJobs added in v1.2.0

func (d *DB) PendingNZBJobs() ([]models.NZBJob, error)

PendingNZBJobs returns NZB jobs that have not yet been imported.

func (*DB) RecordNZBJob added in v1.2.0

func (d *DB) RecordNZBJob(nzoID, title, mediaType string) error

RecordNZBJob remembers an NZB submitted to SABnzbd. It is idempotent: a repeated nzo_id (e.g. a retried submit) is ignored rather than resurrecting an already-imported job.

func (*DB) RecordWishlistSearch added in v1.3.0

func (d *DB) RecordWishlistSearch(id int64, result string) error

RecordWishlistSearch stores what the scheduler decided on its last pass.

func (*DB) RemoveItemTag added in v1.0.0

func (d *DB) RemoveItemTag(itemID, tagID int64) error

func (*DB) ResolveQualityProfile added in v1.3.0

func (d *DB) ResolveQualityProfile(profileID int64, mediaType string) QualityProfile

ResolveQualityProfile returns the profile a wanted item should use: its own when set and still present, otherwise the built-in default for its media type, otherwise the package default so a decision is always possible.

func (*DB) SatisfyWishlistItem added in v1.3.0

func (d *DB) SatisfyWishlistItem(id, libraryItemID int64) (previous int64, err error)

SatisfyWishlistItem links a wanted row to the library item that now fulfils it and clears the in-flight marker. It returns the previously linked library item ID (0 if none) so the caller can retire a superseded file after an upgrade.

func (*DB) SaveBackupCodes

func (d *DB) SaveBackupCodes(userID int64, codeHashes []string) error

SaveBackupCodes stores hashed backup codes for a user.

func (*DB) SaveJob

func (d *DB) SaveJob(job *models.DownloadJob) error

SaveJob persists a download job.

func (*DB) SaveUpload

func (d *DB) SaveUpload(user, filename, originalName, fileType string, fileSize int64, organizedTo, status, errMsg string) (int64, error)

SaveUpload records a file upload.

func (*DB) SeenWorkKeys added in v1.3.0

func (d *DB) SeenWorkKeys(authorID int64) (map[string]bool, error)

SeenWorkKeys returns the set of work keys already recorded for an author.

func (*DB) SetTOTPSecret

func (d *DB) SetTOTPSecret(userID int64, secret string) error

SetTOTPSecret stores the TOTP secret for a user (does not enable it yet).

func (*DB) SetWishlistActiveJob added in v1.3.0

func (d *DB) SetWishlistActiveJob(id int64, jobRef string) error

SetWishlistActiveJob marks a grab as in flight (or clears it with "").

func (*DB) UnlinkLibraryItemFromWishlist added in v1.3.0

func (d *DB) UnlinkLibraryItemFromWishlist(libraryItemID int64) error

UnlinkLibraryItemFromWishlist detaches every wanted row pointing at a library item that is being deleted, so those rows become wanted again instead of silently pointing at nothing.

func (*DB) UpdateJobStatus

func (d *DB) UpdateJobStatus(id, status, detail, errMsg string) error

UpdateJobStatus updates the status and detail of a job.

func (*DB) UpdateLastLogin

func (d *DB) UpdateLastLogin(userID int64) error

UpdateLastLogin updates the last_login timestamp for a user.

func (*DB) UpdateMonitoredAuthor added in v1.3.0

func (d *DB) UpdateMonitoredAuthor(id int64, intervalDays *int, autoAdd *bool) error

UpdateMonitoredAuthor changes the editable settings. Nil leaves a field as is.

func (*DB) UpdateMonitoredAuthorCheck added in v1.0.0

func (d *DB) UpdateMonitoredAuthorCheck(id int64, lastBookFound string) error

func (*DB) UpdateQualityProfile added in v1.0.0

func (d *DB) UpdateQualityProfile(qp *QualityProfile) error

UpdateQualityProfile rewrites the editable fields. The builtin flag and media type of a built-in profile are preserved: the defaults stay one per media type no matter what a client sends.

func (*DB) UpdateReadingHistory added in v1.0.0

func (d *DB) UpdateReadingHistory(id, userID int64, finishedAt *time.Time, rating *int, notes *string) error

UpdateReadingHistory updates a history entry (finish date, rating, notes).

func (*DB) UpdateReleaseProfile added in v1.0.0

func (d *DB) UpdateReleaseProfile(rp *ReleaseProfile) error

func (*DB) UpdateRequest

func (d *DB) UpdateRequest(req *models.Request) error

UpdateRequest updates mutable fields on a request.

func (*DB) UpdateRequestStatus

func (d *DB) UpdateRequestStatus(id, status string) error

UpdateRequestStatus updates the status and optional fields of a request.

func (*DB) UpdateUser

func (d *DB) UpdateUser(id int64, username, role string) error

UpdateUser updates a user's username and role.

func (*DB) UpdateUserPassword

func (d *DB) UpdateUserPassword(id int64, passwordHash string) error

UpdateUserPassword updates only the password hash.

func (*DB) UpdateWishlistItem added in v1.3.0

func (d *DB) UpdateWishlistItem(id int64, monitored *bool, qualityProfileID *int64) error

UpdateWishlistItem changes the user-editable fields: monitored flag and quality profile. Nil pointers leave a field untouched.

func (*DB) UpsertSeriesTracking added in v1.0.0

func (d *DB) UpsertSeriesTracking(seriesName string, knownTotal, ownedCount int) (int64, error)

UpsertSeriesTracking creates or updates a series tracking entry.

func (*DB) UseBackupCode

func (d *DB) UseBackupCode(userID int64, codeHash string) (bool, error)

UseBackupCode checks if a backup code matches any unused code for the user. If found, marks it used.

func (*DB) UseInviteCode added in v1.1.0

func (d *DB) UseInviteCode(code string) error

UseInviteCode increments the use count.

func (*DB) ValidateInviteCode added in v1.1.0

func (d *DB) ValidateInviteCode(code string) (string, error)

ValidateInviteCode checks if an invite code is valid (exists, not expired, uses remaining). Returns the role the new user should get, or an error.

type MonitoredAuthor added in v1.0.0

type MonitoredAuthor struct {
	ID                int64     `json:"id"`
	Name              string    `json:"name"`
	LastChecked       time.Time `json:"last_checked"`
	LastBookFound     string    `json:"last_book_found"`
	CheckIntervalDays int       `json:"check_interval_days"`
	// AutoAdd puts newly discovered works on the wanted list instead of
	// only notifying about them.
	AutoAdd bool `json:"auto_add"`
	// SeenWorks is the number of works already recorded for the author; zero
	// means the next check will take a baseline instead of announcing the
	// entire back catalogue as new.
	SeenWorks int `json:"seen_works"`
}

MonitoredAuthor represents a monitored author record.

type PreferredWord added in v1.0.0

type PreferredWord struct {
	Word  string `json:"word"`
	Score int    `json:"score"`
}

PreferredWord represents a word+score pair in a release profile.

type QualityProfile added in v1.0.0

type QualityProfile struct {
	ID               int64    `json:"id"`
	Name             string   `json:"name"`
	MediaType        string   `json:"media_type"`
	FormatRanking    []string `json:"format_ranking"`
	PreferredSizeMin int64    `json:"preferred_size_min"`
	PreferredSizeMax int64    `json:"preferred_size_max"`
	UpgradeAllowed   bool     `json:"upgrade_allowed"`
	CutoffFormat     string   `json:"cutoff_format"`
	// Builtin profiles are seeded per media type and cannot be deleted; they
	// are what an item with no explicit profile uses.
	Builtin bool `json:"builtin"`
}

QualityProfile represents a quality profile record.

func (QualityProfile) Profile added in v1.3.0

func (qp QualityProfile) Profile() quality.Profile

Profile converts the record into the decision engine's view of it.

type ReadingHistoryEntry added in v1.0.0

type ReadingHistoryEntry struct {
	ID            int64      `json:"id"`
	UserID        int64      `json:"user_id"`
	BookTitle     string     `json:"book_title"`
	Author        string     `json:"author"`
	Format        string     `json:"format"`
	StartedAt     *time.Time `json:"started_at,omitempty"`
	FinishedAt    *time.Time `json:"finished_at,omitempty"`
	Rating        *int       `json:"rating,omitempty"`
	Notes         string     `json:"notes"`
	LibraryItemID *int64     `json:"library_item_id,omitempty"`
	Status        string     `json:"status"`
}

ReadingHistoryEntry represents a reading history record.

type ReleaseProfile added in v1.0.0

type ReleaseProfile struct {
	ID             int64           `json:"id"`
	Name           string          `json:"name"`
	MustContain    []string        `json:"must_contain"`
	MustNotContain []string        `json:"must_not_contain"`
	Preferred      []PreferredWord `json:"preferred"`
	Enabled        bool            `json:"enabled"`
}

ReleaseProfile represents a release profile record.

type SeenWork added in v1.3.0

type SeenWork struct {
	WorkKey string `json:"work_key"`
	Title   string `json:"title"`
	Year    int    `json:"year"`
}

SeenWork is one Open Library work the monitor has already recorded.

type Tag added in v1.0.0

type Tag struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

Tag represents a tag record.

Jump to

Keyboard shortcuts

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