My Project
|
#include <server.hpp>
Public Member Functions | |
AudioServer (Db *db) | |
Song | getCurrentSong (void) |
bool | isPlaying (void) |
void | playSong (Song s) |
void | upvoteCurrentSong (void) |
void | downvoteCurrentSong (void) |
void | playNext (void) |
void | addSong (Song s) |
void | addSong (std::string user, std::string url) |
void | run (void) |
void | run (std::string fname) |
Static Public Member Functions | |
static void | playVideo (std::string url) |
Class used play songs from a sorted queue and take commmands over FIFO
AudioServer::AudioServer | ( | Db * | db | ) |
|
inline |
void AudioServer::addSong | ( | std::string | user, |
std::string | url | ||
) |
Creates and adds a Song to the queue
user | The person who submitted the song |
url | The URL of the song |
void AudioServer::downvoteCurrentSong | ( | void | ) |
Decrements the taste value of the user who submitted the current song in the database
|
inline |
Returns a copy of the Song object currently playing
bool AudioServer::isPlaying | ( | void | ) |
Checks if there is an instance of VLC playing a song
void AudioServer::playNext | ( | void | ) |
Plays the audio of the next Song in the queue
void AudioServer::playSong | ( | Song | s | ) |
|
static |
url | the URL to stream audio from |
void AudioServer::run | ( | void | ) |
This starts the server up and does not return until there is nothing in the song queue. It asssumes that a number of songs has already been added to the queue.
void AudioServer::run | ( | std::string | fname | ) |
This starts the server which then runs until told to stop. Commands for adding songs, voting, and quiting are sent via the fifo, which its name is passed as an argument to this function.
fname | the name of the FIFO to read commands from |
void AudioServer::upvoteCurrentSong | ( | void | ) |
Increments the taste value of the user who submitted the current song in the database