File src/ubs-play.c

This file plays music for the UBS. Actually, it simply reads filenames one at a time from the queue and passes them off to an external media player via play_song()


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 main()

The main function

int main ( int argc, char* argv[] )

int main
Returns OK on success
int argc
Should be empty; this program does not take any arguments
char* argv[]
Should be empty; this program does not take any arguments
Calls: check_running()lib/common.c
  chomp_line()lib/parse_line.c
  console_error()lib/logging.c
  get_media_tag()lib/music_info.c
  log_error_msg()lib/logging.c
  log_event()lib/logging.c
  play_song()src/play_song.c
  queue_chop()lib/queue.c
  queue_init()lib/queue.c
  queue_length()lib/queue.c
  queue_pop()lib/queue.c
  read_config()lib/read_config.c
  record_pid()lib/logging.c
  record_status()lib/logging.c
  ubs_init()lib/common.c
  ubs_table_add()lib/table.c
  ubs_table_data()lib/table.c
  ubs_table_exists()lib/table.c
  ubs_table_init()lib/table.c
  chdir(), exit(), fclose(), fgets(), fopen(), fork(), fprintf(), geteuid(), getgid(), getpid(), setsid(), signal(), sleep(), strcasecmp(), umask(), unlink()
References Functions: sig_event()src/ubs-play.c
  sig_quit_killmedia()src/ubs-play.c

Global Function sig_event()

Catch an event signal, which will be sent by ubs-event if it wants us to do something. This basically sets the do_event variable to be true, which will cause the main loop to run code for an event rather than playing a song from the queue.

void sig_event ( int sig )

int sig
The signal number. Used for debugging purposes only.
Prototyped in: include/ubs-play.h
Calls: log_error_msg()lib/logging.c
Used in: main()src/ubs-play.c

Global Function sig_quit_killmedia()

void sig_quit_killmedia ( int sig )
Prototyped in: include/ubs-play.h
Calls: log_error_msg()lib/logging.c
  record_status()lib/logging.c
  atoi(), exit(), fgets(), fopen(), kill(), snprintf(), unlink()
Used in: main()src/ubs-play.c