File src/play_song.c

This file is responsible for calling the external media player and actually playing music on the air. Note that the UBS does not actually play any music itself; it simply parses through the configuration settings and exec's out a new process.


Included Files


Global Variable PROCNAME

char PROCNAME[128]
Included from include/ubs.h

Global Variable CUR_TIME

struct tm* CUR_TIME
Included from include/ubs.h

Global Variable GLOBAL

ubs_table GLOBAL
Included from include/ubs.h

Global Variable LOGLEVEL

int LOGLEVEL
Included from include/ubs.h

Global Variable do_event

This variable is set to 0 by default, and if it is false, then the ubs-play daemon will pop a song from the queue and play it as usual. If it is true, then it will play an event instead, which means that it reads out of a different queue file (tmp/next-event). This is set to be true in the sig_event function, which comes up whenever a SIGURG is sent to the ubs-play daemon

int do_event
Included from include/ubs-play.h


Global Variable PLAY

ubs_table PLAY
Included from include/ubs-play.h

Global Function play_song()

Plays the song from the queue. This function basically takes the "media" directive from the configuration file, and forks out a new process to play the song, waiting until this process ends before returning.

int play_song ( char* songname )

int play_song
Returns OK on success, NO_FORK if fork fails, FAIL if exec fails, and NO_FORK if waitpid fails
char* songname
The name of the song to play. This function has nothing to due with the queue; it simply expects to get passed a filename which it can open and play.
Prototyped in: include/ubs-play.h
Calls: exec_proc()lib/exec_proc.c
  log_error_msg()lib/logging.c
  record_pid()lib/logging.c
  ubs_table_data()lib/table.c
  fork(), strncpy(), waitpid()