mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-08 19:17:53 +08:00
feat: remove sperate movie page and add default storage
This commit is contained in:
17
db/db.go
17
db/db.go
@@ -43,6 +43,7 @@ func Open() (*Client, error) {
|
||||
}
|
||||
|
||||
c.generateJwtSerectIfNotExist()
|
||||
c.generateDefaultLocalStorage()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
@@ -55,6 +56,22 @@ func (c *Client) generateJwtSerectIfNotExist() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) generateDefaultLocalStorage() {
|
||||
n, _ := c.ent.Storage.Query().Count(context.TODO())
|
||||
if n != 0 {
|
||||
return
|
||||
}
|
||||
c.AddStorage(&StorageInfo{
|
||||
Name: "local",
|
||||
Implementation: "local",
|
||||
Default: true,
|
||||
Settings: map[string]string{
|
||||
"tv_path": "/data/tv",
|
||||
"movie_path": "/data/movies",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Client) GetSetting(key string) string {
|
||||
v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user