server

package
v0.0.0-...-803d123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2016 License: MIT Imports: 23 Imported by: 0

Documentation

Index

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 CheckHash

func CheckHash(w http.ResponseWriter, r *http.Request)

func ClientAddress

func ClientAddress(r *http.Request) string

func DownloadSpotify

func DownloadSpotify(url string)

func ErrorPage

func ErrorPage(w http.ResponseWriter, r *http.Request)

func GetQueue

func GetQueue(w http.ResponseWriter, r *http.Request)

func HashExistingFiles

func HashExistingFiles(folder string)

func PlaySongs

func PlaySongs()

func QueueSong

func QueueSong(song SongHolder)

func QueueURL

func QueueURL(w http.ResponseWriter, r *http.Request)

func ServerAddress

func ServerAddress() (string, error)

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 SongData

type SongData struct {
	FileName string `json:"fileName"`
	Data     string `json:"data"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL