MCPcopy Create free account
hub / github.com/LumePart/Explo / AddLibrary

Method AddLibrary

src/client/emby.go:98–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96}
97
98func (c *Emby) AddLibrary() error {
99 reqParam := "/emby/Library/VirtualFolders"
100
101 payload := fmt.Appendf(nil, `{
102 "Name": "%s",
103 "CollectionType": "Music",
104 "RefreshLibrary": true,
105 "Paths": "%s"
106 "LibraryOptions": {
107 "Enabled": true,
108 "EnableRealtimeMonitor": true,
109 "EnableLUFSScan": false
110 }
111 }`, c.Cfg.LibraryName, c.Cfg.DownloadDir)
112
113 if _, err := c.HttpClient.MakeRequest("POST", c.Cfg.URL+reqParam, bytes.NewReader(payload), c.Cfg.Creds.Headers); err != nil {
114 return fmt.Errorf("failed to add library to Emby using the download path, please define a library name using LIBRARY_NAME in .env: %s", err.Error())
115 }
116 return nil
117}
118
119func (c *Emby) RefreshLibrary() error {
120 reqParam := fmt.Sprintf("/emby/Items/%s/Refresh?Recursive=True&MetadataRefreshMode=FullRefresh", c.LibraryID)

Callers

nothing calls this directly

Calls 1

MakeRequestMethod · 0.80

Tested by

no test coverage detected