File lib/music_info.c

Deals with song/artist info inside of a music file. In the case of mp3, this means ID3 version 1 tags. For ogg vorbis, it means just grabbing this information out of the comments.


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 Function check_against_tags()

Sees if any part of any tag in file2 is present in file1

int check_against_tags ( char* file1, char* file2 )

int check_against_tags
Returns YES if a match is found, FAIL if either get_media_tag() call is bad, or NO if no match is found
char* file1
File to check against
char* file2
File to check
Prototyped in: include/ubs.h
Calls: get_media_tag()lib/music_info.c
  log_error_msg()lib/logging.c
  strcasecmp(), ubs_strcasestr()
Called by: check_against_cur()lib/get_song.c
  check_against_log()lib/get_song.c
  check_against_queue()lib/get_song.c

Global Function get_media_tag()

Determines the type of file (mp3 or ogg are supported at the moment), and calls the appropriate function to grab the song information

int get_media_tag ( char* sname, struct media_tag* song_tag )

int get_media_tag
Returns value of get_mp3_tag()/get_ogg_tag() on success, FAIL if an unknown extension is given, FAIL if libvorbis isn't around and an ogg was given anyways
char* sname
The filename of the music file
struct media_tag* song_tag
The structure that will be filled in with the relevant information from the song's ID3 or vorbis tag
Prototyped in: include/ubs.h
Calls: get_mp3_tag()lib/music_info.c
  log_error_msg()lib/logging.c
  memset(), strcasecmp(), strlen(), strncpy()
Called by: check_against_tags()lib/music_info.c

Global Function get_mp3_tag()

Gets information from an ID3 version 1 tag, which is the "old" mp3 tagging format. This is done by just opening up the file and reading the last 128 bytes.

int get_mp3_tag ( char* sname, struct media_tag* song_tag )

int get_mp3_tag
Returns OK on success, NO_FILE if the file can't be opened
char* sname
The song filename to scan
struct media_tag* song_tag
The structure to fill
Prototyped in: include/ubs.h
Calls: log_error_msg()lib/logging.c
  fclose(), fgets(), fopen(), fseek(), memset(), strncmp(), strncpy()
Called by: get_media_tag()lib/music_info.c

Global Function get_ogg_tag()

Gets the song information from an ogg vorbis tag. This is done via the ogg vorbis libraries.

int get_ogg_tag ( char* sname, struct media_tag* song_tag )

int get_ogg_tag
Returns OK on success, NO_FILE if the file can't be opened
char* sname
The song filename to scan
struct media_tag* song_tag
The structure to write data to
Prototyped in: include/ubs.h