2020-03-29 11:29:02 +02:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2020-05-30 01:41:47 +02:00
|
|
|
"github.com/allegro/bigcache"
|
2020-04-05 22:26:53 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/classify"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
2020-05-30 01:41:47 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/event"
|
2020-04-05 22:26:53 +02:00
|
|
|
"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"
|
2020-03-29 11:29:02 +02:00
|
|
|
)
|
|
|
|
|
2020-05-30 01:41:47 +02:00
|
|
|
var log = event.Log
|
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 {
|
2020-05-30 01:41:47 +02:00
|
|
|
Cache *bigcache.BigCache
|
2020-05-01 09:57:38 +02:00
|
|
|
Classify *classify.TensorFlow
|
|
|
|
Convert *photoprism.Convert
|
2020-11-15 15:15:56 +01:00
|
|
|
Files *photoprism.Files
|
2020-12-04 19:51:51 +01:00
|
|
|
Photos *photoprism.Photos
|
2020-04-05 22:26:53 +02:00
|
|
|
Import *photoprism.Import
|
|
|
|
Index *photoprism.Index
|
2020-05-29 18:04:30 +02:00
|
|
|
Moments *photoprism.Moments
|
2020-05-07 19:42:04 +02:00
|
|
|
Purge *photoprism.Purge
|
2020-04-05 22:26:53 +02:00
|
|
|
Nsfw *nsfw.Detector
|
2020-05-01 09:57:38 +02:00
|
|
|
Query *query.Query
|
2020-04-05 22:26:53 +02:00
|
|
|
Resample *photoprism.Resample
|
2020-04-20 13:50:28 +02:00
|
|
|
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
|
|
|
}
|