🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Task for continuously check for iTunes Library updates
Deluan329297dab81c
diff --git a/scanner/importer.go b/scanner/importer.goindex 739e21bb1..5a8962391 100644--- a/scanner/importer.go+++ b/scanner/importer.go@@ -26,12 +26,13 @@ type Scanner interface {type tempIndex map[string]domain.ArtistInfovar (- inProgress = make(chan int)- lastUpdated time.Time+ inProgress chan int+ lastCheck time.TimeitunesLibrary string)func init() {+ inProgress = make(chan int)startImport()}@@ -39,7 +40,7 @@ func CheckForUpdates(force bool) {<-inProgressif force {- lastUpdated = time.Time{}+ lastCheck = time.Time{}}startImport()@@ -55,11 +56,11 @@ func startImport() {beego.Error(err)return}- if lastUpdated.After(info.ModTime()) {+ if lastCheck.After(info.ModTime()) {inProgress <- 1return}- lastUpdated = time.Now()+ lastCheck = time.Now()// TODO Move all to DIi := &Importer{mediaFolder: beego.AppConfig.String("musicFolder")}diff --git a/tasks/scan.go b/tasks/scan.goindex cdae7d3d5..5cadf387f 100644--- a/tasks/scan.go+++ b/tasks/scan.go@@ -1,6 +1,9 @@package tasksimport (+ "time"++ "github.com/astaxie/beego""github.com/astaxie/beego/toolbox""github.com/deluan/gosonic/scanner")@@ -14,6 +17,9 @@ func init() {})toolbox.AddTask(TaskItunesScan, scan)- toolbox.StartTask()- defer toolbox.DeleteTask(TaskItunesScan)+ go func() {+ time.Sleep(20 * time.Second)+ beego.Debug("Starting", TaskItunesScan)+ toolbox.StartTask()+ }()}