Add a config parameter for the home folder of the web server user
This commit is contained in:
		
							parent
							
								
									127b8b32f4
								
							
						
					
					
						commit
						c63ddd8e3e
					
				| 
						 | 
					@ -1,3 +1,10 @@
 | 
				
			||||||
# HomeAudio
 | 
					# HomeAudio
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A PHP and PERL based "jukebox style" home audio system for Linux.
 | 
					A PHP and PERL based "jukebox style" home audio system for Linux.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* The **homeaudio.ini** file from the **/scripts/** folder needs to be edited and saved in **/etc/**. Make sure it is ONLY readable by the web server user.
 | 
				
			||||||
 | 
					* The [getID3](https://github.com/JamesHeinrich/getID3) project needs to be added somewhere in a folder included by PHP.
 | 
				
			||||||
 | 
					* The **tables.sql** file needs to be imported into the database referenced in the **homeaudio.ini** file.
 | 
				
			||||||
 | 
					* The **art/** folder needs to be writable by the web server user.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ $query = "SELECT songid FROM " . RECENTSTABLE . " ORDER BY timeplayed DESC limit
 | 
				
			||||||
$sth = $globaldbh->prepare($query);
 | 
					$sth = $globaldbh->prepare($query);
 | 
				
			||||||
$sth->execute();
 | 
					$sth->execute();
 | 
				
			||||||
$data['volume'] = getSystemVolume();
 | 
					$data['volume'] = getSystemVolume();
 | 
				
			||||||
system("HOME=/home/web && scripts/homeaudio_togglemute.pl -show", $retval);
 | 
					system("HOME=" . WEBUSERHOMEDIR . " && scripts/homeaudio_togglemute.pl -show", $retval);
 | 
				
			||||||
$data['muted'] = ($retval == 0) ? false : true;
 | 
					$data['muted'] = ($retval == 0) ? false : true;
 | 
				
			||||||
$data['songplaying'] = "";
 | 
					$data['songplaying'] = "";
 | 
				
			||||||
$data['songlist'] = "";
 | 
					$data['songlist'] = "";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ( isset($_REQUEST['show']) && ($_REQUEST['show'] == 'show') ) {
 | 
					if ( isset($_REQUEST['show']) && ($_REQUEST['show'] == 'show') ) {
 | 
				
			||||||
   system("HOME=/home/web && scripts/homeaudio_togglemute.pl -show", $retval);
 | 
					   system("HOME=" . WEBUSERHOMEDIR . " && scripts/homeaudio_togglemute.pl -show", $retval);
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
   system("HOME=/home/web && scripts/homeaudio_togglemute.pl", $retval);
 | 
					   system("HOME=" . WEBUSERHOMEDIR . " && scripts/homeaudio_togglemute.pl", $retval);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$data = array();
 | 
					$data = array();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +1,14 @@
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Database configuration
 | 
				
			||||||
define('DBHOST', 'localhost');
 | 
					define('DBHOST', 'localhost');
 | 
				
			||||||
define('DBUSER', 'root');
 | 
					define('DBUSER', 'root');
 | 
				
			||||||
define('DBPASS', '');
 | 
					define('DBPASS', '');
 | 
				
			||||||
define('DBNAME', 'musicnew');
 | 
					define('DBNAME', 'musicnew');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define('ENABLELEDBUTTONS', false);
 | 
					// How many songs to queue into the jukebox when "Surpise Me" is clicked
 | 
				
			||||||
 | 
					 | 
				
			||||||
define('SONGSPERSURPRISE', 10);
 | 
					define('SONGSPERSURPRISE', 10);
 | 
				
			||||||
 | 
					// How many songs to return when searching
 | 
				
			||||||
define('SEARCHLIMIT', 50);
 | 
					define('SEARCHLIMIT', 50);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LOCALNETWORK can be a partial (for a subnet) or a full IP address.
 | 
					// LOCALNETWORK can be a partial (for a subnet) or a full IP address.
 | 
				
			||||||
| 
						 | 
					@ -16,6 +17,18 @@ define('SEARCHLIMIT', 50);
 | 
				
			||||||
define('LOCALNETWORK', '192.168.1.');
 | 
					define('LOCALNETWORK', '192.168.1.');
 | 
				
			||||||
define('RESTRICTQUEUES', false);
 | 
					define('RESTRICTQUEUES', false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// The min and max volumes used for system audio. This will likely
 | 
				
			||||||
 | 
					// require a bit of tweaking for each system and amplifier configuration.
 | 
				
			||||||
 | 
					define('MAXVOLUME', 28);
 | 
				
			||||||
 | 
					define('MINVOLUME', 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Home directory for the user that runs the web server process.
 | 
				
			||||||
 | 
					// Modern Linux systems typically use PulseAudio which needs files
 | 
				
			||||||
 | 
					// from a user's home directory to properly control audio settings.
 | 
				
			||||||
 | 
					// This may require changing the shell and/or login permissions for
 | 
				
			||||||
 | 
					// the user that runs the web server process. Your mileage may vary.
 | 
				
			||||||
 | 
					define('WEBUSERHOMEDIR', '/home/web');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ---------------------- Below here be dragons ---------------------- */
 | 
					/* ---------------------- Below here be dragons ---------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define('ALBUMSTABLE', 'albums');
 | 
					define('ALBUMSTABLE', 'albums');
 | 
				
			||||||
| 
						 | 
					@ -25,8 +38,3 @@ define('RECENTSTABLE', 'recently');
 | 
				
			||||||
define('SONGSTABLE', 'songs');
 | 
					define('SONGSTABLE', 'songs');
 | 
				
			||||||
define('QUEUECONTENTSTABLE', 'queuecontents');
 | 
					define('QUEUECONTENTSTABLE', 'queuecontents');
 | 
				
			||||||
define('SETTINGSTABLE', 'settings');
 | 
					define('SETTINGSTABLE', 'settings');
 | 
				
			||||||
 | 
					 | 
				
			||||||
define('MAXVOLUME', 28);
 | 
					 | 
				
			||||||
define('MINVOLUME', 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ function setSystemVolume($newvol = null) {
 | 
				
			||||||
   global $globaldbh;
 | 
					   global $globaldbh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if ( is_null($newvol) ) return false;
 | 
					   if ( is_null($newvol) ) return false;
 | 
				
			||||||
   system("HOME=/home/web && /usr/bin/amixer -q sset Master " . $newvol);
 | 
					   system("HOME=" . WEBUSERHOMEDIR . " && /usr/bin/amixer -q sset Master " . $newvol);
 | 
				
			||||||
   $query = "UPDATE " . SETTINGSTABLE . " SET value=:value WHERE parameter='CURVOLUME'";
 | 
					   $query = "UPDATE " . SETTINGSTABLE . " SET value=:value WHERE parameter='CURVOLUME'";
 | 
				
			||||||
   $fields = array();
 | 
					   $fields = array();
 | 
				
			||||||
   $fields[':value'] = $newvol;
 | 
					   $fields[':value'] = $newvol;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@ require 'functions.php';
 | 
				
			||||||
echo "<pre>";
 | 
					echo "<pre>";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//$curvol = getSystemVolume();
 | 
					//$curvol = getSystemVolume();
 | 
				
			||||||
$curvol = shell_exec("HOME=/home/web && amixer sget Master");
 | 
					$curvol = shell_exec("HOME=" . WEBUSERHOMEDIR . " && amixer sget Master");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Current Volume: '", $curvol, "'\n";
 | 
					echo "Current Volume: '", $curvol, "'\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user