Purge empty albums/artists
This commit is contained in:
@@ -157,6 +157,12 @@ func (r *albumRepository) PurgeInactive(activeList model.Albums) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (r *albumRepository) PurgeEmpty() error {
|
||||
o := Db()
|
||||
_, err := o.Raw("delete from album where id not in (select distinct(album_id) from media_file)").Exec()
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *albumRepository) GetStarred(options ...model.QueryOptions) (model.Albums, error) {
|
||||
var starred []album
|
||||
_, err := r.newQuery(Db(), options...).Filter("starred", true).All(&starred)
|
||||
|
||||
@@ -160,6 +160,12 @@ func (r *artistRepository) PurgeInactive(activeList model.Artists) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (r *artistRepository) PurgeEmpty() error {
|
||||
o := Db()
|
||||
_, err := o.Raw("delete from artist where id not in (select distinct(artist_id) from album)").Exec()
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *artistRepository) Search(q string, offset int, size int) (model.Artists, error) {
|
||||
if len(q) <= 2 {
|
||||
return nil, nil
|
||||
|
||||
Reference in New Issue
Block a user