Store MusicFolder as a library in DB
This commit is contained in:
@@ -16,6 +16,10 @@ import (
|
||||
|
||||
func initialSetup(ds model.DataStore) {
|
||||
_ = ds.WithTx(func(tx model.DataStore) error {
|
||||
if err := createOrUpdateMusicFolder(ds); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
properties := ds.Property(context.TODO())
|
||||
_, err := properties.Get(consts.InitialSetupFlagKey)
|
||||
if err == nil {
|
||||
@@ -112,3 +116,12 @@ func checkExternalCredentials() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createOrUpdateMusicFolder(ds model.DataStore) error {
|
||||
lib := model.Library{ID: 1, Name: "Music Library", Path: conf.Server.MusicFolder}
|
||||
err := ds.Library(context.TODO()).Put(&lib)
|
||||
if err != nil {
|
||||
log.Error("Could not access Library table", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user