feat: remove sperate movie page and add default storage

This commit is contained in:
Simon Ding
2024-07-17 17:45:51 +08:00
parent 0cd4a66f63
commit 64ce976ce7
7 changed files with 57 additions and 75 deletions

View File

@@ -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 {