File src/enqueue.c

This file is responsible for monitoring the queue and adding new music files to the end of the queue. Also handles parsing various types of playlists.


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 WEEK

An array that holds all of the half-hour slots for an entire week, which is the period of time that the ubs runs off of. This array contains integers which correspond to show ID's

int WEEK[7][48]
Included from include/ubs-sched.h


Global Variable ALLSHOWS

All the known shows

struct show* ALLSHOWS
Included from include/ubs-sched.h


Global Variable SCHED

ubs_table SCHED
Included from include/ubs-sched.h

Global Function enqueue()

This function monitors the queue and adds new files to it when needed. Basically, whenever the number of files in the queue is less than three, it will find new files from the current show and add them to the queue until the queue is at three files.

int enqueue ( int cur_show )

int enqueue
Returns OK on success, FAIL if the call to get_song() fails
int cur_show
The index of the current show in the ALLSHOWS array
Prototyped in: include/ubs-sched.h
Calls: check_against_cur()lib/get_song.c
  check_against_log()lib/get_song.c
  check_against_queue()lib/get_song.c
  get_song()lib/get_song.c
  log_error_msg()lib/logging.c
  queue_length()lib/queue.c
  queue_push()lib/queue.c
  ubs_table_data()lib/table.c
  atoi()

Global Function parse_itunes_playlist()

int parse_itunes_playlist ( char* playlist )
Prototyped in: include/ubs-sched.h

Global Function parse_m3u_playlist()

Parses a m3u playlist to the filecache, stripping all the junk that makes it unusable with the internal UBS format

int parse_m3u_playlist ( char* playlist )

int parse_m3u_playlist
Returns num_files on success, NO_FILE if the playlist can't be read in
char* playlist
Filename to read in
Prototyped in: include/ubs-sched.h
Calls: chomp_line()lib/parse_line.c
  log_error_msg()lib/logging.c
  queue_push()lib/queue.c
  fclose(), fgets(), fopen(), memset(), snprintf(), strdup(), strrchr()