2016-03-02 17:11:46 +01:00
|
|
|
package responses
|
|
|
|
|
2016-03-03 21:41:24 +01:00
|
|
|
import (
|
2023-11-18 20:40:00 +01:00
|
|
|
"encoding/json"
|
2016-03-03 21:41:24 +01:00
|
|
|
"encoding/xml"
|
|
|
|
"time"
|
|
|
|
)
|
2016-03-02 17:11:46 +01:00
|
|
|
|
|
|
|
type Subsonic struct {
|
2016-03-11 06:37:07 +01:00
|
|
|
XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response" json:"-"`
|
|
|
|
Status string `xml:"status,attr" json:"status"`
|
|
|
|
Version string `xml:"version,attr" json:"version"`
|
2020-01-30 20:43:24 +01:00
|
|
|
Type string `xml:"type,attr" json:"type"`
|
|
|
|
ServerVersion string `xml:"serverVersion,attr" json:"serverVersion"`
|
2023-04-08 19:25:37 +02:00
|
|
|
OpenSubsonic bool `xml:"openSubsonic,attr,omitempty" json:"openSubsonic,omitempty"`
|
2016-03-11 06:37:07 +01:00
|
|
|
Error *Error `xml:"error,omitempty" json:"error,omitempty"`
|
|
|
|
License *License `xml:"license,omitempty" json:"license,omitempty"`
|
|
|
|
MusicFolders *MusicFolders `xml:"musicFolders,omitempty" json:"musicFolders,omitempty"`
|
|
|
|
Indexes *Indexes `xml:"indexes,omitempty" json:"indexes,omitempty"`
|
|
|
|
Directory *Directory `xml:"directory,omitempty" json:"directory,omitempty"`
|
|
|
|
User *User `xml:"user,omitempty" json:"user,omitempty"`
|
2020-10-27 23:19:56 +01:00
|
|
|
Users *Users `xml:"users,omitempty" json:"users,omitempty"`
|
2016-03-11 06:37:07 +01:00
|
|
|
AlbumList *AlbumList `xml:"albumList,omitempty" json:"albumList,omitempty"`
|
2016-03-28 05:04:05 +02:00
|
|
|
AlbumList2 *AlbumList `xml:"albumList2,omitempty" json:"albumList2,omitempty"`
|
2016-03-11 06:37:07 +01:00
|
|
|
Playlists *Playlists `xml:"playlists,omitempty" json:"playlists,omitempty"`
|
|
|
|
Playlist *PlaylistWithSongs `xml:"playlist,omitempty" json:"playlist,omitempty"`
|
2016-03-17 14:34:32 +01:00
|
|
|
SearchResult2 *SearchResult2 `xml:"searchResult2,omitempty" json:"searchResult2,omitempty"`
|
2016-03-28 16:01:43 +02:00
|
|
|
SearchResult3 *SearchResult3 `xml:"searchResult3,omitempty" json:"searchResult3,omitempty"`
|
2016-03-17 14:34:32 +01:00
|
|
|
Starred *Starred `xml:"starred,omitempty" json:"starred,omitempty"`
|
2016-03-28 15:46:16 +02:00
|
|
|
Starred2 *Starred `xml:"starred2,omitempty" json:"starred2,omitempty"`
|
2016-03-17 14:34:32 +01:00
|
|
|
NowPlaying *NowPlaying `xml:"nowPlaying,omitempty" json:"nowPlaying,omitempty"`
|
2016-03-25 05:04:22 +01:00
|
|
|
Song *Child `xml:"song,omitempty" json:"song,omitempty"`
|
2016-03-29 06:01:27 +02:00
|
|
|
RandomSongs *Songs `xml:"randomSongs,omitempty" json:"randomSongs,omitempty"`
|
2020-04-18 02:52:50 +02:00
|
|
|
SongsByGenre *Songs `xml:"songsByGenre,omitempty" json:"songsByGenre,omitempty"`
|
2020-01-15 23:49:09 +01:00
|
|
|
Genres *Genres `xml:"genres,omitempty" json:"genres,omitempty"`
|
2016-03-28 02:35:10 +02:00
|
|
|
|
|
|
|
// ID3
|
2016-03-28 03:27:45 +02:00
|
|
|
Artist *Indexes `xml:"artists,omitempty" json:"artists,omitempty"`
|
|
|
|
ArtistWithAlbumsID3 *ArtistWithAlbumsID3 `xml:"artist,omitempty" json:"artist,omitempty"`
|
2016-03-28 15:16:03 +02:00
|
|
|
AlbumWithSongsID3 *AlbumWithSongsID3 `xml:"album,omitempty" json:"album,omitempty"`
|
2020-02-10 01:42:37 +01:00
|
|
|
|
2023-01-18 02:22:54 +01:00
|
|
|
AlbumInfo *AlbumInfo `xml:"albumInfo,omitempty" json:"albumInfo,omitempty"`
|
2020-10-20 19:38:44 +02:00
|
|
|
ArtistInfo *ArtistInfo `xml:"artistInfo,omitempty" json:"artistInfo,omitempty"`
|
|
|
|
ArtistInfo2 *ArtistInfo2 `xml:"artistInfo2,omitempty" json:"artistInfo2,omitempty"`
|
|
|
|
SimilarSongs *SimilarSongs `xml:"similarSongs,omitempty" json:"similarSongs,omitempty"`
|
|
|
|
SimilarSongs2 *SimilarSongs2 `xml:"similarSongs2,omitempty" json:"similarSongs2,omitempty"`
|
|
|
|
TopSongs *TopSongs `xml:"topSongs,omitempty" json:"topSongs,omitempty"`
|
2020-07-31 18:36:33 +02:00
|
|
|
|
2020-10-26 02:48:21 +01:00
|
|
|
PlayQueue *PlayQueue `xml:"playQueue,omitempty" json:"playQueue,omitempty"`
|
2023-01-22 20:38:55 +01:00
|
|
|
Shares *Shares `xml:"shares,omitempty" json:"shares,omitempty"`
|
2020-10-26 02:48:21 +01:00
|
|
|
Bookmarks *Bookmarks `xml:"bookmarks,omitempty" json:"bookmarks,omitempty"`
|
|
|
|
ScanStatus *ScanStatus `xml:"scanStatus,omitempty" json:"scanStatus,omitempty"`
|
2021-10-19 22:33:06 +02:00
|
|
|
Lyrics *Lyrics `xml:"lyrics,omitempty" json:"lyrics,omitempty"`
|
2023-01-15 21:11:37 +01:00
|
|
|
|
Jukebox mode (#2289)
* Adding cache directory to ignore-list
* Adding jukebox-related config options
* Adding DevEnableJukebox config option pls. dummy server
* Adding types and routers
* Now without panic
* First draft on parsing the action
* Some cleanups
* Adding playback server
* Verify audio device configuration
* Adding debug-build target to have full symbol support
* Adding beep sound library pls some example code. Not working yet
* Play a fixed mp3 on any interface access for testing purposes
* Put action code into separate file, adding stringer, more debug output, prepare structs, validation
* Put action parameter parser code where it belongs
* Have a single Action transporting all information
* User fmt.Errorf for error-generation
* Adding wide playback interface
* Use action map for parsing, stringer instead switch stmt.
* Use but only one switch case and direct dispatch, refactoring
* Add error handling and pushing to client
* send decent errormessage, no internal server error
* Adding playback devices slice and load it from config
* Combine config-verification and structure init
* Return user-specific device
* Separate playback server from device
* Use dataStore to retrieve mediafile by id
* WIP: Playlist and start/stop handling. Doing start/stop the hard way as of now
* WIP: set, start and stop work on one single song. More to come
* Dont need to wait for the end
* Merge jukebox_action.go into jukebox.go
* Remove getParameterAsInt64(). Use existing requiredParamInt() instead
* Dont need to call newFailure() explicitly
* Remove int64, use int instead.
* Add and set action now accept multiple ids
* Kickout copy of childFromMediaFile(). It is not needed here.
* Refactoring devices and playbackServer
* Turn (internal) playback.DeviceStatus into subsonic JukeboxStatus when rendering output. Indexes int64 -> int
* Now we have a position and playing status
* Switching gain to float32, xs:float is defined as 32 bit. Fixing nasty copy/pointer bug
* Now with volume control
* Start working the queue
* Remove user from device interface
* Rename function GetDevice -> GetDeviceForUser to make intention clearer
* Have a nice stringer for the queue
* User Prepared boolean for now to allow pause/unpause
* Skipping works, but without offsets
* Make ChildFromMediaFile public to be used in jukebox get() implementation
* Return position in seconds and implement offset-skip in seconds
* Default offset to 0
* Adding a simple setGain implementation
* Prepare for transcoding AAC
* WIP: transcode to WAV to use beeps wav decoder. Not done yet.
* WIP: out of sheer desparation: convert to MP3 (which works) rather than WAV to troubleshoot issue.
* Use FLAC as intermediate format to play Apple AAC
* A bit of cleanup
* Catching the end-of-stream event for further reactions
* Have a trackSwitching goroutine waiting on channel when track ends
* Move decoder code into own file. Restructure code a bit
* Now with going on to play the next song in the playlist
* Adding shuffle feature
* Implementing remove action
* Cleanup code
* Remove templates for ffmpeg mp3 generation. Not needed anymore.
* Adding some documentation
* Check whether offset into track is in range. Fixing potential remove track bug. Documentation
* Make golangci-lint happy: handling return values
* Adding test suite and example dummy for playback package
* Adding some basic queue tests
* Only use Jukebox.Enabled config option
* Adding stream closing handling
* Pass context.Context to all PlaybackDevice methods
* Remove unneeded function
* Correct spelling
* Reduce visibility of ChildFromMediaFile
* Decomplicate action-parsing
* Adding simple tempfile-based AAC->FLAC transcoding. No parallel reading and writing yet.
* Try to optimize pipe-writing, tempfile-handling and reading. Not done yet.
* Do a synchronous copy of the tempfile. Racecondition detected
* More debugging statements and fixing the play/pause bug. More work needed
* Start the trackSwitcher() with each device once. Return JSON position even if its 0. More debug-output
* Moving all track-handling code into own module
* Fix typo. Do not pass ctx around when not applicable
* WIP: More refactoring, debugging output
* Fix nil pointer
* Repairing MP3 playback by pinning indirect dependencies: hajimehoshi/go-mp3 and hajimehoshi/oto
* Do not forget to cleanup after a skip action
* Make resync with master easy
* Adding missing mocks
* Adding missing error-handling found by linter
* Updating github.com/hajimehoshi/oto
* Removing duplicate function
* Move BEEP-related code into own package
* Juggle beep-related code around as preparation for interface access
* More refactoring for interface separation
* Gather CloseDevice() behind Track interface.
* Adding skeleton, draft audio-interface using mpv.io
* Adding majority of interface commands using messages to mpv socket.
* Adding end-of-stream handling
* MPV: start/stop are working
* postition is given in float in mpv
* Unify Close() and CloseDevice(). Using temp filename for controlling socket
* Wait until control-socket shows up. Cleanup socket in Close()
* Use canceable command. Rename to Executor
* Skipping tracks works now
* Now with actually setting the position
* Fix regain
* Add missing error-handling found by linter
* Adding retry mode on time-pos property getter
* Remove unneeded code on queue
* Putting build-tag beep onto beep files
* Remove deprecated call to rand.Seed()
"As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator."
* Using int32 to conform to Subsonic API spec
* Fix merge error
* Minor style changes
* Get username from context
---------
Co-authored-by: Deluan <deluan@navidrome.org>
2023-09-10 17:25:22 +02:00
|
|
|
InternetRadioStations *InternetRadioStations `xml:"internetRadioStations,omitempty" json:"internetRadioStations,omitempty"`
|
|
|
|
|
|
|
|
JukeboxStatus *JukeboxStatus `xml:"jukeboxStatus,omitempty" json:"jukeboxStatus,omitempty"`
|
|
|
|
JukeboxPlaylist *JukeboxPlaylist `xml:"jukeboxPlaylist,omitempty" json:"jukeboxPlaylist,omitempty"`
|
|
|
|
|
2023-04-08 19:25:37 +02:00
|
|
|
OpenSubsonicExtensions *OpenSubsonicExtensions `xml:"openSubsonicExtensions,omitempty" json:"openSubsonicExtensions,omitempty"`
|
2023-12-28 02:20:29 +01:00
|
|
|
LyricsList *LyricsList `xml:"lyricsList,omitempty" json:"lyricsList,omitempty"`
|
2016-03-02 23:23:26 +01:00
|
|
|
}
|
|
|
|
|
2024-02-17 16:39:29 +01:00
|
|
|
const (
|
|
|
|
StatusOK = "ok"
|
|
|
|
StatusFailed = "failed"
|
|
|
|
)
|
|
|
|
|
2016-03-02 23:23:26 +01:00
|
|
|
type JsonWrapper struct {
|
|
|
|
Subsonic Subsonic `json:"subsonic-response"`
|
2016-03-02 19:04:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Error struct {
|
2023-03-14 14:48:52 +01:00
|
|
|
Code int32 `xml:"code,attr" json:"code"`
|
2016-03-22 03:45:56 +01:00
|
|
|
Message string `xml:"message,attr" json:"message"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type License struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Valid bool `xml:"valid,attr" json:"valid"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type MusicFolder struct {
|
2020-05-10 03:00:38 +02:00
|
|
|
Id int32 `xml:"id,attr" json:"id"`
|
2016-03-22 03:45:56 +01:00
|
|
|
Name string `xml:"name,attr" json:"name"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type MusicFolders struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Folders []MusicFolder `xml:"musicFolder" json:"musicFolder,omitempty"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
2016-03-02 19:04:55 +01:00
|
|
|
type Artist struct {
|
2020-10-30 21:08:43 +01:00
|
|
|
Id string `xml:"id,attr" json:"id"`
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
2023-03-14 14:48:52 +01:00
|
|
|
AlbumCount int32 `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
|
2020-10-30 21:08:43 +01:00
|
|
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
UserRating int32 `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
2022-12-31 22:58:07 +01:00
|
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
2020-10-30 21:08:43 +01:00
|
|
|
ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"`
|
2022-12-31 02:14:03 +01:00
|
|
|
/* TODO:
|
|
|
|
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 -->
|
2016-03-11 16:03:33 +01:00
|
|
|
*/
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
2016-03-02 19:04:55 +01:00
|
|
|
type Index struct {
|
2016-03-02 19:18:39 +01:00
|
|
|
Name string `xml:"name,attr" json:"name"`
|
2016-03-03 00:44:13 +01:00
|
|
|
Artists []Artist `xml:"artist" json:"artist"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
|
|
|
|
2016-03-02 19:04:55 +01:00
|
|
|
type Indexes struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Index []Index `xml:"index" json:"index,omitempty"`
|
2020-05-10 03:00:38 +02:00
|
|
|
LastModified int64 `xml:"lastModified,attr" json:"lastModified"`
|
2016-03-22 03:45:56 +01:00
|
|
|
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
|
2016-03-02 17:11:46 +01:00
|
|
|
}
|
2016-03-03 00:44:13 +01:00
|
|
|
|
2023-11-29 03:12:28 +01:00
|
|
|
type MediaType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
MediaTypeSong MediaType = "song"
|
|
|
|
MediaTypeAlbum MediaType = "album"
|
|
|
|
MediaTypeArtist MediaType = "artist"
|
|
|
|
)
|
|
|
|
|
2016-03-03 00:44:13 +01:00
|
|
|
type Child struct {
|
2023-11-22 02:09:12 +01:00
|
|
|
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,omitempty" json:"title,omitempty"`
|
|
|
|
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
|
|
|
|
Album string `xml:"album,attr,omitempty" json:"album,omitempty"`
|
|
|
|
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
|
|
|
Track int32 `xml:"track,attr,omitempty" json:"track,omitempty"`
|
|
|
|
Year int32 `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"`
|
|
|
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
|
|
|
TranscodedContentType string `xml:"transcodedContentType,attr,omitempty" json:"transcodedContentType,omitempty"`
|
|
|
|
TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"`
|
|
|
|
Duration int32 `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
|
|
|
BitRate int32 `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
|
|
|
|
Path string `xml:"path,attr,omitempty" json:"path,omitempty"`
|
|
|
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
|
|
|
|
DiscNumber int32 `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"`
|
|
|
|
Created *time.Time `xml:"created,attr,omitempty" json:"created,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"`
|
|
|
|
UserRating int32 `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
|
|
|
SongCount int32 `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
|
|
|
IsVideo bool `xml:"isVideo,attr" json:"isVideo"`
|
|
|
|
BookmarkPosition int64 `xml:"bookmarkPosition,attr,omitempty" json:"bookmarkPosition,omitempty"`
|
2016-03-18 03:29:58 +01:00
|
|
|
/*
|
2016-03-21 14:50:46 +01:00
|
|
|
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.6.0 -->
|
2016-03-18 03:29:58 +01:00
|
|
|
*/
|
2023-11-29 03:12:28 +01:00
|
|
|
// OpenSubsonic extensions
|
|
|
|
Played *time.Time `xml:"played,attr,omitempty" json:"played,omitempty"`
|
|
|
|
Bpm int32 `xml:"bpm,attr" json:"bpm"`
|
|
|
|
Comment string `xml:"comment,attr" json:"comment"`
|
2023-11-29 03:26:00 +01:00
|
|
|
SortName string `xml:"sortName,attr" json:"sortName"`
|
|
|
|
MediaType MediaType `xml:"mediaType,attr" json:"mediaType"`
|
|
|
|
MusicBrainzId string `xml:"musicBrainzId,attr" json:"musicBrainzId"`
|
2023-11-29 03:12:28 +01:00
|
|
|
Genres ItemGenres `xml:"genres" json:"genres"`
|
2023-12-02 21:28:44 +01:00
|
|
|
ReplayGain ReplayGain `xml:"replayGain" json:"replayGain"`
|
2024-04-26 23:51:04 +02:00
|
|
|
ChannelCount int32 `xml:"channelCount,attr" json:"channelCount"`
|
2016-03-03 00:44:13 +01:00
|
|
|
}
|
|
|
|
|
2016-03-29 06:01:27 +02:00
|
|
|
type Songs struct {
|
|
|
|
Songs []Child `xml:"song" json:"song,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-03-03 00:44:13 +01:00
|
|
|
type Directory struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Child []Child `xml:"child" json:"child,omitempty"`
|
|
|
|
Id string `xml:"id,attr" json:"id"`
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`
|
|
|
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
2021-12-14 15:33:34 +01:00
|
|
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
|
2022-11-02 16:20:51 +01:00
|
|
|
Played *time.Time `xml:"played,attr,omitempty" json:"played,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
UserRating int32 `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
2016-03-28 03:27:45 +02:00
|
|
|
|
|
|
|
// ID3
|
|
|
|
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"`
|
2023-03-14 14:48:52 +01:00
|
|
|
SongCount int32 `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
|
|
|
AlbumCount int32 `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
|
|
|
|
Duration int32 `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
2016-03-28 03:27:45 +02:00
|
|
|
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
Year int32 `xml:"year,attr,omitempty" json:"year,omitempty"`
|
2016-03-28 03:27:45 +02:00
|
|
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
|
|
|
|
2016-03-18 03:29:58 +01:00
|
|
|
/*
|
|
|
|
<xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.13.0 -->
|
|
|
|
*/
|
2016-03-03 06:46:23 +01:00
|
|
|
}
|
2016-03-04 00:44:39 +01:00
|
|
|
|
2016-03-28 15:16:03 +02:00
|
|
|
type ArtistID3 struct {
|
2020-10-30 21:08:43 +01:00
|
|
|
Id string `xml:"id,attr" json:"id"`
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
AlbumCount int32 `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
|
2020-10-30 21:08:43 +01:00
|
|
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
UserRating int32 `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
2021-11-24 03:50:57 +01:00
|
|
|
ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"`
|
2023-11-29 03:26:00 +01:00
|
|
|
|
|
|
|
// OpenSubsonic extensions
|
|
|
|
MusicBrainzId string `xml:"musicBrainzId,attr,omitempty" json:"musicBrainzId,omitempty"`
|
|
|
|
SortName string `xml:"sortName,attr,omitempty" json:"sortName,omitempty"`
|
2016-03-28 15:16:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type AlbumID3 struct {
|
2023-11-29 03:12:28 +01:00
|
|
|
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 int32 `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
|
|
|
Duration int32 `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
|
|
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
|
|
|
|
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
|
|
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
|
|
|
Year int32 `xml:"year,attr,omitempty" json:"year,omitempty"`
|
|
|
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
|
|
|
|
|
|
|
// OpenSubsonic extensions
|
2023-12-23 03:03:55 +01:00
|
|
|
Played *time.Time `xml:"played,attr,omitempty" json:"played,omitempty"`
|
|
|
|
UserRating int32 `xml:"userRating,attr" json:"userRating"`
|
|
|
|
Genres ItemGenres `xml:"genres" json:"genres"`
|
|
|
|
MusicBrainzId string `xml:"musicBrainzId,attr" json:"musicBrainzId"`
|
|
|
|
IsCompilation bool `xml:"isCompilation,attr" json:"isCompilation"`
|
|
|
|
SortName string `xml:"sortName,attr" json:"sortName"`
|
|
|
|
DiscTitles DiscTitles `xml:"discTitles" json:"discTitles"`
|
|
|
|
OriginalReleaseDate ItemDate `xml:"originalReleaseDate" json:"originalReleaseDate"`
|
2024-04-03 13:30:01 +02:00
|
|
|
ReleaseDate ItemDate `xml:"releaseDate" json:"releaseDate"`
|
2016-03-28 15:16:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type ArtistWithAlbumsID3 struct {
|
|
|
|
ArtistID3
|
|
|
|
Album []Child `xml:"album" json:"album,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type AlbumWithSongsID3 struct {
|
|
|
|
AlbumID3
|
|
|
|
Song []Child `xml:"song" json:"song,omitempty"`
|
2016-03-28 03:27:45 +02:00
|
|
|
}
|
|
|
|
|
2016-03-04 15:09:16 +01:00
|
|
|
type AlbumList struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Album []Child `xml:"album" json:"album,omitempty"`
|
2016-03-04 15:09:16 +01:00
|
|
|
}
|
|
|
|
|
2016-03-09 16:09:15 +01:00
|
|
|
type Playlist struct {
|
2020-04-12 01:15:15 +02:00
|
|
|
Id string `xml:"id,attr" json:"id"`
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
Comment string `xml:"comment,attr,omitempty" json:"comment,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
SongCount int32 `xml:"songCount,attr" json:"songCount"`
|
|
|
|
Duration int32 `xml:"duration,attr" json:"duration"`
|
2020-05-26 03:00:05 +02:00
|
|
|
Public bool `xml:"public,attr" json:"public"`
|
2020-04-12 01:15:15 +02:00
|
|
|
Owner string `xml:"owner,attr,omitempty" json:"owner,omitempty"`
|
|
|
|
Created time.Time `xml:"created,attr" json:"created"`
|
|
|
|
Changed time.Time `xml:"changed,attr" json:"changed"`
|
2023-01-02 01:35:19 +01:00
|
|
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
2016-03-09 16:09:15 +01:00
|
|
|
/*
|
|
|
|
<xs:sequence>
|
|
|
|
<xs:element name="allowedUser" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <!--Added in 1.8.0-->
|
|
|
|
</xs:sequence>
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
type Playlists struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Playlist []Playlist `xml:"playlist" json:"playlist,omitempty"`
|
2016-03-09 16:09:15 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 00:28:11 +01:00
|
|
|
type PlaylistWithSongs struct {
|
|
|
|
Playlist
|
2016-03-22 03:45:56 +01:00
|
|
|
Entry []Child `xml:"entry" json:"entry,omitempty"`
|
2016-03-10 00:28:11 +01:00
|
|
|
}
|
|
|
|
|
2016-03-11 06:37:07 +01:00
|
|
|
type SearchResult2 struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Artist []Artist `xml:"artist" json:"artist,omitempty"`
|
|
|
|
Album []Child `xml:"album" json:"album,omitempty"`
|
|
|
|
Song []Child `xml:"song" json:"song,omitempty"`
|
2016-03-11 06:37:07 +01:00
|
|
|
}
|
|
|
|
|
2016-03-28 16:01:43 +02:00
|
|
|
type SearchResult3 struct {
|
|
|
|
Artist []ArtistID3 `xml:"artist" json:"artist,omitempty"`
|
2023-12-09 20:01:22 +01:00
|
|
|
Album []AlbumID3 `xml:"album" json:"album,omitempty"`
|
2016-03-28 16:01:43 +02:00
|
|
|
Song []Child `xml:"song" json:"song,omitempty"`
|
|
|
|
}
|
|
|
|
|
2016-03-14 16:35:48 +01:00
|
|
|
type Starred struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Artist []Artist `xml:"artist" json:"artist,omitempty"`
|
|
|
|
Album []Child `xml:"album" json:"album,omitempty"`
|
|
|
|
Song []Child `xml:"song" json:"song,omitempty"`
|
2016-03-14 16:35:48 +01:00
|
|
|
}
|
|
|
|
|
2016-03-17 14:34:32 +01:00
|
|
|
type NowPlayingEntry struct {
|
|
|
|
Child
|
2021-06-20 02:56:56 +02:00
|
|
|
UserName string `xml:"username,attr" json:"username"`
|
2023-03-14 14:48:52 +01:00
|
|
|
MinutesAgo int32 `xml:"minutesAgo,attr" json:"minutesAgo"`
|
|
|
|
PlayerId int32 `xml:"playerId,attr" json:"playerId"`
|
2016-03-22 03:45:56 +01:00
|
|
|
PlayerName string `xml:"playerName,attr" json:"playerName,omitempty"`
|
2016-03-17 14:34:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type NowPlaying struct {
|
2016-03-22 03:45:56 +01:00
|
|
|
Entry []NowPlayingEntry `xml:"entry" json:"entry,omitempty"`
|
2016-03-17 14:34:32 +01:00
|
|
|
}
|
|
|
|
|
2016-03-04 00:44:39 +01:00
|
|
|
type User struct {
|
2023-03-14 14:48:52 +01:00
|
|
|
Username string `xml:"username,attr" json:"username"`
|
|
|
|
Email string `xml:"email,attr,omitempty" json:"email,omitempty"`
|
|
|
|
ScrobblingEnabled bool `xml:"scrobblingEnabled,attr" json:"scrobblingEnabled"`
|
|
|
|
MaxBitRate int32 `xml:"maxBitRate,attr,omitempty" json:"maxBitRate,omitempty"`
|
|
|
|
AdminRole bool `xml:"adminRole,attr" json:"adminRole"`
|
|
|
|
SettingsRole bool `xml:"settingsRole,attr" json:"settingsRole"`
|
|
|
|
DownloadRole bool `xml:"downloadRole,attr" json:"downloadRole"`
|
|
|
|
UploadRole bool `xml:"uploadRole,attr" json:"uploadRole"`
|
|
|
|
PlaylistRole bool `xml:"playlistRole,attr" json:"playlistRole"`
|
|
|
|
CoverArtRole bool `xml:"coverArtRole,attr" json:"coverArtRole"`
|
|
|
|
CommentRole bool `xml:"commentRole,attr" json:"commentRole"`
|
|
|
|
PodcastRole bool `xml:"podcastRole,attr" json:"podcastRole"`
|
|
|
|
StreamRole bool `xml:"streamRole,attr" json:"streamRole"`
|
|
|
|
JukeboxRole bool `xml:"jukeboxRole,attr" json:"jukeboxRole"`
|
|
|
|
ShareRole bool `xml:"shareRole,attr" json:"shareRole"`
|
|
|
|
VideoConversionRole bool `xml:"videoConversionRole,attr" json:"videoConversionRole"`
|
|
|
|
Folder []int32 `xml:"folder,omitempty" json:"folder,omitempty"`
|
2016-03-04 00:44:39 +01:00
|
|
|
}
|
2020-01-15 23:49:09 +01:00
|
|
|
|
2020-10-27 23:19:56 +01:00
|
|
|
type Users struct {
|
|
|
|
User []User `xml:"user" json:"user"`
|
|
|
|
}
|
|
|
|
|
2020-01-15 23:49:09 +01:00
|
|
|
type Genre struct {
|
|
|
|
Name string `xml:",chardata" json:"value,omitempty"`
|
2023-03-14 14:48:52 +01:00
|
|
|
SongCount int32 `xml:"songCount,attr" json:"songCount"`
|
|
|
|
AlbumCount int32 `xml:"albumCount,attr" json:"albumCount"`
|
2020-01-15 23:49:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Genres struct {
|
|
|
|
Genre []Genre `xml:"genre,omitempty" json:"genre,omitempty"`
|
|
|
|
}
|
2020-02-10 01:42:37 +01:00
|
|
|
|
2023-01-18 02:22:54 +01:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2020-02-10 01:42:37 +01:00
|
|
|
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"`
|
|
|
|
}
|
2020-07-31 18:36:33 +02:00
|
|
|
|
2020-10-20 19:38:44 +02:00
|
|
|
type SimilarSongs struct {
|
|
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SimilarSongs2 struct {
|
|
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-08-05 19:48:50 +02:00
|
|
|
type TopSongs struct {
|
|
|
|
Song []Child `xml:"song,omitempty" json:"song,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-07-31 18:36:33 +02:00
|
|
|
type PlayQueue struct {
|
|
|
|
Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
|
|
|
Current string `xml:"current,attr,omitempty" json:"current,omitempty"`
|
|
|
|
Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"`
|
|
|
|
Username string `xml:"username,attr" json:"username"`
|
|
|
|
Changed *time.Time `xml:"changed,attr,omitempty" json:"changed,omitempty"`
|
|
|
|
ChangedBy string `xml:"changedBy,attr" json:"changedBy"`
|
|
|
|
}
|
2020-07-31 21:47:34 +02:00
|
|
|
|
|
|
|
type Bookmark struct {
|
2021-05-07 15:47:13 +02:00
|
|
|
Entry Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
2020-07-31 21:47:34 +02:00
|
|
|
Position int64 `xml:"position,attr,omitempty" json:"position,omitempty"`
|
|
|
|
Username string `xml:"username,attr" json:"username"`
|
|
|
|
Comment string `xml:"comment,attr" json:"comment"`
|
|
|
|
Created time.Time `xml:"created,attr" json:"created"`
|
|
|
|
Changed time.Time `xml:"changed,attr" json:"changed"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Bookmarks struct {
|
|
|
|
Bookmark []Bookmark `xml:"bookmark,omitempty" json:"bookmark,omitempty"`
|
|
|
|
}
|
2020-10-26 02:48:21 +01:00
|
|
|
|
2023-01-22 20:38:55 +01:00
|
|
|
type Share struct {
|
|
|
|
Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
|
|
|
ID string `xml:"id,attr" json:"id"`
|
|
|
|
Url string `xml:"url,attr" json:"url"`
|
|
|
|
Description string `xml:"description,omitempty,attr" json:"description,omitempty"`
|
|
|
|
Username string `xml:"username,attr" json:"username"`
|
|
|
|
Created time.Time `xml:"created,attr" json:"created"`
|
|
|
|
Expires *time.Time `xml:"expires,omitempty,attr" json:"expires,omitempty"`
|
2023-01-24 20:26:06 +01:00
|
|
|
LastVisited time.Time `xml:"lastVisited,omitempty,attr" json:"lastVisited"`
|
2023-03-14 14:48:52 +01:00
|
|
|
VisitCount int32 `xml:"visitCount,attr" json:"visitCount"`
|
2023-01-22 20:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Shares struct {
|
|
|
|
Share []Share `xml:"share,omitempty" json:"share,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-10-26 02:48:21 +01:00
|
|
|
type ScanStatus struct {
|
2020-11-16 06:33:17 +01:00
|
|
|
Scanning bool `xml:"scanning,attr" json:"scanning"`
|
|
|
|
Count int64 `xml:"count,attr" json:"count"`
|
|
|
|
FolderCount int64 `xml:"folderCount,attr" json:"folderCount"`
|
|
|
|
LastScan *time.Time `xml:"lastScan,attr,omitempty" json:"lastScan,omitempty"`
|
2020-10-26 02:48:21 +01:00
|
|
|
}
|
2021-10-19 22:33:06 +02:00
|
|
|
|
|
|
|
type Lyrics struct {
|
|
|
|
Artist string `xml:"artist,omitempty,attr" json:"artist,omitempty"`
|
|
|
|
Title string `xml:"title,omitempty,attr" json:"title,omitempty"`
|
|
|
|
Value string `xml:",chardata" json:"value"`
|
|
|
|
}
|
2023-01-15 21:11:37 +01:00
|
|
|
|
|
|
|
type InternetRadioStations struct {
|
|
|
|
Radios []Radio `xml:"internetRadioStation" json:"internetRadioStation,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Radio struct {
|
2023-01-15 21:38:38 +01:00
|
|
|
ID string `xml:"id,attr" json:"id"`
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
StreamUrl string `xml:"streamUrl,attr" json:"streamUrl"`
|
|
|
|
HomepageUrl string `xml:"homePageUrl,omitempty,attr" json:"homePageUrl,omitempty"`
|
2023-01-15 21:11:37 +01:00
|
|
|
}
|
2023-04-08 19:25:37 +02:00
|
|
|
|
Jukebox mode (#2289)
* Adding cache directory to ignore-list
* Adding jukebox-related config options
* Adding DevEnableJukebox config option pls. dummy server
* Adding types and routers
* Now without panic
* First draft on parsing the action
* Some cleanups
* Adding playback server
* Verify audio device configuration
* Adding debug-build target to have full symbol support
* Adding beep sound library pls some example code. Not working yet
* Play a fixed mp3 on any interface access for testing purposes
* Put action code into separate file, adding stringer, more debug output, prepare structs, validation
* Put action parameter parser code where it belongs
* Have a single Action transporting all information
* User fmt.Errorf for error-generation
* Adding wide playback interface
* Use action map for parsing, stringer instead switch stmt.
* Use but only one switch case and direct dispatch, refactoring
* Add error handling and pushing to client
* send decent errormessage, no internal server error
* Adding playback devices slice and load it from config
* Combine config-verification and structure init
* Return user-specific device
* Separate playback server from device
* Use dataStore to retrieve mediafile by id
* WIP: Playlist and start/stop handling. Doing start/stop the hard way as of now
* WIP: set, start and stop work on one single song. More to come
* Dont need to wait for the end
* Merge jukebox_action.go into jukebox.go
* Remove getParameterAsInt64(). Use existing requiredParamInt() instead
* Dont need to call newFailure() explicitly
* Remove int64, use int instead.
* Add and set action now accept multiple ids
* Kickout copy of childFromMediaFile(). It is not needed here.
* Refactoring devices and playbackServer
* Turn (internal) playback.DeviceStatus into subsonic JukeboxStatus when rendering output. Indexes int64 -> int
* Now we have a position and playing status
* Switching gain to float32, xs:float is defined as 32 bit. Fixing nasty copy/pointer bug
* Now with volume control
* Start working the queue
* Remove user from device interface
* Rename function GetDevice -> GetDeviceForUser to make intention clearer
* Have a nice stringer for the queue
* User Prepared boolean for now to allow pause/unpause
* Skipping works, but without offsets
* Make ChildFromMediaFile public to be used in jukebox get() implementation
* Return position in seconds and implement offset-skip in seconds
* Default offset to 0
* Adding a simple setGain implementation
* Prepare for transcoding AAC
* WIP: transcode to WAV to use beeps wav decoder. Not done yet.
* WIP: out of sheer desparation: convert to MP3 (which works) rather than WAV to troubleshoot issue.
* Use FLAC as intermediate format to play Apple AAC
* A bit of cleanup
* Catching the end-of-stream event for further reactions
* Have a trackSwitching goroutine waiting on channel when track ends
* Move decoder code into own file. Restructure code a bit
* Now with going on to play the next song in the playlist
* Adding shuffle feature
* Implementing remove action
* Cleanup code
* Remove templates for ffmpeg mp3 generation. Not needed anymore.
* Adding some documentation
* Check whether offset into track is in range. Fixing potential remove track bug. Documentation
* Make golangci-lint happy: handling return values
* Adding test suite and example dummy for playback package
* Adding some basic queue tests
* Only use Jukebox.Enabled config option
* Adding stream closing handling
* Pass context.Context to all PlaybackDevice methods
* Remove unneeded function
* Correct spelling
* Reduce visibility of ChildFromMediaFile
* Decomplicate action-parsing
* Adding simple tempfile-based AAC->FLAC transcoding. No parallel reading and writing yet.
* Try to optimize pipe-writing, tempfile-handling and reading. Not done yet.
* Do a synchronous copy of the tempfile. Racecondition detected
* More debugging statements and fixing the play/pause bug. More work needed
* Start the trackSwitcher() with each device once. Return JSON position even if its 0. More debug-output
* Moving all track-handling code into own module
* Fix typo. Do not pass ctx around when not applicable
* WIP: More refactoring, debugging output
* Fix nil pointer
* Repairing MP3 playback by pinning indirect dependencies: hajimehoshi/go-mp3 and hajimehoshi/oto
* Do not forget to cleanup after a skip action
* Make resync with master easy
* Adding missing mocks
* Adding missing error-handling found by linter
* Updating github.com/hajimehoshi/oto
* Removing duplicate function
* Move BEEP-related code into own package
* Juggle beep-related code around as preparation for interface access
* More refactoring for interface separation
* Gather CloseDevice() behind Track interface.
* Adding skeleton, draft audio-interface using mpv.io
* Adding majority of interface commands using messages to mpv socket.
* Adding end-of-stream handling
* MPV: start/stop are working
* postition is given in float in mpv
* Unify Close() and CloseDevice(). Using temp filename for controlling socket
* Wait until control-socket shows up. Cleanup socket in Close()
* Use canceable command. Rename to Executor
* Skipping tracks works now
* Now with actually setting the position
* Fix regain
* Add missing error-handling found by linter
* Adding retry mode on time-pos property getter
* Remove unneeded code on queue
* Putting build-tag beep onto beep files
* Remove deprecated call to rand.Seed()
"As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator."
* Using int32 to conform to Subsonic API spec
* Fix merge error
* Minor style changes
* Get username from context
---------
Co-authored-by: Deluan <deluan@navidrome.org>
2023-09-10 17:25:22 +02:00
|
|
|
type JukeboxStatus struct {
|
|
|
|
CurrentIndex int32 `xml:"currentIndex,attr" json:"currentIndex"`
|
|
|
|
Playing bool `xml:"playing,attr" json:"playing"`
|
|
|
|
Gain float32 `xml:"gain,attr" json:"gain"`
|
|
|
|
Position int32 `xml:"position,omitempty,attr" json:"position"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type JukeboxPlaylist struct {
|
|
|
|
JukeboxStatus
|
|
|
|
Entry []Child `xml:"entry,omitempty" json:"entry,omitempty"`
|
|
|
|
}
|
2023-12-28 02:20:29 +01:00
|
|
|
|
|
|
|
type Line struct {
|
|
|
|
Start *int64 `xml:"start,attr,omitempty" json:"start,omitempty"`
|
|
|
|
Value string `xml:"value" json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type StructuredLyric struct {
|
|
|
|
DisplayArtist string `xml:"displayArtist,attr,omitempty" json:"displayArtist,omitempty"`
|
|
|
|
DisplayTitle string `xml:"displayTitle,attr,omitempty" json:"displayTitle,omitempty"`
|
|
|
|
Lang string `xml:"lang,attr" json:"lang"`
|
|
|
|
Line []Line `xml:"line" json:"line"`
|
|
|
|
Offset *int64 `xml:"offset,attr,omitempty" json:"offset,omitempty"`
|
|
|
|
Synced bool `xml:"synced,attr" json:"synced"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type StructuredLyrics []StructuredLyric
|
|
|
|
type LyricsList struct {
|
|
|
|
StructuredLyrics []StructuredLyric `xml:"structuredLyrics,omitempty" json:"structuredLyrics,omitempty"`
|
|
|
|
}
|
|
|
|
|
2023-11-27 19:25:06 +01:00
|
|
|
type OpenSubsonicExtension struct {
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
Versions []int32 `xml:"versions" json:"versions"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type OpenSubsonicExtensions []OpenSubsonicExtension
|
2023-11-18 20:40:00 +01:00
|
|
|
|
|
|
|
type ItemGenre struct {
|
|
|
|
Name string `xml:"name,attr" json:"name"`
|
|
|
|
}
|
2023-11-22 02:09:12 +01:00
|
|
|
|
2023-11-27 19:25:06 +01:00
|
|
|
// ItemGenres holds a list of genres (OpenSubsonic). If it is null, it must be marshalled as an empty array.
|
2023-11-22 02:09:12 +01:00
|
|
|
type ItemGenres []ItemGenre
|
|
|
|
|
|
|
|
func (i ItemGenres) MarshalJSON() ([]byte, error) {
|
2023-12-09 02:04:17 +01:00
|
|
|
return marshalJSONArray(i)
|
2023-11-22 02:09:12 +01:00
|
|
|
}
|
2023-12-02 21:28:44 +01:00
|
|
|
|
|
|
|
type ReplayGain struct {
|
|
|
|
TrackGain float64 `xml:"trackGain,omitempty,attr" json:"trackGain,omitempty"`
|
|
|
|
AlbumGain float64 `xml:"albumGain,omitempty,attr" json:"albumGain,omitempty"`
|
|
|
|
TrackPeak float64 `xml:"trackPeak,omitempty,attr" json:"trackPeak,omitempty"`
|
|
|
|
AlbumPeak float64 `xml:"albumPeak,omitempty,attr" json:"albumPeak,omitempty"`
|
|
|
|
BaseGain float64 `xml:"baseGain,omitempty,attr" json:"baseGain,omitempty"`
|
|
|
|
FallbackGain float64 `xml:"fallbackGain,omitempty,attr" json:"fallbackGain,omitempty"`
|
|
|
|
}
|
2023-12-09 02:04:17 +01:00
|
|
|
|
|
|
|
type DiscTitle struct {
|
2024-04-09 01:05:36 +02:00
|
|
|
Disc int `xml:"disc,attr" json:"disc"`
|
|
|
|
Title string `xml:"title,attr" json:"title"`
|
2023-12-09 02:04:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type DiscTitles []DiscTitle
|
|
|
|
|
|
|
|
func (d DiscTitles) MarshalJSON() ([]byte, error) {
|
|
|
|
return marshalJSONArray(d)
|
|
|
|
}
|
|
|
|
|
|
|
|
// marshalJSONArray marshals a slice of any type to JSON. If the slice is empty, it is marshalled as an
|
|
|
|
// empty array instead of null.
|
|
|
|
func marshalJSONArray[T any](v []T) ([]byte, error) {
|
|
|
|
if len(v) == 0 {
|
|
|
|
return json.Marshal([]T{})
|
|
|
|
}
|
|
|
|
a := v
|
|
|
|
return json.Marshal(a)
|
|
|
|
}
|
2023-12-23 03:03:55 +01:00
|
|
|
|
|
|
|
type ItemDate struct {
|
|
|
|
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
|
|
|
Month int `xml:"month,attr,omitempty" json:"month,omitempty"`
|
|
|
|
Day int `xml:"day,attr,omitempty" json:"day,omitempty"`
|
|
|
|
}
|