()
| 96 | } |
| 97 | |
| 98 | func (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 | |
| 119 | func (c *Emby) RefreshLibrary() error { |
| 120 | reqParam := fmt.Sprintf("/emby/Items/%s/Refresh?Recursive=True&MetadataRefreshMode=FullRefresh", c.LibraryID) |
nothing calls this directly
no test coverage detected