1package responses 2 3import ( 4 "encoding/xml" 5 "time" 6) 7 8type Subsonic struct { 9 XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response" json:"-"` 10 Status string `xml:"status,attr" json:"status"` 11 Version string `xml:"version,attr" json:"version"` 12 Type string `xml:"type,attr" json:"type"` 13 ServerVersion string `xml:"serverVersion,attr" json:"serverVersion"` 14 Error *Error `xml:"error,omitempty" json:"error,omitempty"` 15 License *License `xml:"license,omitempty" json:"license,omitempty"` 16 MusicFolders *MusicFolders `xml:"musicFolders,omitempty" json:"musicFolders,omitempty"` 17 Indexes *Indexes `xml:"indexes,omitempty" json:"indexes,omitempty"` 18 Directory *Directory `xml:"directory,omitempty" json:"directory,omitempty"` 19 User *User `xml:"user,omitempty" json:"user,omitempty"` 20 Users *Users `xml:"users,omitempty" json:"users,omitempty"` 21 AlbumList *AlbumList `xml:"albumList,omitempty" json:"albumList,omitempty"` 22 AlbumList2 *AlbumList `xml:"albumList2,omitempty" json:"albumList2,omitempty"` 23 Playlists *Playlists `xml:"playlists,omitempty" json:"playlists,omitempty"` 24 Playlist *PlaylistWithSongs `xml:"playlist,omitempty" json:"playlist,omitempty"` 25 SearchResult2 *SearchResult2 `xml:"searchResult2,omitempty" json:"searchResult2,omitempty"` 26 SearchResult3 *SearchResult3 `xml:"searchResult3,omitempty" json:"searchResult3,omitempty"` 27 Starred *Starred `xml:"starred,omitempty" json:"starred,omitempty"` 28 Starred2 *Starred `xml:"starred2,omitempty" json:"starred2,omitempty"` 29 NowPlaying *NowPlaying `xml:"nowPlaying,omitempty" json:"nowPlaying,omitempty"` 30 Song *Child `xml:"song,omitempty" json:"song,omitempty"` 31 RandomSongs *Songs `xml:"randomSongs,omitempty" json:"randomSongs,omitempty"` 32 SongsByGenre *Songs `xml:"songsByGenre,omitempty" json:"songsByGenre,omitempty"` 33 Genres *Genres `xml:"genres,omitempty" json:"genres,omitempty"` 34 35 // ID3 36 Artist *Indexes `xml:"artists,omitempty" json:"artists,omitempty"` 37 ArtistWithAlbumsID3 *ArtistWithAlbumsID3 `xml:"artist,omitempty" json:"artist,omitempty"` 38 AlbumWithSongsID3 *AlbumWithSongsID3 `xml:"album,omitempty" json:"album,omitempty"` 39 40 ArtistInfo *ArtistInfo `xml:"artistInfo,omitempty" json:"artistInfo,omitempty"` 41 ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"` 42 SimilarSongs *SimilarSongs `xml:"similarSongs,omitempty" json:"similarSongs,omitempty"` 43 SimilarSongs2 *SimilarSongs2 `xml:"similarSongs2,omitempty" json:"similarSongs2,omitempty"` 44 TopSongs *TopSongs `xml:"topSongs,omitempty" json:"topSongs,omitempty"` 45 46 PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"` 47 Bookmarks *Bookmarks `xml:"bookmarks,omitempty" json:"bookmarks,omitempty"` 48 ScanStatus *ScanStatus `xml:"scanStatus,omitempty" json:"scanStatus,omitempty"` 49} 50 51type JsonWrapper struct { 52 Subsonic Subsonic `json:"subsonic-response"` 53} 54 55type Error struct { 56 Code int `xml:"code,attr" json:"code"` 57 Message string `xml:"message,attr" json:"message"` 58} 59 60type License struct { 61 Valid bool `xml:"valid,attr" json:"valid"` 62} 63 64type MusicFolder struct { 65 Id int32 `xml:"id,attr" json:"id"` 66 Name string `xml:"name,attr" json:"name"` 67} 68 69type MusicFolders struct { 70 Folders []MusicFolder `xml:"musicFolder" json:"musicFolder,omitempty"` 71} 72 73type Artist struct { 74 Id string `xml:"id,attr" json:"id"` 75 Name string `xml:"name,attr" json:"name"` 76 AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"` 77 Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` 78 UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"` 79 ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"` 80 /* 81 <xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 --> 82 */ 83} 84 85type Index struct { 86 Name string `xml:"name,attr" json:"name"` 87 Artists []Artist `xml:"artist" json:"artist"` 88} 89 90type Indexes struct { 91 Index []Index `xml:"index" json:"index,omitempty"` 92 LastModified int64 `xml:"lastModified,attr" json:"lastModified"` 93 IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"` 94} 95 96type Child struct { 97 Id string `xml:"id,attr" json:"id"` 98 Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"` 99 IsDir bool `xml:"isDir,attr" json:"isDir"` 100 Title string `xml:"title,attr,omitempty" json:"title,omitempty"` 101 Name string `xml:"name,attr,omitempty" json:"name,omitempty"` 102 Album string `xml:"album,attr,omitempty" json:"album,omitempty"` 103 Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"` 104 Track int `xml:"track,attr,omitempty" json:"track,omitempty"` 105 Year int `xml:"year,attr,omitempty" json:"year,omitempty"` 106 Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` 107 CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` 108 Size int64 `xml:"size,attr,omitempty" json:"size,omitempty"` 109 ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"` 110 Suffix string `xml:"suffix,attr,omitempty" json:"suffix,omitempty"` 111 Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` 112 TranscodedContentType string `xml:"transcodedContentType,attr,omitempty" json:"transcodedContentType,omitempty"` 113 TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"` 114 Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` 115 BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"` 116 Path string `xml:"path,attr,omitempty" json:"path,omitempty"` 117 PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"` 118 DiscNumber int `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"` 119 Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` 120 AlbumId string `xml:"albumId,attr,omitempty" json:"albumId,omitempty"` 121 ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` 122 Type string `xml:"type,attr,omitempty" json:"type,omitempty"` 123 UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"` 124 SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"` 125 IsVideo bool `xml:"isVideo,attr" json:"isVideo"` 126 BookmarkPosition int64 `xml:"bookmarkPosition,attr,omitempty" json:"bookmarkPosition,omitempty"` 127 /* 128 <xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.6.0 --> 129 */ 130} 131 132type Songs struct { 133 Songs []Child `xml:"song" json:"song,omitempty"` 134} 135 136type Directory struct { 137 Child []Child `xml:"child" json:"child,omitempty"` 138 Id string `xml:"id,attr" json:"id"` 139 Name string `xml:"name,attr" json:"name"` 140 Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"` 141 Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` 142 PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"` 143 UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"` 144 145 // ID3 146 Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"` 147 ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` 148 CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` 149 SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"` 150 AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"` 151 Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` 152 Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` 153 Year int `xml:"year,attr,omitempty" json:"year,omitempty"` 154 Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` 155 156 /* 157 <xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 --> 158 */ 159} 160 161type ArtistID3 struct { 162 Id string `xml:"id,attr" json:"id"` 163 Name string `xml:"name,attr" json:"name"` 164 CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` 165 AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"` 166 Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` 167 ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"` 168} 169 170type AlbumID3 struct { 171 Id string `xml:"id,attr" json:"id"` 172 Name string `xml:"name,attr" json:"name"` 173 Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"` 174 ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` 175 CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` 176 SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"` 177 Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` 178 PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"` 179 Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` 180 Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"` 181 Year int `xml:"year,attr,omitempty" json:"year,omitempty"` 182 Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` 183} 184 185type ArtistWithAlbumsID3 struct { 186 ArtistID3 187 Album []Child `xml:"album" json:"album,omitempty"` 188} 189 190type AlbumWithSongsID3 struct { 191 AlbumID3 192 Song []Child `xml:"song" json:"song,omitempty"` 193} 194 195type AlbumList struct { 196 Album []Child `xml:"album" json:"album,omitempty"` 197} 198 199type Playlist struct { 200 Id string `xml:"id,attr" json:"id"` 201 Name string `xml:"name,attr" json:"name"` 202 Comment string `xml:"comment,attr,omitempty" json:"comment,omitempty"` 203 SongCount int `xml:"songCount,attr" json:"songCount"` 204 Duration int `xml:"duration,attr" json:"duration"` 205 Public bool `xml:"public,attr" json:"public"` 206 Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"` 207 Created time.Time `xml:"created,attr" json:"created"` 208 Changed time.Time `xml:"changed,attr" json:"changed"` 209 /* 210 <xs:sequence> 211 <xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0--> 212 </xs:sequence> 213 <xs:attribute name="coverArt" type="xs:string" use="optional"/> <!--Added in 1.11.0--> 214 */ 215} 216 217type Playlists struct { 218 Playlist []Playlist `xml:"playlist" json:"playlist,omitempty"` 219} 220 221type PlaylistWithSongs struct { 222 Playlist 223 Entry []Child `xml:"entry" json:"entry,omitempty"` 224} 225 226type SearchResult2 struct { 227 Artist []Artist `xml:"artist" json:"artist,omitempty"` 228 Album []Child `xml:"album" json:"album,omitempty"` 229 Song []Child `xml:"song" json:"song,omitempty"` 230} 231 232type SearchResult3 struct { 233 Artist []ArtistID3 `xml:"artist" json:"artist,omitempty"` 234 Album []Child `xml:"album" json:"album,omitempty"` 235 Song []Child `xml:"song" json:"song,omitempty"` 236} 237 238type Starred struct { 239 Artist []Artist `xml:"artist" json:"artist,omitempty"` 240 Album []Child `xml:"album" json:"album,omitempty"` 241 Song []Child `xml:"song" json:"song,omitempty"` 242} 243 244type NowPlayingEntry struct { 245 Child 246 UserName string `xml:"username,attr" json:"username,omitempty"` 247 MinutesAgo int `xml:"minutesAgo,attr" json:"minutesAgo,omitempty"` 248 PlayerId int `xml:"playerId,attr" json:"playerId,omitempty"` 249 PlayerName string `xml:"playerName,attr" json:"playerName,omitempty"` 250} 251 252type NowPlaying struct { 253 Entry []NowPlayingEntry `xml:"entry" json:"entry,omitempty"` 254} 255 256type User struct { 257 Username string `xml:"username,attr" json:"username"` 258 Email string `xml:"email,attr,omitempty" json:"email,omitempty"` 259 ScrobblingEnabled bool `xml:"scrobblingEnabled,attr" json:"scrobblingEnabled"` 260 MaxBitRate int `xml:"maxBitRate,attr,omitempty" json:"maxBitRate,omitempty"` 261 AdminRole bool `xml:"adminRole,attr" json:"adminRole"` 262 SettingsRole bool `xml:"settingsRole,attr" json:"settingsRole"` 263 DownloadRole bool `xml:"downloadRole,attr" json:"downloadRole"` 264 UploadRole bool `xml:"uploadRole,attr" json:"uploadRole"` 265 PlaylistRole bool `xml:"playlistRole,attr" json:"playlistRole"` 266 CoverArtRole bool `xml:"coverArtRole,attr" json:"coverArtRole"` 267 CommentRole bool `xml:"commentRole,attr" json:"commentRole"` 268 PodcastRole bool `xml:"podcastRole,attr" json:"podcastRole"` 269 StreamRole bool `xml:"streamRole,attr" json:"streamRole"` 270 JukeboxRole bool `xml:"jukeboxRole,attr" json:"jukeboxRole"` 271 ShareRole bool `xml:"shareRole,attr" json:"shareRole"` 272 VideoConversionRole bool `xml:"videoConversionRole,attr" json:"videoConversionRole"` 273 Folder []int `xml:"folder,omitempty" json:"folder,omitempty"` 274} 275 276type Users struct { 277 User []User `xml:"user" json:"user"` 278} 279 280type Genre struct { 281 Name string `xml:",chardata" json:"value,omitempty"` 282 SongCount int `xml:"songCount,attr" json:"songCount"` 283 AlbumCount int `xml:"albumCount,attr" json:"albumCount"` 284} 285 286type Genres struct { 287 Genre []Genre `xml:"genre,omitempty" json:"genre,omitempty"` 288} 289 290type ArtistInfoBase struct { 291 Biography string `xml:"biography,omitempty" json:"biography,omitempty"` 292 MusicBrainzID string `xml:"musicBrainzId,omitempty" json:"musicBrainzId,omitempty"` 293 LastFmUrl string `xml:"lastFmUrl,omitempty" json:"lastFmUrl,omitempty"` 294 SmallImageUrl string `xml:"smallImageUrl,omitempty" json:"smallImageUrl,omitempty"` 295 MediumImageUrl string `xml:"mediumImageUrl,omitempty" json:"mediumImageUrl,omitempty"` 296 LargeImageUrl string `xml:"largeImageUrl,omitempty" json:"largeImageUrl,omitempty"` 297} 298 299type ArtistInfo struct { 300 ArtistInfoBase 301 SimilarArtist []Artist `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"` 302} 303 304type ArtistInfo2 struct { 305 ArtistInfoBase 306 SimilarArtist []ArtistID3 `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"` 307} 308 309type SimilarSongs struct { 310 Song []Child `xml:"song,omitempty" json:"song,omitempty"` 311} 312 313type SimilarSongs2 struct { 314 Song []Child `xml:"song,omitempty" json:"song,omitempty"` 315} 316 317type TopSongs struct { 318 Song []Child `xml:"song,omitempty" json:"song,omitempty"` 319} 320 321type PlayQueue struct { 322 Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"` 323 Current string `xml:"current,attr,omitempty" json:"current,omitempty"` 324 Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"` 325 Username string `xml:"username,attr" json:"username"` 326 Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"` 327 ChangedBy string `xml:"changedBy,attr" json:"changedBy"` 328} 329 330type Bookmark struct { 331 Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"` 332 Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"` 333 Username string `xml:"username,attr" json:"username"` 334 Comment string `xml:"comment,attr" json:"comment"` 335 Created time.Time `xml:"created,attr" json:"created"` 336 Changed time.Time `xml:"changed,attr" json:"changed"` 337} 338 339type Bookmarks struct { 340 Bookmark []Bookmark `xml:"bookmark,omitempty" json:"bookmark,omitempty"` 341} 342 343type ScanStatus struct { 344 Scanning bool `xml:"scanning,attr" json:"scanning"` 345 Count int64 `xml:"count,attr" json:"count"` 346 FolderCount int64 `xml:"folderCount,attr" json:"folderCount"` 347 LastScan *time.Time `xml:"lastScan,attr,omitempty" json:"lastScan,omitempty"` 348} 349