Net_CDDB
[ class tree: Net_CDDB ] [ index: Net_CDDB ] [ all elements ]

File: CDDB_server_example.php

Source Location: /Net_CDDB-0.3.0/docs/examples/CDDB_server_example.php

Classes:

Page Details:

Example file showing Net_CDDB_Server usage

Includes:

require('Net/CDDB/Server.php') [line 12]

my_custom_command_hook [line 88]

array my_custom_command_hook( &$str_cddb_cmd, string $str_cddb_cmd)

This custom hook allows a local CDDB server to act as caching proxy for a

remote CDDB server. So, you're running a local CDDB server, proxying all requests to a remote FreeDB.org server. But, everytime a 'cddb read' command is issued, instead of just going directly to FreeDB.org, you can use this custom hook to first check if you have a locally cached copy of the record on disk already. If you do, return that one. Otherwise, fetch it from the FreeDB.org server and return that one.

This hook only implements the check for a local cache, it doesn't actually cache anything it downloads from the remote CDDB server it's proxying. You could implement a second hook, a custom response hook, to save a cached copy of anything you download from a remote site.

Special thanks to Michael Bushey (http://www.sendthemtomir.com/) for this idea and for getting me to think about the addition of custom server hooks.



Parameters

string   $str_cddb_cmd  
   &$str_cddb_cmd  
[ Top ]



my_custom_response_hook [line 133]

void my_custom_response_hook( string $str_cddb_cmd, &$int_cddb_response_status, &$str_cddb_response_message, &$str_cddb_response_data, &$bln_add_a_terminating_character, string $str_cddb_response_status, string $str_cddb_response_message, string $str_cddb_response_data, boolean $bln_add_a_terminating_character)

This custom hook examines track, title, and artist names for words like: The, They, It, And, An, etc. which are in propercase, and transforms them to lowercase words such as the, they, it, and, an, etc.

Special thanks to Michael Bushey (http://www.sendthemtomir.com/) for the idea for his (slightly modified) code below and for getting me to think about the addition of custom server hooks.



Parameters

string   $str_cddb_cmd  
string   $str_cddb_response_status  
string   $str_cddb_response_message  
string   $str_cddb_response_data  
boolean   $bln_add_a_terminating_character  
   &$int_cddb_response_status  
   &$str_cddb_response_message  
   &$str_cddb_response_data  
   &$bln_add_a_terminating_character  
[ Top ]



Documentation generated on Sun, 25 Feb 2007 14:00:11 -0500 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.