Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

playlist.c File Reference

Playlist management system. More...

#include "playlist.h"
#include "html.h"

Go to the source code of this file.

Functions

mu_entnew_ent (apr_pool_t *pool, mu_ent *head)
 Creates a new musical entry (mp3, ogg or directory).

short mpg123_mp3_ext_check (char *filename)
 Checks for valid MP3 filename extension.

id3_utf8_t * utf8_id3tag_findframe (struct id3_tag *tag, char const *frameid, unsigned short index)
 Converts an id3tag string in utf8.

mu_entmake_ogg_entry (apr_pool_t *pool, mu_ent *head, FILE *in, mu_config *conf, mu_ent_names *names, request_rec *r)
 Fills in the information fields about OGG data.

mu_entmake_mp3_entry (apr_pool_t *pool, mu_ent *head, FILE *in, mu_config *conf, mu_ent_names *names, request_rec *r)
 Fills in the information fields about MP3 data.

mu_entmake_music_entry (apr_pool_t *pool, request_rec *r, mu_ent *head, mu_config *conf, mu_ent_names *names)
 Add a file (and the content of the directory if requested) to the chain.

short musicindex_directory (request_rec *r, mu_config *conf)
 Generates and sends a webpage listing the music files in the directory.

short playlist_directory (request_rec *r, mu_config *conf)
 Creates and sends a playlist with the content of a directory.

short playlist_selected (request_rec *r, mu_config *conf)
 Generates and sends a playlist with only selected items.


Variables

const char * mpg123_id3_genres [GENRE_MAX]
 Reference table for digit coded genres.


Detailed Description

Playlist management system.

Author:
Regis Boudin

Thibaut Varene

Version:
Revision
1.60
Date:
2003
This is where the magic takes place. Here are the functions in charge of analyzing the content of the folders requested by the client, and of generating the structures and lists that will be used by the HTML subsystem to generate the pretty output.

Todo:
Find out if we trash "detect by content".

Definition in file playlist.c.


Function Documentation

mu_ent* make_mp3_entry apr_pool_t *  pool,
mu_ent head,
FILE *  in,
mu_config conf,
mu_ent_names names,
request_rec *  r
 

Fills in the information fields about MP3 data.

This function reads the id3 tags (using libid3tag0) from the MP3 file and fills in the struct mu_ent fields accordingly.

Parameters:
pool Pool
head Head
in MP3 file to parse
conf MusicIndex configuration paramaters struct
names Names
r Apache request_rec struct to handle log writings (debugging)
Returns:
When possible, struct mu_ent correctly set up

Bug:
Reports wrong bitrate/length with VBR files.

Todo:
VBR handling (Xing headers decoding).

Definition at line 273 of file playlist.c.

References mu_ent::album, mu_ent::artist, mu_ent::bitrate, mu_ent::date, mu_ent_names::filename, mu_ent::filetype, FT_MP3, mu_ent::genre, GENRE_MAX, INPUT_BUFFER_SIZE, mu_ent::length, MI_QUICKPL, mpg123_id3_genres, mpg123_mp3_ext_check(), new_ent(), mu_config::options, mu_ent::posn, mu_ent::size, mu_ent::title, mu_ent::track, and utf8_id3tag_findframe().

Referenced by make_music_entry().

mu_ent* make_music_entry apr_pool_t *  pool,
request_rec *  r,
mu_ent head,
mu_config conf,
mu_ent_names names
 

Add a file (and the content of the directory if requested) to the chain.

This function creates a new entry from a file. If the file is a directory and the recursive option is set, all its content is also added. If the file is an ogg vorbis or an mp3, it is simply added.

Parameters:
pool Pool
r Apache request_rec struct to handle log writings (debugging)
head Head
conf MusicIndex configuration paramaters struct
names Names

Todo:
Clear ent structure. Apache doesn't like the usual "free".
Returns:
When possible, struct mu_ent correctly set up

Definition at line 450 of file playlist.c.

References mu_ent::album, mu_ent::artist, CA_CREATE, cache_check_dir(), cache_check_file(), mu_config::cache_path, cache_read_file(), cache_write_file(), mu_ent::file, mu_ent_names::filename, mu_ent::filetype, FT_DIR, make_mp3_entry(), make_ogg_entry(), MAX_STRING, MI_PLAYLIST, MI_RECURSIVE, MI_SEARCH, mu_cache_data::name, new_ent(), mu_config::options, mu_config::play_recursive, mu_config::search, mu_ent::title, mu_ent_names::uri, and mu_ent::uri.

