c265b871c3
Persists the operator's metadata-profile choice alongside quality profile + root folder. Defaults to the first profile Lidarr returns (usually 'Standard' on a vanilla install) so the common case is zero-click; operators with custom profiles like 'Singles only' can pick explicitly. Backend: - Migration 0013: adds nullable default_metadata_profile_id to lidarr_config. Existing rows get NULL and the service falls back to fetch-and-pick-first until they save. - Updated lidarr_config queries + sqlc + lidarrconfig.Config + admin view/put body to round-trip the new field. - handlePutLidarrConfig requires it (along with QP and root folder) when enabled=true — matches the existing missing_defaults gate. - New GET /api/admin/lidarr/metadata-profiles handler + lidarr.Client ListMetadataProfiles (GET /api/v1/metadataprofile, same shape as the quality-profile endpoint). - lidarrrequests.Approve prefers cfg.DefaultMetadataProfileID; falls back to the fetch-list path only when 0 (back-compat for upgraders). Frontend: - LidarrConfig type + LidarrMetadataProfile type + qk.lidarrMetadataProfiles. - listMetadataProfiles + createMetadataProfilesQuery client helpers. - Integrations page: third <select> picker, auto-defaults to first profile when the saved value is 0, sends the new field on save and clears it on disconnect. - Updated test fixtures + the duplicate 'Standard' option string in the dropdown-populates assertion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
404 lines
9.7 KiB
Go
404 lines
9.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package dbq
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type LidarrQuarantineActionKind string
|
|
|
|
const (
|
|
LidarrQuarantineActionKindResolved LidarrQuarantineActionKind = "resolved"
|
|
LidarrQuarantineActionKindDeletedFile LidarrQuarantineActionKind = "deleted_file"
|
|
LidarrQuarantineActionKindDeletedViaLidarr LidarrQuarantineActionKind = "deleted_via_lidarr"
|
|
)
|
|
|
|
func (e *LidarrQuarantineActionKind) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = LidarrQuarantineActionKind(s)
|
|
case string:
|
|
*e = LidarrQuarantineActionKind(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for LidarrQuarantineActionKind: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullLidarrQuarantineActionKind struct {
|
|
LidarrQuarantineActionKind LidarrQuarantineActionKind
|
|
Valid bool // Valid is true if LidarrQuarantineActionKind is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullLidarrQuarantineActionKind) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.LidarrQuarantineActionKind, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.LidarrQuarantineActionKind.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullLidarrQuarantineActionKind) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.LidarrQuarantineActionKind), nil
|
|
}
|
|
|
|
type LidarrQuarantineReason string
|
|
|
|
const (
|
|
LidarrQuarantineReasonBadRip LidarrQuarantineReason = "bad_rip"
|
|
LidarrQuarantineReasonWrongFile LidarrQuarantineReason = "wrong_file"
|
|
LidarrQuarantineReasonWrongTags LidarrQuarantineReason = "wrong_tags"
|
|
LidarrQuarantineReasonDuplicate LidarrQuarantineReason = "duplicate"
|
|
LidarrQuarantineReasonOther LidarrQuarantineReason = "other"
|
|
)
|
|
|
|
func (e *LidarrQuarantineReason) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = LidarrQuarantineReason(s)
|
|
case string:
|
|
*e = LidarrQuarantineReason(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for LidarrQuarantineReason: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullLidarrQuarantineReason struct {
|
|
LidarrQuarantineReason LidarrQuarantineReason
|
|
Valid bool // Valid is true if LidarrQuarantineReason is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullLidarrQuarantineReason) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.LidarrQuarantineReason, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.LidarrQuarantineReason.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullLidarrQuarantineReason) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.LidarrQuarantineReason), nil
|
|
}
|
|
|
|
type LidarrRequestKind string
|
|
|
|
const (
|
|
LidarrRequestKindArtist LidarrRequestKind = "artist"
|
|
LidarrRequestKindAlbum LidarrRequestKind = "album"
|
|
LidarrRequestKindTrack LidarrRequestKind = "track"
|
|
)
|
|
|
|
func (e *LidarrRequestKind) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = LidarrRequestKind(s)
|
|
case string:
|
|
*e = LidarrRequestKind(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for LidarrRequestKind: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullLidarrRequestKind struct {
|
|
LidarrRequestKind LidarrRequestKind
|
|
Valid bool // Valid is true if LidarrRequestKind is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullLidarrRequestKind) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.LidarrRequestKind, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.LidarrRequestKind.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullLidarrRequestKind) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.LidarrRequestKind), nil
|
|
}
|
|
|
|
type LidarrRequestStatus string
|
|
|
|
const (
|
|
LidarrRequestStatusPending LidarrRequestStatus = "pending"
|
|
LidarrRequestStatusApproved LidarrRequestStatus = "approved"
|
|
LidarrRequestStatusRejected LidarrRequestStatus = "rejected"
|
|
LidarrRequestStatusCompleted LidarrRequestStatus = "completed"
|
|
LidarrRequestStatusFailed LidarrRequestStatus = "failed"
|
|
)
|
|
|
|
func (e *LidarrRequestStatus) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = LidarrRequestStatus(s)
|
|
case string:
|
|
*e = LidarrRequestStatus(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for LidarrRequestStatus: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullLidarrRequestStatus struct {
|
|
LidarrRequestStatus LidarrRequestStatus
|
|
Valid bool // Valid is true if LidarrRequestStatus is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullLidarrRequestStatus) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.LidarrRequestStatus, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.LidarrRequestStatus.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullLidarrRequestStatus) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.LidarrRequestStatus), nil
|
|
}
|
|
|
|
type Album struct {
|
|
ID pgtype.UUID
|
|
Title string
|
|
SortTitle string
|
|
ArtistID pgtype.UUID
|
|
ReleaseDate pgtype.Date
|
|
Mbid *string
|
|
CoverArtPath *string
|
|
CreatedAt pgtype.Timestamptz
|
|
UpdatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type Artist struct {
|
|
ID pgtype.UUID
|
|
Name string
|
|
SortName string
|
|
Mbid *string
|
|
CreatedAt pgtype.Timestamptz
|
|
UpdatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type ArtistSimilarity struct {
|
|
ArtistAID pgtype.UUID
|
|
ArtistBID pgtype.UUID
|
|
Score float64
|
|
Source string
|
|
FetchedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type ArtistSimilarityUnmatched struct {
|
|
SeedArtistID pgtype.UUID
|
|
CandidateMbid string
|
|
CandidateName string
|
|
Score float64
|
|
Source string
|
|
FetchedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type ContextualLike struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
LikedAt pgtype.Timestamptz
|
|
DeletedAt pgtype.Timestamptz
|
|
SessionVector []byte
|
|
SessionID pgtype.UUID
|
|
}
|
|
|
|
type GeneralLike struct {
|
|
UserID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
LikedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type GeneralLikesAlbum struct {
|
|
UserID pgtype.UUID
|
|
AlbumID pgtype.UUID
|
|
LikedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type GeneralLikesArtist struct {
|
|
UserID pgtype.UUID
|
|
ArtistID pgtype.UUID
|
|
LikedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type LidarrConfig struct {
|
|
ID int16
|
|
Enabled bool
|
|
BaseUrl *string
|
|
ApiKey *string
|
|
DefaultQualityProfileID *int32
|
|
DefaultRootFolderPath *string
|
|
CreatedAt pgtype.Timestamptz
|
|
UpdatedAt pgtype.Timestamptz
|
|
DefaultMetadataProfileID *int32
|
|
}
|
|
|
|
type LidarrQuarantine struct {
|
|
UserID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
Reason LidarrQuarantineReason
|
|
Notes *string
|
|
CreatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type LidarrQuarantineAction struct {
|
|
ID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
TrackTitle string
|
|
ArtistName string
|
|
AlbumTitle *string
|
|
Action LidarrQuarantineActionKind
|
|
AdminID pgtype.UUID
|
|
LidarrAlbumMbid *string
|
|
AffectedUsers int32
|
|
CreatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type LidarrRequest struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
Status LidarrRequestStatus
|
|
Kind LidarrRequestKind
|
|
LidarrArtistMbid string
|
|
LidarrAlbumMbid *string
|
|
LidarrTrackMbid *string
|
|
ArtistName string
|
|
AlbumTitle *string
|
|
TrackTitle *string
|
|
QualityProfileID *int32
|
|
RootFolderPath *string
|
|
DecidedAt pgtype.Timestamptz
|
|
DecidedBy pgtype.UUID
|
|
Notes *string
|
|
CompletedAt pgtype.Timestamptz
|
|
MatchedTrackID pgtype.UUID
|
|
MatchedAlbumID pgtype.UUID
|
|
MatchedArtistID pgtype.UUID
|
|
RequestedAt pgtype.Timestamptz
|
|
UpdatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type PlayEvent struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
SessionID pgtype.UUID
|
|
StartedAt pgtype.Timestamptz
|
|
EndedAt pgtype.Timestamptz
|
|
DurationPlayedMs *int32
|
|
CompletionRatio *float64
|
|
WasSkipped bool
|
|
ClientID *string
|
|
SessionVectorAtPlay []byte
|
|
ScrobbledAt pgtype.Timestamptz
|
|
}
|
|
|
|
type PlaySession struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
StartedAt pgtype.Timestamptz
|
|
EndedAt pgtype.Timestamptz
|
|
LastEventAt pgtype.Timestamptz
|
|
TrackCount int32
|
|
ClientID *string
|
|
}
|
|
|
|
type ScrobbleQueue struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
PlayEventID pgtype.UUID
|
|
Status string
|
|
Attempts int32
|
|
NextAttemptAt pgtype.Timestamptz
|
|
LastError *string
|
|
EnqueuedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type Session struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
TokenHash []byte
|
|
UserAgent string
|
|
CreatedAt pgtype.Timestamptz
|
|
LastSeenAt pgtype.Timestamptz
|
|
}
|
|
|
|
type SkipEvent struct {
|
|
ID pgtype.UUID
|
|
UserID pgtype.UUID
|
|
TrackID pgtype.UUID
|
|
SessionID pgtype.UUID
|
|
SkippedAt pgtype.Timestamptz
|
|
PositionMs int32
|
|
}
|
|
|
|
type Track struct {
|
|
ID pgtype.UUID
|
|
Title string
|
|
AlbumID pgtype.UUID
|
|
ArtistID pgtype.UUID
|
|
TrackNumber *int32
|
|
DiscNumber *int32
|
|
DurationMs int32
|
|
FilePath string
|
|
FileSize int64
|
|
FileFormat string
|
|
Bitrate *int32
|
|
Mbid *string
|
|
Genre *string
|
|
AddedAt pgtype.Timestamptz
|
|
UpdatedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type TrackSimilarity struct {
|
|
TrackAID pgtype.UUID
|
|
TrackBID pgtype.UUID
|
|
Score float64
|
|
Source string
|
|
FetchedAt pgtype.Timestamptz
|
|
}
|
|
|
|
type User struct {
|
|
ID pgtype.UUID
|
|
Username string
|
|
PasswordHash string
|
|
ApiToken string
|
|
IsAdmin bool
|
|
CreatedAt pgtype.Timestamptz
|
|
SubsonicPassword *string
|
|
ListenbrainzToken *string
|
|
ListenbrainzEnabled bool
|
|
}
|