--- a/greyhound.php Fri Aug 15 23:31:37 2008 -0400
+++ b/greyhound.php Fri Aug 15 23:49:00 2008 -0400
@@ -37,7 +37,7 @@
// set this to false, it will only display the playlist.
$allowcontrol = true;
// The default theme. This should be a name of a directory in ./themes.
-$theme = 'funkymonkey';
+$theme = 'grey';
// Allow forking when an HTTP request is received. This has advantages
// and disadvantages. If this experimental option is enabled, it will
// result in faster responses and load times but more memory usage.
@@ -64,6 +64,9 @@
// create directories
@mkdir('./compiled');
+// what kind of terminal do we have?
+$use_colors = ( @in_array(@$_SERVER['TERM'], array('linux', 'xterm', 'vt100')) ) ? true : false;
+
// start up...
status('Starting Greyhound Web Control v0.1a3');
@@ -85,6 +88,18 @@
exit(0);
}
+status('doing PHP capabilities check');
+if ( !function_exists('pcntl_signal') )
+{
+ warning('System does not support POSIX functions. Termination signals will result in unclean shutdown.');
+}
+
+if ( !function_exists('simplexml_load_file') )
+{
+ warning('Can\'t find support for SimpleXML, which is needed to parse the Amarok playlist file.');
+ burnout('SimpleXML required to continue. You may have an outdated version of PHP; most versions of PHP 5 have SimpleXML built-in. Check your distribution\'s documentation to find out how to enable PHP\'s SimpleXML support.');
+}
+
status('initializing playlist');
// init playlist object
@@ -99,11 +114,6 @@
try
{
status('starting PhpHttpd');
- status('doing PHP capabilities check');
- if ( !function_exists('pcntl_signal') )
- {
- warning('System does not support POSIX functions. Termination signals will result in unclean shutdown.');
- }
$httpd = new WebServer($ip, $port);
// setup handlers
@@ -143,6 +153,10 @@
}
catch( Exception $e )
{
+ if ( strstr(strval($e), "Could not bind") )
+ {
+ burnout("Could not bind to the port $ip:$port. Is Greyhound already running? Sometimes browsers don't close off their connections until Greyhound has been dead for about a minute, so try starting Greyhound again in roughly 60 seconds. If that doesn't work, type \"killall -9 php\" at a terminal and try starting Greyhound again in 60 seconds.");
+ }
burnout("Exception caught while running webserver:\n$e");
}