2022-04-25 10:45:09 +02:00
|
|
|
/*
|
|
|
|
Package service provides a registry for common services.
|
|
|
|
|
|
|
|
Copyright (c) 2018 - 2022 PhotoPrism UG. All rights reserved.
|
|
|
|
|
2022-08-10 16:09:21 +02:00
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
|
|
|
|
<https://docs.photoprism.app/license/agpl>
|
2022-04-25 10:45:09 +02:00
|
|
|
|
2022-08-10 16:09:21 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
2022-04-25 10:45:09 +02:00
|
|
|
|
2022-08-10 16:09:21 +02:00
|
|
|
The AGPL is supplemented by our Trademark and Brand Guidelines,
|
|
|
|
which describe how our Brand Assets may be used:
|
|
|
|
<https://photoprism.app/trademark>
|
2022-04-25 10:45:09 +02:00
|
|
|
|
|
|
|
Feel free to send an email to hello@photoprism.app if you have questions,
|
|
|
|
want to support our work, or just want to say hello.
|
|
|
|
|
|
|
|
Additional information can be found in our Developer Guide:
|
|
|
|
<https://docs.photoprism.app/developer-guide/>
|
|
|
|
*/
|
2022-10-15 21:54:11 +02:00
|
|
|
package get
|
2020-03-29 11:29:02 +02:00
|
|
|
|
|
|
|
import (
|
2020-04-05 22:26:53 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/classify"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
2021-07-16 14:34:05 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/face"
|
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"
|
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
|
2021-08-13 20:04:59 +02:00
|
|
|
Faces *photoprism.Faces
|
2021-11-12 05:09:17 +01:00
|
|
|
Places *photoprism.Places
|
2021-01-08 13:29:01 +01:00
|
|
|
Purge *photoprism.Purge
|
2021-01-24 17:46:18 +01:00
|
|
|
CleanUp *photoprism.CleanUp
|
2021-01-08 13:29:01 +01:00
|
|
|
Nsfw *nsfw.Detector
|
2021-07-16 14:34:05 +02:00
|
|
|
FaceNet *face.Net
|
2021-01-08 13:29:01 +01:00
|
|
|
Query *query.Query
|
2022-08-31 18:53:04 +02:00
|
|
|
Thumbs *photoprism.Thumbs
|
2021-01-08 13:29:01 +01: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
|
|
|
}
|