Documentation ¶
Index ¶
- Constants
- Variables
- func CheckHash(w http.ResponseWriter, r *http.Request)
- func ClientAddress(r *http.Request) string
- func DownloadSpotify(url string)
- func ErrorPage(w http.ResponseWriter, r *http.Request)
- func GetQueue(w http.ResponseWriter, r *http.Request)
- func HashExistingFiles(folder string)
- func PlaySongs()
- func QueueSong(song SongHolder)
- func QueueURL(w http.ResponseWriter, r *http.Request)
- func ServerAddress() (string, error)
- func StartServer(server ServerStruct)
- func UploadFile(w http.ResponseWriter, r *http.Request)
- type ServerStruct
- type SongData
- type SongHolder
- type UserData
Constants ¶
View Source
const ( MsgDontSendFile = "Hash recieved for song, no need to send full file." MsgSendFullFile = "Song hash not found, send full base64 encoded file." MsgSongQueued = "Song successfully added to queue." MsgOnlyMP3 = "File rejected. Please only send MP3 files." )
View Source
const ( RAWMP3 = iota YOUTUBE SPOTIFY SEARCH )
Variables ¶
View Source
var ( CurrentlyPlaying = false SpotifyEnabled = false CurrentlyStreamingSpotify = false SongQueue = make(map[string]*UserData) HashHolder = make(map[string]string) SpotifySession *spotify.Session SpotifyAudio spotify.AudioConsumer DownloadFolder, _ = filepath.Abs("./serverSongs") RawMp3Folder, _ = filepath.Abs("./serverSongs/rawmp3") YoutubeFolder, _ = filepath.Abs("./serverSongs/youtube") SpotifyFolder, _ = filepath.Abs("./serverSongs/spotify") SpotifyKeyFile, _ = filepath.Abs("./keyFile/spotify.key") InfoMsg = color.New(color.FgYellow).Add(color.Bold) ErrorMsg = color.New(color.FgRed).Add(color.Bold) MusicMsg = color.New(color.FgBlue).Add(color.Bold) )
View Source
var (
ErrNoSongsLeft = errors.New("There are no songs left in queue.")
)
Functions ¶
func ClientAddress ¶
func DownloadSpotify ¶
func DownloadSpotify(url string)
func HashExistingFiles ¶
func HashExistingFiles(folder string)
func QueueSong ¶
func QueueSong(song SongHolder)
func ServerAddress ¶
func StartServer ¶
func StartServer(server ServerStruct)
func UploadFile ¶
func UploadFile(w http.ResponseWriter, r *http.Request)
Types ¶
type ServerStruct ¶
type ServerStruct struct {
Port *int
}
type SongHolder ¶
type SongHolder struct { IpAddr string `json:"ipAddr"` Name string `json:"fileName"` Type int `json:"songType"` FileHash string `json:"fileHash"` URL string `json:"fileURL"` Search string `json:"fileSearch"` }
func PopQueue ¶
func PopQueue() (SongHolder, error)
type UserData ¶
type UserData struct { Played bool `json:"played"` Songs []SongHolder `json:"songs"` }
Click to show internal directories.
Click to hide internal directories.