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 ¶ added in v0.15.0
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"` Tracks []*Track ChildCount int `sql:"-"` Duration int `sql:"-"` AlbumStar *AlbumStar AlbumRating *AlbumRating AverageRating float64 `sql:"default: null"` Play *Play }
func (*Album) IndexRightPath ¶
type AlbumArtist ¶ added in v0.16.0
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 ¶ added in v0.15.0
type AlbumRating ¶ added in v0.15.0
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 ¶ added in v0.16.1
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 ¶ added in v0.16.0
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 ¶ added in v0.16.0
func (p *ArtistInfo) GetSimilarArtists() []string
func (*ArtistInfo) GetTopTracks ¶ added in v0.16.0
func (p *ArtistInfo) GetTopTracks() []string
func (*ArtistInfo) SetSimilarArtists ¶ added in v0.16.0
func (p *ArtistInfo) SetSimilarArtists(items []string)
func (*ArtistInfo) SetTopTracks ¶ added in v0.16.0
func (p *ArtistInfo) SetTopTracks(items []string)
type ArtistRating ¶ added in v0.15.0
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 ¶ added in v0.15.0
type AudioFile ¶ added in v0.15.0
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 ¶ added in v0.15.0
func (*DB) GetUserByName ¶ added in v0.15.0
func (*DB) InsertBulkLeftMany ¶ added in v0.15.0
func (*DB) Migrate ¶ added in v0.15.0
func (db *DB) Migrate(ctx MigrationContext) error
func (*DB) SetSetting ¶
func (db *DB) SetSetting(key SettingKey, value string) error
type InternetRadioStation ¶ added in v0.15.0
type InternetRadioStation struct { ID int `gorm:"primary_key"` StreamURL string Name string HomepageURL string }
func (*InternetRadioStation) AbsPath ¶ added in v0.16.4
func (ir *InternetRadioStation) AbsPath() string
func (*InternetRadioStation) SID ¶ added in v0.15.0
func (ir *InternetRadioStation) SID() *specid.ID
type MigrationContext ¶ added in v0.15.0
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 ¶ added in v0.15.0
type Podcast ¶ added in v0.15.0
type PodcastAutoDownload ¶ added in v0.15.0
type PodcastAutoDownload string
const ( PodcastAutoDownloadLatest PodcastAutoDownload = "latest" PodcastAutoDownloadNone PodcastAutoDownload = "none" )
type PodcastEpisode ¶ added in v0.15.0
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 }
func (*PodcastEpisode) AbsPath ¶ added in v0.16.0
func (pe *PodcastEpisode) AbsPath() string
func (*PodcastEpisode) AudioBitrate ¶ added in v0.15.0
func (pe *PodcastEpisode) AudioBitrate() int
func (*PodcastEpisode) AudioFilename ¶ added in v0.15.0
func (pe *PodcastEpisode) AudioFilename() string
func (*PodcastEpisode) AudioLength ¶ added in v0.15.0
func (pe *PodcastEpisode) AudioLength() int
func (*PodcastEpisode) Ext ¶ added in v0.15.0
func (pe *PodcastEpisode) Ext() string
func (*PodcastEpisode) MIME ¶ added in v0.15.0
func (pe *PodcastEpisode) MIME() string
func (*PodcastEpisode) PodcastSID ¶ added in v0.15.0
func (pe *PodcastEpisode) PodcastSID() *specid.ID
func (*PodcastEpisode) SID ¶ added in v0.15.0
func (pe *PodcastEpisode) SID() *specid.ID
type PodcastEpisodeStatus ¶ added in v0.15.0
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 ¶ added in v0.16.0
type SettingKey string
const ( LastFMAPIKey SettingKey = "lastfm_api_key" //nolint:gosec LastFMSecret SettingKey = "lastfm_secret" LastScanTime SettingKey = "last_scan_time" )
type Stats ¶ added in v0.16.1
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"` TrackStar *TrackStar TrackRating *TrackRating AverageRating float64 `sql:"default: null"` }
func (*Track) AudioBitrate ¶ added in v0.15.0
func (*Track) AudioFilename ¶ added in v0.15.0
func (*Track) AudioLength ¶ added in v0.15.0
type TrackArtist ¶ added in v0.16.1
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 ¶ added in v0.15.0
type TrackRating ¶ added in v0.15.0
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.