Referenced by musicindex_directory(), playlist_directory(), and playlist_selected().

mu_ent* make_ogg_entry apr_pool_t *  pool,
mu_ent head,
FILE *  in,
mu_config conf,
mu_ent_names names,
request_rec *  r
 

Fills in the information fields about OGG data.

This function reads the ogg tags (using libvorbisfile) from the ogg file and fills in the struct mu_ent fields accordingly. If the file is not an ogg one, the function returns p = head.

Parameters:
pool Pool
head Head
in ogg file to parse
conf MusicIndex configuration paramaters struct
names Names
r Apache request_rec struct to handle log writings (debugging)
Returns:
When possible, struct mu_ent correctly set up

Definition at line 211 of file playlist.c.

References mu_ent::album, mu_ent::artist, mu_ent::bitrate, mu_ent::date, mu_ent::filetype, FT_OGG, mu_ent::genre, mu_ent::length, MI_QUICKPL, new_ent(), mu_config::options, mu_ent::posn, mu_ent::title, and mu_ent::track.

Referenced by make_music_entry().

short mpg123_mp3_ext_check char *  filename  )  [static]
 

Checks for valid MP3 filename extension.

Parameters:
filename The filename to check.
Returns:
FALSE when the extension is correct, TRUE otherwise.

Definition at line 154 of file playlist.c.

Referenced by make_mp3_entry().

short musicindex_directory request_rec *  r,
mu_config conf
 

Generates and sends a webpage listing the music files in the directory.

Parameters:
r Apache request_rec struct
conf MusicIndex configuration parameters struct
Returns:
0 on success, error code otherwise.

Definition at line 592 of file playlist.c.

References make_music_entry(), MI_SEARCH, mu_config::options, quicksort(), send_directories(), send_foot(), send_head(), and send_tracks().

Referenced by handle_musicindex().

mu_ent* new_ent apr_pool_t *  pool,
mu_ent head
 

Creates a new musical entry (mp3, ogg or directory).

Parameters:
pool Apache pool linked to the current request
head music entry structure which will follow this one in the list
Returns:
A new mu_ent

Definition at line 46 of file playlist.c.

References mu_ent::next.

Referenced by cache_read_file(), make_mp3_entry(), make_music_entry(), and make_ogg_entry().

short playlist_directory request_rec *  r,
mu_config conf
 

Creates and sends a playlist with the content of a directory.

This function generates a playlist containing all the files in the current directory, either recursively or not.

Parameters:
r Apache request_rec struct
conf MusicIndex configuration paramaters struct
Returns:
0 on success, error code otherwise.

Definition at line 643 of file playlist.c.

References make_music_entry(), MI_PLAYLIST, mu_config::options, quicksort(), and send_playlist().

Referenced by handle_musicindex().

short playlist_selected request_rec *  r,
mu_config conf
 

Generates and sends a playlist with only selected items.

This function parses the requests, which is the form : http://...../?file=file1&file=file2&file=file3...

Note that in FORM requests, arguments have ' ' replaced by '+', other "special" characters are changed to their URI equivalent. Here is the trick : ap_unescape_url doesn't change the '+' to its URI equivalent. So we first change ' ' to '+' and then call the apache function. Easy, isn't it ?

Parameters:
r Apache request_rec struct
conf MusicIndex configuration paramaters struct
Returns:
0

Definition at line 691 of file playlist.c.

References mu_ent_names::filename, make_music_entry(), MAX_STRING, quicksort(), send_playlist(), and mu_ent_names::uri.

Referenced by handle_musicindex().

id3_utf8_t* utf8_id3tag_findframe struct id3_tag *  tag,
char const *  frameid,
unsigned short  index
[static]
 

Converts an id3tag string in utf8.

This function reads the id3tag from an MP3 file (if any) and converts the result in the utf8 standard format.

Warning:
Allocates memory. Don't forget to free().
Parameters:
tag The tag struct to parse
frameid The type of tag data searched
index The id3tag index value
Returns:
When possible, an utf8_t string, NULL otherwise.

Definition at line 176 of file playlist.c.

Referenced by make_mp3_entry().


Variable Documentation

const char* mpg123_id3_genres[GENRE_MAX]
 

Reference table for digit coded genres.

Definition at line 101 of file playlist.c.

Referenced by make_mp3_entry().


Generated on Thu Oct 30 13:50:29 2003 for mod_musicindex by doxygen 1.3.4