Documentation
¶
Index ¶
- func DefaultOptions() url.Values
- func Dump(ctx context.Context, db *gorm.DB, to string) error
- type Album
- type AlbumArtist
- type AlbumGenre
- type AlbumInfo
- type AlbumRating
- type AlbumStar
- type Artist
- type ArtistAppearances
- type ArtistInfo
- type ArtistRating
- type ArtistStar
- type AudioFile
- type Bookmark
- type DB
- func (db *DB) Begin() *DB
- func (db *DB) GetSetting(key SettingKey) (string, error)
- func (db *DB) GetUserByID(id int) *User
- func (db *DB) GetUserByName(name string) *User
- func (db *DB) InsertBulkLeftMany(table string, head []string, left int, col []int) error
- func (db *DB) Migrate(ctx MigrationContext) error
- func (db *DB) SetSetting(key SettingKey, value string) error
- func (db *DB) Stats() (Stats, error)
- func (db *DB) Transaction(cb func(*DB) error) error
- func (db *DB) TransactionChunked(data []int64, cb func(*DB, []int64) error) error
- type Genre
- type InternetRadioStation
- type MigrationContext
- type Play
- type PlayQueue
- type Podcast
- type PodcastAutoDownload
- type PodcastEpisode
- func (pe *PodcastEpisode) AbsPath() string
- func (pe *PodcastEpisode) AudioBitrate() int
- func (pe *PodcastEpisode) AudioFilename() string
- func (pe *PodcastEpisode) AudioLength() int
- func (pe *PodcastEpisode) Ext() string
- func (pe *PodcastEpisode) MIME() string
- func (pe *PodcastEpisode) PodcastSID() *specid.ID
- func (pe *PodcastEpisode) SID() *specid.ID
- type PodcastEpisodeStatus
- type Setting
- type SettingKey
- type Stats
- type Track
- func (t *Track) AbsPath() string
- func (t *Track) AlbumSID() *specid.ID
- func (t *Track) AudioBitrate() int
- func (t *Track) AudioFilename() string
- func (t *Track) AudioLength() int
- func (t *Track) Ext() string
- func (t *Track) MIME() string
- func (t *Track) RelPath() string
- func (t *Track) SID() *specid.ID
- type TrackArtist
- type TrackGenre
- type TrackRating
- type TrackStar
- type TranscodePreference
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultOptions ¶
Types ¶
type Album ¶
type Album struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
ModifiedAt time.Time
LeftPath string `gorm:"unique_index:idx_album_abs_path"`
RightPath string `gorm:"not null; unique_index:idx_album_abs_path" sql:"default: null"`
RightPathUDec string `sql:"default: null"`
Parent *Album
ParentID int `sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
RootDir string `gorm:"unique_index:idx_album_abs_path" sql:"default: null"`
Genres []*Genre `gorm:"many2many:album_genres"`
Cover string `sql:"default: null"`
Artists []*Artist `gorm:"many2many:album_artists"`
TagTitle string `sql:"default: null"`
TagAlbumArtist string // display purposes only
TagTitleUDec string `sql:"default: null"`
TagBrainzID string `sql:"default: null"`
TagYear int `sql:"default: null"`
TagCompilation bool `sql:"default: null"`
TagReleaseType string `sql:"default: null"`
Tracks []*Track
ChildCount int `sql:"-"`
Duration int `sql:"-"`
AlbumStar *AlbumStar
AlbumRating *AlbumRating
AverageRating float64 `sql:"default: null"`
Play *Play
}
func (*Album) IndexRightPath ¶
type AlbumArtist ¶
type AlbumArtist struct {
AlbumID int `gorm:"not null; unique_index:idx_album_id_artist_id" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
ArtistID int `gorm:"not null; unique_index:idx_album_id_artist_id" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
}
type AlbumGenre ¶
type AlbumRating ¶
type AlbumRating struct {
UserID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
AlbumID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
Rating int `gorm:"not null; check:(rating >= 1 AND rating <= 5)"`
}
type Artist ¶
type Artist struct {
ID int `gorm:"primary_key"`
Name string `gorm:"not null; unique_index"`
NameUDec string `sql:"default: null"`
Albums []*Album `gorm:"many2many:album_artists"`
AlbumCount int `sql:"-"`
Appearances []*Album `gorm:"many2many:artist_appearances"`
AppearanceCount int `sql:"-"`
ArtistStar *ArtistStar
ArtistRating *ArtistRating
AverageRating float64 `sql:"default: null"`
Info *ArtistInfo `gorm:"foreignkey:id"`
}
type ArtistAppearances ¶
type ArtistAppearances struct {
ArtistID int `gorm:"not null; unique_index:idx_artist_id_album_id" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
AlbumID int `gorm:"not null; unique_index:idx_artist_id_album_id" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
}
type ArtistInfo ¶
type ArtistInfo struct {
ID int `gorm:"primary_key" sql:"type:int REFERENCES artists(id) ON DELETE CASCADE"`
CreatedAt time.Time
UpdatedAt time.Time `gorm:"index"`
Biography string
MusicBrainzID string
LastFMURL string
ImageURL string
SimilarArtists string
TopTracks string
}
func (*ArtistInfo) GetSimilarArtists ¶
func (p *ArtistInfo) GetSimilarArtists() []string
func (*ArtistInfo) GetTopTracks ¶
func (p *ArtistInfo) GetTopTracks() []string
func (*ArtistInfo) SetSimilarArtists ¶
func (p *ArtistInfo) SetSimilarArtists(items []string)
func (*ArtistInfo) SetTopTracks ¶
func (p *ArtistInfo) SetTopTracks(items []string)
type ArtistRating ¶
type ArtistRating struct {
UserID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
ArtistID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
Rating int `gorm:"not null; check:(rating >= 1 AND rating <= 5)"`
}
type ArtistStar ¶
type AudioFile ¶
type AudioFile interface {
Ext() string
MIME() string
AudioFilename() string
AudioBitrate() int
AudioLength() int
}
AudioFile is used to avoid some duplication in handlers_raw.go between Track and Podcast
type DB ¶
func (*DB) GetSetting ¶
func (db *DB) GetSetting(key SettingKey) (string, error)
func (*DB) GetUserByID ¶
func (*DB) GetUserByName ¶
func (*DB) InsertBulkLeftMany ¶
func (*DB) Migrate ¶
func (db *DB) Migrate(ctx MigrationContext) error
func (*DB) SetSetting ¶
func (db *DB) SetSetting(key SettingKey, value string) error
type InternetRadioStation ¶
type InternetRadioStation struct {
ID int `gorm:"primary_key"`
StreamURL string
Name string
HomepageURL string
}
func (*InternetRadioStation) AbsPath ¶
func (ir *InternetRadioStation) AbsPath() string
func (*InternetRadioStation) SID ¶
func (ir *InternetRadioStation) SID() *specid.ID
type MigrationContext ¶
type Play ¶
type Play struct {
ID int `gorm:"primary_key"`
User *User
UserID int `gorm:"not null; index" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
Album *Album
AlbumID int `gorm:"not null; index" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
Time time.Time `sql:"default: null"`
Count int
Length int
}
type PlayQueue ¶
type PlayQueue struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
User *User
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
Current string
Position int
ChangedBy string
Items string
}
func (*PlayQueue) CurrentSID ¶
type Podcast ¶
type PodcastAutoDownload ¶
type PodcastAutoDownload string
const ( PodcastAutoDownloadLatest PodcastAutoDownload = "latest" PodcastAutoDownloadNone PodcastAutoDownload = "none" )
type PodcastEpisode ¶
type PodcastEpisode struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
ModifiedAt time.Time
PodcastID int `gorm:"not null" sql:"default: null; type:int REFERENCES podcasts(id) ON DELETE CASCADE"`
Title string
Description string
PublishDate *time.Time
AudioURL string
Bitrate int
Length int
Size int
Filename string
Status PodcastEpisodeStatus
Error string
Podcast *Podcast
Artist string
Album string
}
func (*PodcastEpisode) AbsPath ¶
func (pe *PodcastEpisode) AbsPath() string
func (*PodcastEpisode) AudioBitrate ¶
func (pe *PodcastEpisode) AudioBitrate() int
func (*PodcastEpisode) AudioFilename ¶
func (pe *PodcastEpisode) AudioFilename() string
func (*PodcastEpisode) AudioLength ¶
func (pe *PodcastEpisode) AudioLength() int
func (*PodcastEpisode) Ext ¶
func (pe *PodcastEpisode) Ext() string
func (*PodcastEpisode) MIME ¶
func (pe *PodcastEpisode) MIME() string
func (*PodcastEpisode) PodcastSID ¶
func (pe *PodcastEpisode) PodcastSID() *specid.ID
func (*PodcastEpisode) SID ¶
func (pe *PodcastEpisode) SID() *specid.ID
type PodcastEpisodeStatus ¶
type PodcastEpisodeStatus string
const ( PodcastEpisodeStatusDownloading PodcastEpisodeStatus = "downloading" PodcastEpisodeStatusSkipped PodcastEpisodeStatus = "skipped" PodcastEpisodeStatusDeleted PodcastEpisodeStatus = "deleted" PodcastEpisodeStatusCompleted PodcastEpisodeStatus = "completed" PodcastEpisodeStatusError PodcastEpisodeStatus = "error" )
type Setting ¶
type Setting struct {
Key SettingKey `gorm:"not null; primary_key; auto_increment:false" sql:"default: null"`
Value string `sql:"default: null"`
}
type SettingKey ¶
type SettingKey string
const ( LastFMAPIKey SettingKey = "lastfm_api_key" //nolint:gosec LastFMSecret SettingKey = "lastfm_secret" LastScanTime SettingKey = "last_scan_time" )
type Stats ¶
type Stats struct {
Folders, Albums, Artists, AlbumArtists, Tracks, InternetRadioStations, Podcasts uint
}
type Track ¶
type Track struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
Filename string `gorm:"not null; unique_index:idx_folder_filename" sql:"default: null"`
FilenameUDec string `sql:"default: null"`
Album *Album
AlbumID int `gorm:"not null; unique_index:idx_folder_filename" sql:"default: null; type:int REFERENCES albums(id) ON DELETE CASCADE"`
Artists []*Artist `gorm:"many2many:track_artists"`
Genres []*Genre `gorm:"many2many:track_genres"`
Size int `sql:"default: null"`
Length int `sql:"default: null"`
Bitrate int `sql:"default: null"`
TagTitle string `sql:"default: null"`
TagTitleUDec string `sql:"default: null"`
TagTrackArtist string `sql:"default: null"`
TagTrackNumber int `sql:"default: null"`
TagDiscNumber int `sql:"default: null"`
TagBrainzID string `sql:"default: null"`
TagLyrics string `sql:"default:null"`
ReplayGainTrackGain float32
ReplayGainTrackPeak float32
ReplayGainAlbumGain float32
ReplayGainAlbumPeak float32
TrackStar *TrackStar
TrackRating *TrackRating
AverageRating float64 `sql:"default: null"`
}
func (*Track) AudioBitrate ¶
func (*Track) AudioFilename ¶
func (*Track) AudioLength ¶
type TrackArtist ¶
type TrackArtist struct {
TrackID int `gorm:"not null; unique_index:idx_track_id_artist_id" sql:"default: null; type:int REFERENCES tracks(id) ON DELETE CASCADE"`
ArtistID int `gorm:"not null; unique_index:idx_track_id_artist_id" sql:"default: null; type:int REFERENCES artists(id) ON DELETE CASCADE"`
}
type TrackGenre ¶
type TrackRating ¶
type TrackRating struct {
UserID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
TrackID int `gorm:"primary_key; not null" sql:"default: null; type:int REFERENCES tracks(id) ON DELETE CASCADE"`
Rating int `gorm:"not null; check:(rating >= 1 AND rating <= 5)"`
}
type TranscodePreference ¶
type TranscodePreference struct {
UserID int `gorm:"not null; unique_index:idx_user_id_client" sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
Client string `gorm:"not null; unique_index:idx_user_id_client" sql:"default: null"`
Profile string `gorm:"not null" sql:"default: null"`
}
type User ¶
type User struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
Name string `gorm:"not null; unique_index" sql:"default: null"`
Password string `gorm:"not null" sql:"default: null"`
LastFMSession string `sql:"default: null"`
ListenBrainzURL string `sql:"default: null"`
ListenBrainzToken string `sql:"default: null"`
IsAdmin bool `sql:"default: null"`
Avatar []byte `sql:"default: null"`
}
Click to show internal directories.
Click to hide internal directories.