-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from DisgoOrg/track-userdata-and-smal-refactors
* introduce track userdata * player backup/restore for resuming * missing rest endpoints
- Loading branch information
Showing
36 changed files
with
595 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
package lavalink | ||
|
||
func NewAudioPlaylist(info AudioPlaylistInfo, tracks []AudioTrack) AudioPlaylist { | ||
return AudioPlaylist{ | ||
Info: info, | ||
Tracks: tracks, | ||
func NewAudioPlaylist(name string, selectedTrackIndex int, tracks []AudioTrack) AudioPlaylist { | ||
return BasicAudioPlaylist{ | ||
PlaylistName: name, | ||
SelectedTrackIndex: selectedTrackIndex, | ||
PlaylistTracks: tracks, | ||
} | ||
} | ||
|
||
type AudioPlaylist struct { | ||
Info AudioPlaylistInfo | ||
Tracks []AudioTrack | ||
type AudioPlaylist interface { | ||
Name() string | ||
Tracks() []AudioTrack | ||
SelectedTrack() AudioTrack | ||
} | ||
|
||
func (p AudioPlaylist) SelectedTrack() AudioTrack { | ||
if p.Info.SelectedTrack == -1 { | ||
return nil | ||
} | ||
if p.Info.SelectedTrack >= len(p.Tracks) { | ||
return nil | ||
} | ||
return p.Tracks[p.Info.SelectedTrack] | ||
type BasicAudioPlaylist struct { | ||
PlaylistName string | ||
SelectedTrackIndex int | ||
PlaylistTracks []AudioTrack | ||
} | ||
|
||
func (p BasicAudioPlaylist) Name() string { | ||
return p.PlaylistName | ||
} | ||
|
||
func (p BasicAudioPlaylist) Tracks() []AudioTrack { | ||
return p.PlaylistTracks | ||
} | ||
|
||
type AudioPlaylistInfo struct { | ||
Name string `json:"name"` | ||
SelectedTrack int `json:"selectedTrack"` | ||
func (p BasicAudioPlaylist) SelectedTrack() AudioTrack { | ||
if p.SelectedTrackIndex == -1 || p.SelectedTrackIndex >= len(p.PlaylistTracks) { | ||
return nil | ||
} | ||
return p.PlaylistTracks[p.SelectedTrackIndex] | ||
} |
Oops, something went wrong.