Removed requirement for detecting home directory; artwork fetcher relies on return from saveCurrentPlaylist now
--- 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);
--- 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
--- 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