# HG changeset patch # User Dan # Date 1218857497 14400 # Node ID 3b4aef1efff6270a5144de1693174a5bb33789c3 # Parent 86140ed9087d5339400682c866aa3c9b59a8b68c Removed requirement for detecting home directory; artwork fetcher relies on return from saveCurrentPlaylist now diff -r 86140ed9087d -r 3b4aef1efff6 functions.php --- a/functions.php Fri Aug 15 23:22:30 2008 -0400 +++ b/functions.php Fri Aug 15 23:31:37 2008 -0400 @@ -94,9 +94,12 @@ function rebuild_playlist() { // import what we need - global $homedir, $playlist; + global $playlist, $amarok_home; // sync and load the playlist file $playlist_file = dcop_action('playlist', 'saveCurrentPlaylist'); + // do we have amarok's home? + if ( !$amarok_home ) + $amarok_home = dirname($playlist_file); // check MD5 - if it's not changed, exit to save CPU cycles global $playlist_last_md5; $effective_md5 = md5_playlist_file($playlist_file); diff -r 86140ed9087d -r 3b4aef1efff6 greyhound.php --- a/greyhound.php Fri Aug 15 23:22:30 2008 -0400 +++ b/greyhound.php Fri Aug 15 23:31:37 2008 -0400 @@ -66,7 +66,7 @@ // start up... -status('Starting Greyhound Web Control v0.1a1'); +status('Starting Greyhound Web Control v0.1a3'); status('loading files'); require('webserver.php'); @@ -77,17 +77,6 @@ require(GREY_ROOT . '/ajax.php'); require(GREY_ROOT . '/imagetools.php'); -status('doing home directory detection'); - -// get home directory - -if ( !isset($_ENV['HOME']) ) -{ - burnout('Could not get your home directory'); -} - -$homedir =& $_ENV['HOME']; - // signal handler function sigterm($signal) { @@ -100,6 +89,7 @@ // init playlist object $playlist = array(); +$amarok_home = false; rebuild_playlist(); // startup webserver diff -r 86140ed9087d -r 3b4aef1efff6 playlist.php --- a/playlist.php Fri Aug 15 23:22:30 2008 -0400 +++ b/playlist.php Fri Aug 15 23:31:37 2008 -0400 @@ -66,7 +66,7 @@ function artwork_request_handler($httpd, $socket) { - global $homedir; + global $amarok_home; if ( !isset($_GET['artist']) || !isset($_GET['album']) ) { @@ -75,7 +75,7 @@ } // get hash $artwork_hash = md5( strtolower(trim($_GET['artist'])) . strtolower(trim($_GET['album'])) ); - $artwork_dir = "$homedir/.kde/share/apps/amarok/albumcovers"; + $artwork_dir = "$amarok_home/albumcovers"; if ( file_exists("$artwork_dir/large/$artwork_hash") ) { // artwork file found - scale and convert to PNG