Documentation
¶
Index ¶
- Constants
- Variables
- func GetDataSourcePriority(source string) int
- func IsPageBasedFileType(fileType string) bool
- func PluginDataSource(scope, id string) string
- type AppSetting
- type Author
- type Book
- type BookGenre
- type BookSeries
- type BookTag
- type Chapter
- type File
- type FileFingerprint
- type FileIdentifier
- type Genre
- type GenreAlias
- type Job
- type JobBulkDownloadData
- type JobExportData
- type JobHashGenerationData
- type JobLog
- type JobRecomputeReviewData
- type JobScanData
- type Library
- type LibraryPath
- type LibraryPluginCustomization
- type LibraryPluginFieldSetting
- type LibraryPluginHookConfig
- type List
- type ListBook
- type ListShare
- type Narrator
- type Permission
- type Person
- type PersonAlias
- type Plugin
- type PluginConfig
- type PluginFieldSetting
- type PluginHookConfig
- type PluginIdentifierType
- type PluginRepository
- type PluginStatus
- type Publisher
- type PublisherAlias
- type Role
- type Series
- type SeriesAlias
- type Tag
- type TagAlias
- type User
- type UserLibraryAccess
- type UserLibrarySettings
- type UserSettings
Constants ¶
const ( //tygo:emit export type DataSource = typeof DataSourceManual | typeof DataSourceSidecar | typeof DataSourcePlugin | typeof DataSourceFileMetadata | typeof DataSourceExistingCover | typeof DataSourceEPUBMetadata | typeof DataSourceCBZMetadata | typeof DataSourceM4BMetadata | typeof DataSourcePDFMetadata | typeof DataSourceFilepath | `plugin:${string}`; DataSourceManual = "manual" DataSourceSidecar = "sidecar" DataSourcePlugin = "plugin" DataSourceFileMetadata = "file_metadata" DataSourceExistingCover = "existing_cover" DataSourceEPUBMetadata = "epub_metadata" DataSourceCBZMetadata = "cbz_metadata" DataSourceM4BMetadata = "m4b_metadata" DataSourcePDFMetadata = "pdf_metadata" DataSourceFilepath = "filepath" // DataSourcePluginPrefix is the prefix for plugin-specific data sources. // Actual values are "plugin:scope/id" (e.g., "plugin:shisho/goodreads-metadata"). DataSourcePluginPrefix = "plugin:" )
const ( DataSourceManualPriority = 0 DataSourceSidecarPriority = 1 // Sidecar has higher priority than file metadata DataSourcePluginPriority = 2 // Plugin enricher/parser results DataSourceFileMetadataPriority = 3 // All file-derived sources share this DataSourceFilepathPriority = 4 )
Lower priority means that we respect it more than higher priority.
const ( //tygo:emit export type IdentifierType = typeof IdentifierTypeISBN10 | typeof IdentifierTypeISBN13 | typeof IdentifierTypeASIN | typeof IdentifierTypeUUID | typeof IdentifierTypeGoodreads | typeof IdentifierTypeGoogle | typeof IdentifierTypeOther | (string & {}); IdentifierTypeISBN10 = "isbn_10" IdentifierTypeISBN13 = "isbn_13" IdentifierTypeASIN = "asin" IdentifierTypeUUID = "uuid" IdentifierTypeGoodreads = "goodreads" IdentifierTypeGoogle = "google" IdentifierTypeOther = "other" )
FileIdentifier type constants.
const ( //tygo:emit export type FileType = typeof FileTypeCBZ | typeof FileTypeEPUB | typeof FileTypeM4B | typeof FileTypePDF; FileTypeCBZ = "cbz" FileTypeEPUB = "epub" FileTypeM4B = "m4b" FileTypePDF = "pdf" )
const ( //tygo:emit export type FileRole = typeof FileRoleMain | typeof FileRoleSupplement; FileRoleMain = "main" FileRoleSupplement = "supplement" )
const ( //tygo:emit export type ReviewOverride = typeof ReviewOverrideReviewed | typeof ReviewOverrideUnreviewed; ReviewOverrideReviewed = "reviewed" ReviewOverrideUnreviewed = "unreviewed" )
const ( //tygo:emit export type ReviewedFilter = typeof ReviewedFilterAll | typeof ReviewedFilterNeedsReview | typeof ReviewedFilterReviewed; ReviewedFilterAll = "all" ReviewedFilterNeedsReview = "needs_review" ReviewedFilterReviewed = "reviewed" )
ReviewedFilter values for the book list endpoint's reviewed_filter query param. "" and "all" both mean "all books"; the other two scope to needs-review or reviewed books respectively.
const ( //tygo:emit export type JobStatus = typeof JobStatusPending | typeof JobStatusInProgress | typeof JobStatusCompleted | typeof JobStatusFailed; JobStatusPending = "pending" JobStatusInProgress = "in_progress" JobStatusCompleted = "completed" JobStatusFailed = "failed" )
const ( //tygo:emit export type JobType = typeof JobTypeExport | typeof JobTypeScan | typeof JobTypeBulkDownload | typeof JobTypeHashGeneration | typeof JobTypeRecomputeReview; JobTypeExport = "export" JobTypeScan = "scan" JobTypeBulkDownload = "bulk_download" JobTypeHashGeneration = "hash_generation" JobTypeRecomputeReview = "recompute_review" )
const ( //tygo:emit export type CoverAspectRatio = typeof CoverAspectRatioBook | typeof CoverAspectRatioAudiobook | typeof CoverAspectRatioBookFallbackAudiobook | typeof CoverAspectRatioAudiobookFallbackBook; CoverAspectRatioBook = "book" CoverAspectRatioAudiobook = "audiobook" CoverAspectRatioBookFallbackAudiobook = "book_fallback_audiobook" CoverAspectRatioAudiobookFallbackBook = "audiobook_fallback_book" )
Cover aspect ratio preference constants. Determine which file's cover a hybrid (e.g. EPUB + M4B) book serves.
const ( //tygo:emit export type DownloadFormat = typeof DownloadFormatOriginal | typeof DownloadFormatKepub | typeof DownloadFormatAsk; DownloadFormatOriginal = "original" DownloadFormatKepub = "kepub" DownloadFormatAsk = "ask" )
Download format preference constants.
const ( //tygo:emit export type ListPermission = typeof ListPermissionViewer | typeof ListPermissionEditor | typeof ListPermissionManager; ListPermissionViewer = "viewer" ListPermissionEditor = "editor" ListPermissionManager = "manager" )
List permission levels.
const ( //tygo:emit export type ListSort = typeof ListSortManual | typeof ListSortAddedAtDesc | typeof ListSortAddedAtAsc | typeof ListSortTitleAsc | typeof ListSortTitleDesc | typeof ListSortAuthorAsc | typeof ListSortAuthorDesc; ListSortAddedAtDesc = "added_at_desc" ListSortAddedAtAsc = "added_at_asc" ListSortTitleAsc = "title_asc" ListSortTitleDesc = "title_desc" ListSortAuthorAsc = "author_asc" ListSortAuthorDesc = "author_desc" ListSortManual = "manual" )
List default sort options.
const ( //tygo:emit export type LogLevel = typeof LogLevelDebug | typeof LogLevelInfo | typeof LogLevelWarn | typeof LogLevelError | typeof LogLevelFatal; LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarn = "warn" LogLevelError = "error" LogLevelFatal = "fatal" )
const ( //tygo:emit export type AuthorRole = typeof AuthorRoleWriter | typeof AuthorRolePenciller | typeof AuthorRoleInker | typeof AuthorRoleColorist | typeof AuthorRoleLetterer | typeof AuthorRoleCoverArtist | typeof AuthorRoleEditor | typeof AuthorRoleTranslator; AuthorRoleWriter = "writer" AuthorRolePenciller = "penciller" AuthorRoleInker = "inker" AuthorRoleColorist = "colorist" AuthorRoleLetterer = "letterer" AuthorRoleCoverArtist = "cover_artist" AuthorRoleEditor = "editor" AuthorRoleTranslator = "translator" )
Author role constants for CBZ ComicInfo.xml creator types.
const ( //tygo:emit export type PluginHookType = typeof PluginHookInputConverter | typeof PluginHookFileParser | typeof PluginHookOutputGenerator | typeof PluginHookMetadataEnricher; PluginHookInputConverter = "inputConverter" PluginHookFileParser = "fileParser" PluginHookOutputGenerator = "outputGenerator" PluginHookMetadataEnricher = "metadataEnricher" )
Plugin hook type constants.
const ( //tygo:emit export type PluginMode = typeof PluginModeEnabled | typeof PluginModeManualOnly | typeof PluginModeDisabled; PluginModeEnabled = "enabled" PluginModeManualOnly = "manual_only" PluginModeDisabled = "disabled" )
Plugin mode constants for hook config entries.
const ( ResourceLibraries = "libraries" ResourceBooks = "books" ResourcePeople = "people" ResourceSeries = "series" ResourceUsers = "users" ResourceJobs = "jobs" ResourceConfig = "config" )
Permission resources.
const ( OperationRead = "read" OperationWrite = "write" )
Permission operations.
const ( RoleAdmin = "admin" RoleEditor = "editor" RoleViewer = "viewer" )
Predefined role names.
const ( //tygo:emit export type SeriesNumberUnit = typeof SeriesNumberUnitVolume | typeof SeriesNumberUnitChapter; SeriesNumberUnitVolume = "volume" SeriesNumberUnitChapter = "chapter" )
const ( //tygo:emit export type FitMode = typeof FitModeHeight | typeof FitModeWidth; FitModeHeight = "fit-height" FitModeWidth = "fit-width" )
const ( //tygo:emit export type EpubTheme = typeof EpubThemeLight | typeof EpubThemeDark | typeof EpubThemeSepia; EpubThemeLight = "light" EpubThemeDark = "dark" EpubThemeSepia = "sepia" )
const ( //tygo:emit export type EpubFlow = typeof EpubFlowPaginated | typeof EpubFlowScrolled; EpubFlowPaginated = "paginated" EpubFlowScrolled = "scrolled" )
const ( //tygo:emit export type GallerySize = typeof GallerySizeSmall | typeof GallerySizeMedium | typeof GallerySizeLarge | typeof GallerySizeExtraLarge; GallerySizeSmall = "s" GallerySizeMedium = "m" GallerySizeLarge = "l" GallerySizeExtraLarge = "xl" )
const ( // FingerprintAlgorithmSHA256 is the exact-content sha256 hash over the // file's raw bytes. Used for move/rename detection. FingerprintAlgorithmSHA256 = "sha256" )
Fingerprint algorithm identifiers stored in FileFingerprint.Algorithm.
const ( // The tygo:emit lines mirror the Go PlaybackSpeeds var into the // generated TS (a const array plus a union type) so the player's speed // menu and the backend validation share the same set of values. tygo // only processes const/type declarations, so the directives live here // rather than on the var. Keep the emitted list in sync with // PlaybackSpeeds. // //tygo:emit export const PlaybackSpeeds = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3] as const; //tygo:emit export type PlaybackSpeed = (typeof PlaybackSpeeds)[number]; PlaybackSpeedDefault = 1.0 )
Variables ¶
var PlaybackSpeeds = []float64{0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3}
PlaybackSpeeds lists the allowed audiobook playback speed steps, in ascending order.
Functions ¶
func GetDataSourcePriority ¶
GetDataSourcePriority returns the priority for a given data source string. Handles "plugin:scope/id" format by matching the prefix.
func IsPageBasedFileType ¶ added in v0.0.24
IsPageBasedFileType returns true for file types that derive covers from page content (CBZ, PDF). These formats should never have their covers replaced by external sources (plugins, uploads).
func PluginDataSource ¶
PluginDataSource returns a data source string for a specific plugin (e.g., "plugin:shisho/goodreads").
Types ¶
type AppSetting ¶ added in v0.0.39
type Author ¶
type Author struct {
bun.BaseModel `bun:"table:authors,alias:a" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
BookID int `bun:",nullzero" json:"book_id"`
PersonID int `bun:",nullzero" json:"person_id"`
Person *Person `bun:"rel:belongs-to,join:person_id=id" json:"person,omitempty" tstype:"Person"`
SortOrder int `bun:",nullzero" json:"sort_order"`
Role *string `json:"role" tstype:"AuthorRole"` // CBZ creator role: writer, penciller, inker, etc. NULL for generic author
}
type Book ¶
type Book struct {
bun.BaseModel `bun:"table:books,alias:b" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Library *Library `bun:"rel:belongs-to" json:"library" tstype:"Library"`
Filepath string `bun:",nullzero" json:"filepath"`
Title string `bun:",nullzero" json:"title"`
TitleSource string `bun:",nullzero" json:"title_source" tstype:"DataSource"`
SortTitle string `bun:",notnull" json:"sort_title"`
SortTitleSource string `bun:",notnull" json:"sort_title_source" tstype:"DataSource"`
Subtitle *string `json:"subtitle"`
SubtitleSource *string `json:"subtitle_source" tstype:"DataSource"`
Description *string `json:"description"`
DescriptionSource *string `json:"description_source" tstype:"DataSource"`
Authors []*Author `bun:"rel:has-many,join:id=book_id" json:"authors,omitempty" tstype:"Author[]"`
AuthorSource string `bun:",nullzero" json:"author_source" tstype:"DataSource"`
BookSeries []*BookSeries `bun:"rel:has-many,join:id=book_id" json:"book_series,omitempty" tstype:"BookSeries[]"`
BookGenres []*BookGenre `bun:"rel:has-many,join:id=book_id" json:"book_genres,omitempty" tstype:"BookGenre[]"`
GenreSource *string `json:"genre_source" tstype:"DataSource"`
BookTags []*BookTag `bun:"rel:has-many,join:id=book_id" json:"book_tags,omitempty" tstype:"BookTag[]"`
TagSource *string `json:"tag_source" tstype:"DataSource"`
Files []*File `bun:"rel:has-many" json:"files" tstype:"File[]"`
CoverCacheKey string `bun:"-" json:"cover_cache_key"`
}
type BookGenre ¶
type BookGenre struct {
bun.BaseModel `bun:"table:book_genres,alias:bg" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
BookID int `bun:",nullzero" json:"book_id"`
GenreID int `bun:",nullzero" json:"genre_id"`
Genre *Genre `bun:"rel:belongs-to,join:genre_id=id" json:"genre,omitempty" tstype:"Genre"`
}
type BookSeries ¶
type BookSeries struct {
bun.BaseModel `bun:"table:book_series,alias:bs" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
BookID int `bun:",nullzero" json:"book_id"`
SeriesID int `bun:",nullzero" json:"series_id"`
Series *Series `bun:"rel:belongs-to,join:series_id=id" json:"series,omitempty" tstype:"Series"`
SeriesNumber *float64 `json:"series_number,omitempty"`
SeriesNumberUnit *string `json:"series_number_unit,omitempty" tstype:"SeriesNumberUnit"`
SortOrder int `bun:",nullzero" json:"sort_order"`
}
type Chapter ¶
type Chapter struct {
bun.BaseModel `bun:"table:chapters,alias:ch" tstype:"-"`
ID int `bun:",pk,autoincrement" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FileID int `bun:",notnull" json:"file_id"`
ParentID *int `json:"parent_id"`
SortOrder int `bun:",notnull" json:"sort_order"`
Title string `bun:",notnull" json:"title"`
// Position data (mutually exclusive based on file type)
StartPage *int `json:"start_page"` // CBZ: 0-indexed page number
StartTimestampMs *int64 `json:"start_timestamp_ms"` // M4B: milliseconds from start
Href *string `json:"href"` // EPUB: content document href
// Relations
File *File `bun:"rel:belongs-to,join:file_id=id" json:"-"`
Parent *Chapter `bun:"rel:belongs-to,join:parent_id=id" json:"-"`
Children []*Chapter `bun:"rel:has-many,join:id=parent_id" json:"children,omitempty"`
}
type File ¶
type File struct {
bun.BaseModel `bun:"table:files,alias:f" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
BookID int `bun:",nullzero" json:"book_id"`
Book *Book `bun:"rel:belongs-to" json:"book" tstype:"Book"`
Filepath string `bun:",nullzero" json:"filepath"`
FileType string `bun:",nullzero" json:"file_type" tstype:"FileType"`
FileRole string `bun:",nullzero,default:'main'" json:"file_role" tstype:"FileRole"`
FilesizeBytes int64 `bun:",nullzero" json:"filesize_bytes"`
FileModifiedAt *time.Time `json:"file_modified_at"`
CoverImageFilename *string `json:"cover_image_filename"`
CoverMimeType *string `json:"cover_mime_type"`
CoverSource *string `json:"cover_source" tstype:"DataSource"`
CoverPage *int `json:"cover_page"` // 0-indexed page number for CBZ/PDF cover, NULL for EPUB/M4B
Name *string `json:"name"`
NameSource *string `json:"name_source" tstype:"DataSource"`
PageCount *int `json:"page_count"` // Number of pages for CBZ/PDF files, NULL for EPUB/M4B
AudiobookDurationSeconds *float64 `json:"audiobook_duration_seconds"`
AudiobookBitrateBps *int `json:"audiobook_bitrate_bps"`
AudiobookCodec *string `json:"audiobook_codec"`
Narrators []*Narrator `bun:"rel:has-many,join:id=file_id" json:"narrators,omitempty" tstype:"Narrator[]"`
NarratorSource *string `json:"narrator_source" tstype:"DataSource"`
Identifiers []*FileIdentifier `bun:"rel:has-many,join:id=file_id" json:"identifiers,omitempty" tstype:"FileIdentifier[]"`
IdentifierSource *string `json:"identifier_source" tstype:"DataSource"`
Chapters []*Chapter `bun:"rel:has-many,join:id=file_id" json:"chapters,omitempty" tstype:"Chapter[]"`
URL *string `json:"url"`
URLSource *string `json:"url_source" tstype:"DataSource"`
ReleaseDate *time.Time `json:"release_date"`
ReleaseDateSource *string `json:"release_date_source" tstype:"DataSource"`
PublisherID *int `json:"publisher_id"`
PublisherSource *string `json:"publisher_source" tstype:"DataSource"`
Publisher *Publisher `bun:"rel:belongs-to,join:publisher_id=id" json:"publisher,omitempty" tstype:"Publisher"`
ChapterSource *string `json:"chapter_source" tstype:"DataSource"`
Language *string `json:"language"`
LanguageSource *string `json:"language_source" tstype:"DataSource"`
Abridged *bool `json:"abridged"`
AbridgedSource *string `json:"abridged_source" tstype:"DataSource"`
ReviewOverride *string `json:"review_override" tstype:"ReviewOverride"`
ReviewOverriddenAt *time.Time `json:"review_overridden_at"`
Reviewed *bool `json:"reviewed"`
IsPreferredCover bool `bun:",default:false" json:"is_preferred_cover"`
}
func (*File) CoverExtension ¶
type FileFingerprint ¶ added in v0.0.29
type FileFingerprint struct {
bun.BaseModel `bun:"table:file_fingerprints,alias:ffp" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
FileID int `bun:",nullzero" json:"file_id"`
Algorithm string `bun:",nullzero" json:"algorithm"`
Value string `bun:",nullzero" json:"value"`
File *File `bun:"rel:belongs-to" json:"-"`
}
FileFingerprint is a content fingerprint for a file. A single file may have multiple fingerprints, one per algorithm (e.g. sha256 for exact matching, phash for cover similarity, simhash for text similarity).
type FileIdentifier ¶
type FileIdentifier struct {
bun.BaseModel `bun:"table:file_identifiers,alias:fi" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
FileID int `bun:",nullzero" json:"file_id"`
Type string `bun:",nullzero" json:"type" tstype:"IdentifierType"`
Value string `bun:",nullzero" json:"value"`
Source string `bun:",nullzero" json:"source" tstype:"DataSource"`
}
type Genre ¶
type Genre struct {
bun.BaseModel `bun:"table:genres,alias:g" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Name string `bun:",nullzero" json:"name"`
Aliases []*GenreAlias `bun:"rel:has-many,join:id=genre_id" json:"aliases" tstype:"-"`
BookCount int `bun:",scanonly" json:"book_count"`
}
type GenreAlias ¶ added in v0.0.43
type GenreAlias struct {
bun.BaseModel `bun:"table:genre_aliases,alias:ga" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
GenreID int `bun:",nullzero" json:"genre_id"`
Name string `bun:",nullzero" json:"name"`
LibraryID int `bun:",nullzero" json:"library_id"`
}
type Job ¶
type Job struct {
bun.BaseModel `bun:"table:jobs,alias:j" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Type string `bun:",nullzero" json:"type" tstype:"JobType"`
Status string `bun:",nullzero" json:"status" tstype:"JobStatus"`
Data string `bun:",nullzero" json:"-"`
DataParsed interface{} `` /* 127-byte string literal not displayed */
Progress int `json:"progress"`
ProcessID *string `json:"process_id,omitempty"`
LibraryID *int `json:"library_id,omitempty"`
}
func (*Job) UnmarshalData ¶
type JobBulkDownloadData ¶ added in v0.0.21
type JobBulkDownloadData struct {
// Input (set on creation)
FileIDs []int `json:"file_ids"`
EstimatedSizeBytes int64 `json:"estimated_size_bytes"`
// Result (set on completion)
ZipFilename string `json:"zip_filename,omitempty"`
SizeBytes int64 `json:"size_bytes,omitempty"`
FileCount int `json:"file_count,omitempty"`
FingerprintHash string `json:"fingerprint_hash,omitempty"`
}
type JobExportData ¶
type JobExportData struct{}
type JobHashGenerationData ¶ added in v0.0.29
type JobHashGenerationData struct {
LibraryID int `json:"library_id"`
}
JobHashGenerationData is the payload for a hash generation job. The job processes all files in the given library that do not yet have a sha256 fingerprint in file_fingerprints.
type JobLog ¶
type JobLog struct {
bun.BaseModel `bun:"table:job_logs,alias:jl" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
JobID int `bun:",nullzero" json:"job_id"`
Level string `bun:",nullzero" json:"level" tstype:"LogLevel"`
Message string `bun:",nullzero" json:"message"`
Plugin *string `json:"plugin,omitempty"`
Data *string `json:"data,omitempty"`
StackTrace *string `json:"stack_trace,omitempty"`
}
type JobRecomputeReviewData ¶ added in v0.0.39
type JobRecomputeReviewData struct {
// ClearOverrides, when true, sets review_override and review_overridden_at to NULL
// for every main file before recomputing reviewed.
ClearOverrides bool `json:"clear_overrides"`
}
type JobScanData ¶
type JobScanData struct{}
type Library ¶
type Library struct {
bun.BaseModel `bun:"table:libraries,alias:l" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `bun:",nullzero" json:"name"`
OrganizeFileStructure bool `json:"organize_file_structure"`
CoverAspectRatio string `bun:",nullzero" json:"cover_aspect_ratio" tstype:"CoverAspectRatio"`
DownloadFormatPreference string `bun:",nullzero,default:'original'" json:"download_format_preference" tstype:"DownloadFormat"`
LibraryPaths []*LibraryPath `bun:"rel:has-many" json:"library_paths,omitempty" tstype:"LibraryPath[]"`
}
type LibraryPath ¶
type LibraryPath struct {
bun.BaseModel `bun:"table:library_paths,alias:lp" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Filepath string `bun:",nullzero" json:"filepath"`
}
type LibraryPluginFieldSetting ¶ added in v0.0.10
type LibraryPluginFieldSetting struct {
bun.BaseModel `bun:"table:library_plugin_field_settings,alias:lpfs" tstype:"-"`
LibraryID int `bun:",pk" json:"library_id"`
Scope string `bun:",pk" json:"scope"`
PluginID string `bun:",pk" json:"plugin_id"`
Field string `bun:",pk" json:"field"`
Enabled bool `bun:",notnull" json:"enabled"`
}
LibraryPluginFieldSetting stores per-library field overrides. Only rows with explicit overrides are stored; absence means use global default.
type LibraryPluginHookConfig ¶ added in v0.0.26
type LibraryPluginHookConfig struct {
bun.BaseModel `bun:"table:library_plugin_hook_configs,alias:lphc" tstype:"-"`
LibraryID int `bun:",pk" json:"library_id"`
HookType string `bun:",pk" json:"hook_type" tstype:"PluginHookType"`
Scope string `bun:",pk" json:"scope"`
PluginID string `bun:",pk" json:"plugin_id"`
Position int `bun:",notnull" json:"position"`
Mode string `bun:",notnull,default:'enabled'" json:"mode" tstype:"PluginMode"`
}
type List ¶
type List struct {
bun.BaseModel `bun:"table:lists,alias:l" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID int `bun:",nullzero" json:"user_id"`
User *User `bun:"rel:belongs-to,join:user_id=id" json:"user,omitempty" tstype:"User"`
Name string `bun:",nullzero" json:"name"`
Description *string `json:"description"`
IsOrdered bool `json:"is_ordered"`
DefaultSort string `bun:",nullzero" json:"default_sort" tstype:"ListSort"`
// Relations
ListBooks []*ListBook `bun:"rel:has-many,join:id=list_id" json:"list_books,omitempty" tstype:"ListBook[]"`
}
type ListBook ¶
type ListBook struct {
bun.BaseModel `bun:"table:list_books,alias:lb" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
ListID int `bun:",nullzero" json:"list_id"`
List *List `bun:"rel:belongs-to,join:list_id=id" json:"list,omitempty" tstype:"List"`
BookID int `bun:",nullzero" json:"book_id"`
Book *Book `bun:"rel:belongs-to,join:book_id=id" json:"book,omitempty" tstype:"Book"`
AddedAt time.Time `json:"added_at"`
AddedByUserID *int `json:"added_by_user_id"`
AddedByUser *User `bun:"rel:belongs-to,join:added_by_user_id=id" json:"added_by_user,omitempty" tstype:"User"`
SortOrder *int `json:"sort_order"`
}
type Narrator ¶
type Narrator struct {
bun.BaseModel `bun:"table:narrators,alias:n" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
FileID int `bun:",nullzero" json:"file_id"`
PersonID int `bun:",nullzero" json:"person_id"`
Person *Person `bun:"rel:belongs-to,join:person_id=id" json:"person,omitempty" tstype:"Person"`
SortOrder int `bun:",nullzero" json:"sort_order"`
}
type Permission ¶
type Person ¶
type Person struct {
bun.BaseModel `bun:"table:persons,alias:p" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Name string `bun:",nullzero" json:"name"`
SortName string `bun:",notnull" json:"sort_name"`
SortNameSource string `bun:",notnull" json:"sort_name_source" tstype:"DataSource"`
Aliases []*PersonAlias `bun:"rel:has-many,join:id=person_id" json:"aliases" tstype:"-"`
}
type PersonAlias ¶ added in v0.0.43
type PersonAlias struct {
bun.BaseModel `bun:"table:person_aliases,alias:pa" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
PersonID int `bun:",nullzero" json:"person_id"`
Name string `bun:",nullzero" json:"name"`
LibraryID int `bun:",nullzero" json:"library_id"`
}
type Plugin ¶
type Plugin struct {
bun.BaseModel `bun:"table:plugins,alias:p" tstype:"-"`
Scope string `bun:",pk" json:"scope"`
ID string `bun:",pk" json:"id"`
Name string `bun:",notnull" json:"name"`
Version string `bun:",notnull" json:"version"`
Description *string `json:"description"`
Homepage *string `json:"homepage"`
Status PluginStatus `bun:",notnull,default:0" json:"status"`
AutoUpdate bool `bun:",notnull,default:true" json:"auto_update"`
RepositoryScope *string `json:"repository_scope"`
RepositoryURL *string `json:"repository_url"`
InstalledAt time.Time `bun:",notnull" json:"installed_at"`
UpdatedAt *time.Time `json:"updated_at"`
LoadError *string `json:"load_error"`
UpdateAvailableVersion *string `json:"update_available_version"`
ConfidenceThreshold *float64 `json:"confidence_threshold"`
}
type PluginConfig ¶
type PluginFieldSetting ¶ added in v0.0.10
type PluginFieldSetting struct {
bun.BaseModel `bun:"table:plugin_field_settings,alias:pfs" tstype:"-"`
Scope string `bun:",pk" json:"scope"`
PluginID string `bun:",pk" json:"plugin_id"`
Field string `bun:",pk" json:"field"`
Enabled bool `bun:",notnull" json:"enabled"`
}
PluginFieldSetting stores global field enable/disable settings for a plugin. Absence of a row means the field is enabled (default).
type PluginHookConfig ¶ added in v0.0.26
type PluginHookConfig struct {
bun.BaseModel `bun:"table:plugin_hook_configs,alias:phc" tstype:"-"`
HookType string `bun:",pk" json:"hook_type" tstype:"PluginHookType"`
Scope string `bun:",pk" json:"scope"`
PluginID string `bun:",pk" json:"plugin_id"`
Position int `bun:",notnull" json:"position"`
Mode string `bun:",notnull,default:'enabled'" json:"mode" tstype:"PluginMode"`
}
type PluginIdentifierType ¶
type PluginIdentifierType struct {
bun.BaseModel `bun:"table:plugin_identifier_types,alias:pit" tstype:"-"`
ID string `bun:",pk" json:"id"`
Scope string `bun:",pk" json:"scope"`
PluginID string `bun:",pk" json:"plugin_id"`
Name string `bun:",notnull" json:"name"`
URLTemplate *string `json:"url_template"`
Pattern *string `json:"pattern"`
}
type PluginRepository ¶
type PluginRepository struct {
bun.BaseModel `bun:"table:plugin_repositories,alias:pr" tstype:"-"`
URL string `bun:",pk" json:"url"`
Scope string `bun:",notnull,unique" json:"scope"`
Name *string `json:"name"`
IsOfficial bool `bun:",notnull" json:"is_official"`
Enabled bool `bun:",notnull" json:"enabled"`
LastFetchedAt *time.Time `json:"last_fetched_at"`
FetchError *string `json:"fetch_error"`
}
type PluginStatus ¶ added in v0.0.18
type PluginStatus int
PluginStatus represents the lifecycle state of a plugin.
const ( // PluginStatusActive means the plugin is running normally. PluginStatusActive PluginStatus = 0 // PluginStatusDisabled means the user has disabled the plugin. PluginStatusDisabled PluginStatus = -1 // PluginStatusMalfunctioned means the plugin failed to load (LoadError has details). PluginStatusMalfunctioned PluginStatus = -2 // PluginStatusNotSupported means the plugin's minShishoVersion is incompatible. PluginStatusNotSupported PluginStatus = -3 )
type Publisher ¶
type Publisher struct {
bun.BaseModel `bun:"table:publishers,alias:pub" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Name string `bun:",nullzero" json:"name"`
ParentID *int `json:"parent_id"`
Parent *Publisher `bun:"rel:belongs-to,join:parent_id=id" json:"parent,omitempty" tstype:"Publisher"`
// Children and Aliases are reshaped by the publishers API responses
// (Children flattens to ChildResponse, Aliases to []string), so they are
// excluded from TS generation with tstype:"-". The json tags stay so the Go
// wire format is unchanged. See pkg/publishers/types.go and ADR 0004.
Children []*Publisher `bun:"rel:has-many,join:id=parent_id" json:"children,omitempty" tstype:"-"`
Aliases []*PublisherAlias `bun:"rel:has-many,join:id=publisher_id" json:"aliases" tstype:"-"`
FileCount int `bun:",scanonly" json:"file_count"`
}
type PublisherAlias ¶ added in v0.0.43
type PublisherAlias struct {
bun.BaseModel `bun:"table:publisher_aliases,alias:puba" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
PublisherID int `bun:",nullzero" json:"publisher_id"`
Name string `bun:",nullzero" json:"name"`
LibraryID int `bun:",nullzero" json:"library_id"`
}
type Role ¶
type Role struct {
bun.BaseModel `bun:"table:roles,alias:r" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `bun:",nullzero" json:"name"`
IsSystem bool `json:"is_system"`
Permissions []*Permission `bun:"rel:has-many,join:id=role_id" json:"permissions,omitempty" tstype:"Permission[]"`
}
func (*Role) HasPermission ¶
HasPermission checks if the role has a specific permission.
type Series ¶
type Series struct {
bun.BaseModel `bun:"table:series,alias:s" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Library *Library `bun:"rel:belongs-to" json:"library,omitempty" tstype:"Library"`
Name string `bun:",nullzero" json:"name"`
NameSource string `bun:",nullzero" json:"name_source" tstype:"DataSource"`
SortName string `bun:",notnull" json:"sort_name"`
SortNameSource string `bun:",notnull" json:"sort_name_source" tstype:"DataSource"`
Description *string `json:"description,omitempty"`
CoverImageFilename *string `json:"cover_image_filename,omitempty"`
Aliases []*SeriesAlias `bun:"rel:has-many,join:id=series_id" json:"aliases" tstype:"-"`
BookSeries []*BookSeries `bun:"rel:has-many" json:"book_series,omitempty" tstype:"BookSeries[]"`
BookCount int `bun:",scanonly" json:"book_count"`
CoverCacheKey string `bun:"-" json:"cover_cache_key"`
}
type SeriesAlias ¶ added in v0.0.43
type SeriesAlias struct {
bun.BaseModel `bun:"table:series_aliases,alias:sa" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
SeriesID int `bun:",nullzero" json:"series_id"`
Name string `bun:",nullzero" json:"name"`
LibraryID int `bun:",nullzero" json:"library_id"`
}
type Tag ¶
type Tag struct {
bun.BaseModel `bun:"table:tags,alias:t" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LibraryID int `bun:",nullzero" json:"library_id"`
Name string `bun:",nullzero" json:"name"`
Aliases []*TagAlias `bun:"rel:has-many,join:id=tag_id" json:"aliases" tstype:"-"`
BookCount int `bun:",scanonly" json:"book_count"`
}
type User ¶
type User struct {
bun.BaseModel `bun:"table:users,alias:u" tstype:"-"`
ID int `bun:",pk,nullzero" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Username string `bun:",nullzero" json:"username"`
Email *string `json:"email,omitempty"`
PasswordHash string `json:"-"` // Never expose password hash
RoleID int `json:"role_id"`
IsActive bool `json:"is_active"`
MustChangePassword bool `json:"must_change_password"`
// Relations
Role *Role `bun:"rel:belongs-to,join:role_id=id" json:"role,omitempty" tstype:"Role"`
LibraryAccess []*UserLibraryAccess `bun:"rel:has-many,join:id=user_id" json:"library_access,omitempty" tstype:"UserLibraryAccess[]"`
}
func (*User) GetAccessibleLibraryIDs ¶
GetAccessibleLibraryIDs returns the list of library IDs the user can access. Returns nil if user has access to all libraries.
func (*User) HasAllLibraryAccess ¶
HasAllLibraryAccess checks if the user has access to all libraries.
func (*User) HasLibraryAccess ¶
HasLibraryAccess checks if the user can access a specific library. Returns true if user has access to all libraries (null library_id entry) or has explicit access to the specified library.
func (*User) HasPermission ¶
HasPermission checks if the user has a specific permission.
type UserLibraryAccess ¶
type UserLibrarySettings ¶ added in v0.0.32
type UserLibrarySettings struct {
bun.BaseModel `bun:"table:user_library_settings,alias:uls" tstype:"-"`
ID int `bun:",pk,autoincrement"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
UserID int `bun:",notnull"`
LibraryID int `bun:",notnull"`
SortSpec *string `bun:",nullzero"`
}
UserLibrarySettings is intentionally not exposed over JSON or generated as a TS type (`tstype:"-"`). Handlers transform it into LibrarySettingsResponse (in pkg/settings) so the wire shape can evolve independently of the storage row, and tygo skips it. The struct therefore carries no `json:"..."` tags.
type UserSettings ¶
type UserSettings struct {
bun.BaseModel `bun:"table:user_settings,alias:us" tstype:"-"`
ID int `bun:",pk,autoincrement" json:"id"`
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at"`
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at"`
UserID int `bun:",notnull,unique" json:"user_id"`
ViewerPreloadCount int `bun:",notnull,default:3" json:"viewer_preload_count"`
ViewerFitMode string `bun:",notnull,default:'fit-height'" json:"viewer_fit_mode" tstype:"FitMode"`
EpubFontSize int `bun:"viewer_epub_font_size,notnull,default:100" json:"viewer_epub_font_size"`
EpubTheme string `bun:"viewer_epub_theme,notnull,default:'light'" json:"viewer_epub_theme" tstype:"EpubTheme"`
EpubFlow string `bun:"viewer_epub_flow,notnull,default:'paginated'" json:"viewer_epub_flow" tstype:"EpubFlow"`
GallerySize string `bun:",notnull,default:'m'" json:"gallery_size" tstype:"GallerySize"`
ViewerHideChrome bool `bun:",notnull,default:false" json:"viewer_hide_chrome"`
PlaybackSpeed float64 `bun:"viewer_playback_speed,notnull,default:1.0" json:"viewer_playback_speed" tstype:"PlaybackSpeed"`
}
func DefaultUserSettings ¶
func DefaultUserSettings() *UserSettings
DefaultUserSettings returns a UserSettings with default values.