mod_musicindex  1.4.1
html.h File Reference
#include "mod_musicindex.h"

Go to the source code of this file.

Macros

#define MAX_PREFIX   512
 Maximum expected size of the URL "prefix" (user@host stuff).

Functions

void send_head (request_rec *)
 Sends HTML page headers and top of the page.
void send_directories (request_rec *, const mu_pack *const)
 Sends directory listing for the current folder.
void send_tracks (request_rec *, const mu_pack *const)
 Sends track listing for the current folder.
void send_customlist (request_rec *, const mu_pack *const)
 Sends track listing for the current custom playlist.
void send_playlist (request_rec *, const mu_pack *const)
 Sends playlist with url and EXTM3U info to the client.
void send_rss (request_rec *, const mu_pack *const)
 Sends RSS feed.
void send_randomdir (request_rec *)
 Sends a random directory location.
void send_foot (request_rec *, const STRUCTTV *, const STRUCTTV *)
 Sends HTML page footers.

Macro Definition Documentation

#define MAX_PREFIX   512

Maximum expected size of the URL "prefix" (user@host stuff).

Definition at line 22 of file html.h.

Referenced by send_url().

Function Documentation

void send_customlist ( request_rec *  r,
const mu_pack *const  pack 
)

Sends track listing for the current custom playlist.

This function takes care of preparing and sending to the client the list (if any) of the available songs in the current custom pack list, retrieved from a cookie. Depending on config options, it allows streaming/shuffle etc.

Warning
Even though the buttons are here (Download All, Stream All...), custom playlists will always respect individual files permissions, meaning that one can end up with an empty playlist or tarball even though the list itself isn't empty.
Parameters
rApache request_rec struct to handle connection details.
packA pack of music entries.

Definition at line 873 of file html.c.

References _, mu_pack::fhead, mu_pack::filenb, and list_songs().

Referenced by handle_musicindex().

void send_directories ( request_rec *  r,
const mu_pack *const  pack 
)

Sends directory listing for the current folder.

This function takes care of preparing and sending to the client the list (if any) of the available directories in the current folder. Depending on config options, it allows streaming/shuffle etc.

Remarks
I tried moving to purely semantic coding (using either div or li, none worked. It seems CSS/browsers can't render properly a list of element of fixed width but variable height in a variable "columns" context: if an element has a greater height than the one immediately after on the same "row", then the next row will start at the right of this longer element instead of starting back at the left of the page.
Parameters
rApache request_rec struct to handle connection details.
packA pack of music entries.

Definition at line 713 of file html.c.

References _, mu_config::dir_per_line, mu_pack::dirnb, EF_ALLOWRSS, EF_ALLOWSTREAM, EF_ALLOWTARBALL, mu_ent::file, mu_ent::filetype, mu_ent::flags, mu_pack::head, musicindex_module, mu_ent::next, and mu_ent::title.

Referenced by handle_musicindex().

void send_foot ( request_rec *  r,
const STRUCTTV tvbegin,
const STRUCTTV tvprocess 
)

Sends HTML page footers.

This function takes care of the formating of the HTML page footers. It sends the data that is common to all pages generated by the handler.

Parameters
rApache request_rec struct to handle connection details.
tvbeginwhen available, a timeval struct containing timing info for the beginning of the page generation.
tvprocesswhen available a timeval struct containing end of processing time

< Version string

< Version string

Definition at line 1143 of file html.c.

References _, ap_sub_req_lookup_uri, apr_pstrcat, mu_config::directory, MUSIC_AUTHORS_STRING, MUSIC_VERSION_STRING, and musicindex_module.

Referenced by handle_musicindex().

void send_head ( request_rec *  r)

Sends HTML page headers and top of the page.

This function takes care of the formating of the HTML page headers. It sends the data that is common to all pages generated by the handler.

Parameters
rApache request_rec struct to handle connection details.
Bug:
When we'll allow mu_config->directory to be modified, have to escape html/uri.

Definition at line 482 of file html.c.

References _, ap_sub_req_lookup_uri, apr_pstrcat, apr_pstrdup, mu_config::css, mu_config::directory, Gcd_icon, Gcovericns, Gfavicon, Gorigcss, MI_ACTIVE, MI_ALLOWSEARCH, MI_ALLOWSTREAM, MI_ALLOWTARBALL, MUSIC_HEADER_STRING, musicindex_module, mu_config::options, mu_config::rss_items, and mu_config::title.

Referenced by handle_musicindex().

void send_playlist ( request_rec *  r,
const mu_pack *const  pack 
)

Sends playlist with url and EXTM3U info to the client.

This function prepares an m3u playlist (with extra information where available: length, artist, title, album) and sends it to the client.

Parameters
rApache request_rec struct to handle connection details.
packA pack of music entries.

Definition at line 918 of file html.c.

References mu_ent::album, mu_ent::artist, EF_ALLOWSTREAM, mu_pack::fhead, mu_ent::flags, mu_ent::length, mu_ent::next, send_url(), mu_ent::title, and mu_ent::uri.

Referenced by handle_musicfile(), and handle_musicindex().

void send_randomdir ( request_rec *  r)

Sends a random directory location.

This function constructs a new URL relative to the current directory, corresponding to a random subdirectory. It might stop at an arbitrary sublevel, even at the current dir.

XXX A better (or at least different) implementation would only accounts for actual folders, and setup a random threshold level at which the function stops recursing.

Bug:
A forseable bug is that this function can send you to a directory which access may be denied by .htaccess
Parameters
rApache request_rec struct to handle connection details.

Definition at line 1067 of file html.c.

References ap_is_directory, apr_pstrcat, apr_pstrdup, and apr_table_setn.

Referenced by handle_musicindex().

void send_rss ( request_rec *  r,
const mu_pack *const  pack 
)

Sends RSS feed.

see http://blogs.law.harvard.edu/tech/rss and http://feedvalidator.org/docs/rss2.html

Parameters
rApache request_rec struct to handle connection details.
packA pack of music entries.

Definition at line 953 of file html.c.

References _, EF_VBR, mu_pack::fhead, filetype, FT_MAX, MI_ALLOWDWNLD, MI_ALLOWSTREAM, MI_PODCAST, ftype::mimetype, MUSIC_HEADER_STRING, musicindex_module, ftype::nametype, mu_ent::next, mu_config::options, mu_config::rss_items, and send_url().

Referenced by handle_musicindex().

void send_tracks ( request_rec *  r,
const mu_pack *const  pack 
)

Sends track listing for the current folder.

This function takes care of preparing and sending to the client the list (if any) of the available songs in the current pack list. Depending on config options, it allows streaming/shuffle etc.

Parameters
rApache request_rec struct to handle connection details.
packA pack of music entries.

Definition at line 794 of file html.c.

References _, mu_pack::filenb, list_songs(), MI_ALLOWSTREAM, MI_ALLOWTARBALL, musicindex_module, mu_config::options, mu_config::order, SB_MAX, and mu_config::search.

Referenced by handle_musicindex().