Included Files
- #include </usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/include/stdio.h>
- #include </usr/include/stdlib.h>
- #include </usr/include/unistd.h>
- #include </usr/include/string.h>
- #include </usr/include/dirent.h>
- #include </usr/include/sys/types.h>
- #include </usr/include/sys/dir.h>
- #include </usr/include/sys/param.h>
- #include </usr/include/sys/stat.h>
char PROCNAME[128]
struct tm* CUR_TIME
ubs_table GLOBAL
int LOGLEVEL
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]
All the known shows
struct show* ALLSHOWS
ubs_table SCHED
Checks to see if a filename is currently playing on the air. Since the ubs-play daemon pulls the file from the queue before playing it, there is a slim chance that a file could be queued twice once it is on the air.
int check_against_cur ( char* filename )
- int check_against_cur
- Returns NO if no match, YES if a match is found, and NO_FILE if the now_playing file cannot be opened.
- char* filename
- Filename to check
Prototyped in:
| include/ubs.h
|
Calls:
| check_against_tags(), chomp_line(), fclose(), fgets(), fopen(), log_error_msg(), strcasecmp()
|
Scans the playlist logfile to see if a filename has been recently played.
int check_against_log ( char* filename, char* logfile, int backnum )
- int check_against_log
- Returns NO if the file is not in the last backnum lines of the playlist log, YES if the file is matched, NO_FILE if the target logfile can't be opened, NO_MEM if malloc fails
- char* filename
- The filename to check
- char* logfile
- The logfile to check in
- int backnum
- The number of lines (at the tail end of the file) to scan
Prototyped in:
| include/ubs.h
|
Calls:
| check_against_tags(), fclose(), fgets(), fopen(), free(), log_error_msg(), malloc(), memset(), read_log(), strcasecmp(), strncpy()
|
Checks to see if a filename is already in the present queue
int check_against_queue ( char* filename )
- int check_against_queue
- Returns NO (same as OK) if the filename isn't in the queue, YES if the filename is in the queue, and NO_FILE if the queue can't be opened
- char* filename
- The filename to check
Prototyped in:
| include/ubs.h
|
Calls:
| check_against_tags(), chomp_line(), fclose(), fgets(), fopen(), log_error_msg(), strcasecmp(), ubs_table_data()
|
This function reads in the current filecache (all the known songs for the current show) and picks one at random. It does nothing to see if this song was recently played or anything of the sort. That functionality is handled by the check_against_log function.
int get_song ( char* sname )
- int get_song
- Returns OK on success and NO_FILE if the filecache can't be opened
- char* sname
- A pointer to a character array which this function will write the selected filename to
Prototyped in:
| include/ubs.h
|
Calls:
| chomp_line(), fclose(), fgets(), fopen(), fscanf(), log_error_msg(), rand()
|
This function gets called whenever the UBS starts up, and whenever it detects that a show change has occurred. Basically, it scans all the files in the directory for the current show and writes them to a big file, one filename per line. This was made recursive as of version 0.7.
int make_cache ( char* path )
- int make_cache
- Returns OK on success, NO_FILE if the filecache can't be opened, NO_FILE if the numfiles file can't be opened
- char* path
- The pathname of the directory to scan
Finds the number of files in a directory, and writes out all files it finds to a file pointer.
int parse_dir ( FILE* fp, char* path )
- int parse_dir
- Returns the number of files found in the given show directory, and all its child directories. If this functon finds another directory within the current one, it will call itself recursively and keep adding to the filecache. NO_DIR is returned if a directory cannot be opened for whatever reason.
- FILE* fp
- A filepointer, which should be opened with write permissions
- char* path
- The directory to start scanning at