diff -r 000000000000 -r c63de9eb7045 webcontrol.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webcontrol.php Sun Mar 23 14:59:33 2008 -0400 @@ -0,0 +1,78 @@ +template_dir = "./themes/$theme"; +$smarty->compile_dir = "./themes/$theme/compiled"; +$smarty->cache_dir = "./cache"; +$smarty->config_dir = "./config"; + +status('doing home directory detection'); + +// get home directory + +if ( !isset($_ENV['HOME']) ) +{ + burnout('Could not get your home directory'); +} + +$homedir =& $_ENV['HOME']; + +status('initializing playlist'); + +// init playlist object +$playlist = array(); +rebuild_playlist(); + +// startup webserver +$ip = ( $public ) ? '0.0.0.0' : '127.0.0.1'; +$port = mt_rand(1025, 65534); // 7447; + +try +{ + status('starting PhpHttpd'); + $httpd = new WebServer($ip, $port); + + // setup handlers + status('initializing handlers'); + $httpd->add_handler('index', 'function', 'amarok_playlist'); + $httpd->add_handler('scripts', 'dir', './scripts'); + $httpd->add_handler("themes/$theme", 'dir', "./themes/$theme"); + $httpd->allow_dir_list = true; + $httpd->default_document = 'index'; + + status("Entering main server loop - ^C to interrupt, listening on port $port"); + $httpd->serve(); +} +catch( Exception $e ) +{ + burnout("Exception caught while running webserver:\n$e"); +} +