fix: show artist covers (raw url in artist info, cover id elsewhere) via scanned guessed artist folder

closes #180
closes #179
This commit is contained in:
sentriz
2022-01-04 22:53:30 +00:00
parent cb6b33a9fb
commit c0ebd26422
5 changed files with 33 additions and 26 deletions

View File

@@ -37,6 +37,7 @@ func (db *DB) Migrate(ctx MigrationContext) error {
construct(ctx, "202102191448", migratePodcastAutoDownload),
construct(ctx, "202110041330", migrateAlbumCreatedAt),
construct(ctx, "202111021951", migrateAlbumRootDir),
construct(ctx, "202201042236", migrateArtistGuessedFolder),
}
return gormigrate.
@@ -306,3 +307,7 @@ func migrateAlbumRootDir(tx *gorm.DB, ctx MigrationContext) error {
}
return nil
}
func migrateArtistGuessedFolder(tx *gorm.DB, ctx MigrationContext) error {
return tx.AutoMigrate(Artist{}).Error
}

View File

@@ -43,11 +43,13 @@ func joinInt(in []int, sep string) string {
}
type Artist struct {
ID int `gorm:"primary_key"`
Name string `gorm:"not null; unique_index"`
NameUDec string `sql:"default: null"`
Albums []*Album `gorm:"foreignkey:TagArtistID"`
AlbumCount int `sql:"-"`
ID int `gorm:"primary_key"`
Name string `gorm:"not null; unique_index"`
NameUDec string `sql:"default: null"`
Albums []*Album `gorm:"foreignkey:TagArtistID"`
AlbumCount int `sql:"-"`
GuessedFolder *Album
GuessedFolderID int `sql:"default: null; type:int REFERENCES albums(id)"`
}
func (a *Artist) SID() *specid.ID {