mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add plugin tasks (#651)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
"github.com/stashapp/stash/pkg/manager/config"
|
||||
"github.com/stashapp/stash/pkg/manager/paths"
|
||||
"github.com/stashapp/stash/pkg/plugin"
|
||||
"github.com/stashapp/stash/pkg/scraper"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
@@ -22,6 +23,7 @@ type singleton struct {
|
||||
FFMPEGPath string
|
||||
FFProbePath string
|
||||
|
||||
PluginCache *plugin.Cache
|
||||
ScraperCache *scraper.Cache
|
||||
}
|
||||
|
||||
@@ -51,6 +53,7 @@ func Initialize() *singleton {
|
||||
Paths: paths.NewPaths(),
|
||||
JSON: &jsonUtils{},
|
||||
|
||||
PluginCache: initPluginCache(),
|
||||
ScraperCache: initScraperCache(),
|
||||
}
|
||||
|
||||
@@ -88,8 +91,9 @@ func initConfig() {
|
||||
// Set generated to the metadata path for backwards compat
|
||||
viper.SetDefault(config.Generated, viper.GetString(config.Metadata))
|
||||
|
||||
// Set default scrapers path
|
||||
// Set default scrapers and plugins paths
|
||||
viper.SetDefault(config.ScrapersPath, config.GetDefaultScrapersPath())
|
||||
viper.SetDefault(config.PluginsPath, config.GetDefaultPluginsPath())
|
||||
|
||||
// Disabling config watching due to race condition issue
|
||||
// See: https://github.com/spf13/viper/issues/174
|
||||
@@ -153,6 +157,16 @@ func initLog() {
|
||||
logger.Init(config.GetLogFile(), config.GetLogOut(), config.GetLogLevel())
|
||||
}
|
||||
|
||||
func initPluginCache() *plugin.Cache {
|
||||
ret, err := plugin.NewCache(config.GetPluginsPath())
|
||||
|
||||
if err != nil {
|
||||
logger.Errorf("Error reading plugin configs: %s", err.Error())
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// initScraperCache initializes a new scraper cache and returns it.
|
||||
func initScraperCache() *scraper.Cache {
|
||||
scraperConfig := scraper.GlobalConfig{
|
||||
|
||||
Reference in New Issue
Block a user