189 lines
8.1 KiB
Go
189 lines
8.1 KiB
Go
package subsonic
|
|
|
|
// --- Filesystem-style browsing: getIndexes / getMusicDirectory ---
|
|
|
|
type Indexes struct {
|
|
LastModified int64 `xml:"lastModified,attr" json:"lastModified"`
|
|
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
|
|
Shortcut []Artist `xml:"shortcut,omitempty" json:"shortcut,omitempty"`
|
|
Index []Index `xml:"index" json:"index"`
|
|
Child []Child `xml:"child,omitempty" json:"child,omitempty"` // top-level files not under any letter index
|
|
}
|
|
|
|
type Index struct {
|
|
Name string `xml:"name,attr" json:"name"`
|
|
Artist []Artist `xml:"artist" json:"artist"`
|
|
}
|
|
|
|
// Artist is the filesystem-style artist entry (a "directory" one level
|
|
// below a music folder root), distinct from the ID3 ArtistID3 below.
|
|
type Artist struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Name string `xml:"name,attr" json:"name"`
|
|
}
|
|
|
|
type Directory struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`
|
|
Name string `xml:"name,attr" json:"name"`
|
|
starred // embedded for the optional "starred" attr, see model.go helper types
|
|
Child []Child `xml:"child" json:"child"`
|
|
}
|
|
|
|
// Child represents both a directory entry and a song/video — the single
|
|
// polymorphic element type Subsonic uses throughout getMusicDirectory,
|
|
// search results, playlists, and album contents.
|
|
type Child struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`
|
|
IsDir bool `xml:"isDir,attr" json:"isDir"`
|
|
Title string `xml:"title,attr" json:"title"`
|
|
Album string `xml:"album,attr,omitempty" json:"album,omitempty"`
|
|
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
|
Track int `xml:"track,attr,omitempty" json:"track,omitempty"`
|
|
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
|
Size int64 `xml:"size,attr,omitempty" json:"size,omitempty"`
|
|
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
|
|
Suffix string `xml:"suffix,attr,omitempty" json:"suffix,omitempty"`
|
|
TranscodedContentType string `xml:"transcodedContentType,attr,omitempty" json:"transcodedContentType,omitempty"`
|
|
TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"`
|
|
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
|
BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
|
|
Path string `xml:"path,attr,omitempty" json:"path,omitempty"`
|
|
IsVideo bool `xml:"isVideo,attr,omitempty" json:"isVideo,omitempty"`
|
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
|
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
|
|
DiscNumber int `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"`
|
|
Created string `xml:"created,attr,omitempty" json:"created,omitempty"`
|
|
Starred string `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
|
AlbumID string `xml:"albumId,attr,omitempty" json:"albumId,omitempty"`
|
|
ArtistID string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
|
Type string `xml:"type,attr,omitempty" json:"type,omitempty"`
|
|
BookmarkPosition int64 `xml:"bookmarkPosition,attr,omitempty" json:"bookmarkPosition,omitempty"`
|
|
}
|
|
|
|
type Songs struct {
|
|
Song []Child `xml:"song" json:"song"`
|
|
}
|
|
|
|
// starred is embedded into structs that carry an optional "starred"
|
|
// timestamp attribute (Directory, AlbumID3, ArtistID3, ...).
|
|
type starred struct {
|
|
Starred string `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
|
}
|
|
|
|
// --- ID3/tag-style browsing: getArtists / getArtist / getAlbum / getSong ---
|
|
|
|
type ArtistsID3 struct {
|
|
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
|
|
Index []IndexID3 `xml:"index" json:"index"`
|
|
}
|
|
|
|
type IndexID3 struct {
|
|
Name string `xml:"name,attr" json:"name"`
|
|
Artist []ArtistID3 `xml:"artist" json:"artist"`
|
|
}
|
|
|
|
type ArtistID3 struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Name string `xml:"name,attr" json:"name"`
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
|
AlbumCount int `xml:"albumCount,attr" json:"albumCount"`
|
|
starred
|
|
}
|
|
|
|
type ArtistWithAlbumsID3 struct {
|
|
ArtistID3
|
|
Album []AlbumID3 `xml:"album,omitempty" json:"album,omitempty"`
|
|
}
|
|
|
|
type AlbumID3 struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Name string `xml:"name,attr" json:"name"`
|
|
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
|
ArtistID string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
|
SongCount int `xml:"songCount,attr" json:"songCount"`
|
|
Duration int `xml:"duration,attr" json:"duration"`
|
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
|
|
Created string `xml:"created,attr" json:"created"`
|
|
starred
|
|
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
|
}
|
|
|
|
type AlbumWithSongsID3 struct {
|
|
AlbumID3
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
}
|
|
|
|
// --- Artist/album info (last.fm-style metadata; VibeSonic has no
|
|
// external metadata provider in Phase 2, so these return locally-known
|
|
// data only: biography/images are empty, similar artists are omitted) ---
|
|
|
|
type ArtistInfoBase struct {
|
|
Biography string `xml:"biography,omitempty" json:"biography,omitempty"`
|
|
MusicBrainzID string `xml:"musicBrainzId,omitempty" json:"musicBrainzId,omitempty"`
|
|
LastFmURL string `xml:"lastFmUrl,omitempty" json:"lastFmUrl,omitempty"`
|
|
SmallImageURL string `xml:"smallImageUrl,omitempty" json:"smallImageUrl,omitempty"`
|
|
MediumImageURL string `xml:"mediumImageUrl,omitempty" json:"mediumImageUrl,omitempty"`
|
|
LargeImageURL string `xml:"largeImageUrl,omitempty" json:"largeImageUrl,omitempty"`
|
|
}
|
|
|
|
type ArtistInfo struct {
|
|
ArtistInfoBase
|
|
SimilarArtist []Artist `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"`
|
|
}
|
|
|
|
type ArtistInfo2 struct {
|
|
ArtistInfoBase
|
|
SimilarArtist []ArtistID3 `xml:"similarArtist,omitempty" json:"similarArtist,omitempty"`
|
|
}
|
|
|
|
type AlbumInfo struct {
|
|
Notes string `xml:"notes,omitempty" json:"notes,omitempty"`
|
|
MusicBrainzID string `xml:"musicBrainzId,omitempty" json:"musicBrainzId,omitempty"`
|
|
LastFmURL string `xml:"lastFmUrl,omitempty" json:"lastFmUrl,omitempty"`
|
|
SmallImageURL string `xml:"smallImageUrl,omitempty" json:"smallImageUrl,omitempty"`
|
|
MediumImageURL string `xml:"mediumImageUrl,omitempty" json:"mediumImageUrl,omitempty"`
|
|
LargeImageURL string `xml:"largeImageUrl,omitempty" json:"largeImageUrl,omitempty"`
|
|
}
|
|
|
|
type SimilarSongs struct {
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
}
|
|
|
|
type SimilarSongs2 struct {
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
}
|
|
|
|
type TopSongs struct {
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
}
|
|
|
|
// --- Video ---
|
|
|
|
type Videos struct {
|
|
Video []Child `xml:"video,omitempty" json:"video,omitempty"`
|
|
}
|
|
|
|
type VideoInfo struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
AudioTrack []AudioTrack `xml:"audioTrack,omitempty" json:"audioTrack,omitempty"`
|
|
Captions []Captions `xml:"captions,omitempty" json:"captions,omitempty"`
|
|
}
|
|
|
|
type AudioTrack struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
|
|
LanguageCode string `xml:"languageCode,attr,omitempty" json:"languageCode,omitempty"`
|
|
}
|
|
|
|
type Captions struct {
|
|
ID string `xml:"id,attr" json:"id"`
|
|
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
|
|
}
|