2020-03-29 11:29:02 +02:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2020-04-05 22:26:53 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/classify"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
"github.com/photoprism/photoprism/internal/nsfw"
|
|
|
|
"github.com/photoprism/photoprism/internal/photoprism"
|
2020-04-30 20:07:03 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/query"
|
2020-04-20 13:50:28 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/session"
|
2021-01-08 12:20:41 +01:00
|
|
|
|
|
|
|
gc "github.com/patrickmn/go-cache"
|
2020-03-29 11:29:02 +02:00
|
|
|
)
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
var conf *config.Config
|
2020-03-29 11:29:02 +02:00
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
var services struct {
|
2021-01-08 13:29:01 +01:00
|
|
|
FolderCache *gc.Cache
|
|
|
|
CoverCache *gc.Cache
|
|
|
|
ThumbCache *gc.Cache
|
|
|
|
Classify *classify.TensorFlow
|
|
|
|
Convert *photoprism.Convert
|
|
|
|
Files *photoprism.Files
|
|
|
|
Photos *photoprism.Photos
|
|
|
|
Import *photoprism.Import
|
|
|
|
Index *photoprism.Index
|
|
|
|
Moments *photoprism.Moments
|
|
|
|
Purge *photoprism.Purge
|
|
|
|
Nsfw *nsfw.Detector
|
|
|
|
Query *query.Query
|
|
|
|
Resample *photoprism.Resample
|
|
|
|
Session *session.Session
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-06 22:27:05 +02:00
|
|
|
func SetConfig(c *config.Config) {
|
2020-04-05 22:26:53 +02:00
|
|
|
if c == nil {
|
|
|
|
panic("config is nil")
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
conf = c
|
2020-06-07 10:09:35 +02:00
|
|
|
|
|
|
|
photoprism.SetConfig(c)
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
func Config() *config.Config {
|
|
|
|
if conf == nil {
|
|
|
|
panic("config is nil")
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 22:26:53 +02:00
|
|
|
return conf
|
2020-03-29 11:29:02 +02:00
|
|
|
}
|