summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 12:59:02 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-28 22:00:08 -0500
commit3010ae8c85fe8cb656c9e96a95d0efee0fb2126a (patch)
treeaaef61855b1b4244da57f6a23b0a56ed92ff056f
parent75b2af2464c168525d207e2c4b2d20ea4e1719d0 (diff)
downloadampache-3010ae8c85fe8cb656c9e96a95d0efee0fb2126a.tar.gz
ampache-3010ae8c85fe8cb656c9e96a95d0efee0fb2126a.tar.bz2
ampache-3010ae8c85fe8cb656c9e96a95d0efee0fb2126a.zip
Log stderr when we transcode
Now you shouldn't need to manually run the command to see what went wrong.
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/stream.class.php12
-rw-r--r--lib/log.lib.php5
-rw-r--r--play/index.php6
4 files changed, 21 insertions, 3 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index fc228610..7795dd27 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.6-FUTURE
+ - stderr from the transcode command is now logged for debugging
- Made database updates more robust and verified that a fresh 3.3.3.5 import
will run through the updates without errors
- Added support for external authenticators like pwauth (based on a patch by
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 35d4eb64..c21f5823 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -135,8 +135,18 @@ class Stream {
debug_event('downsample', "Downsample command: $command", 3);
+ $process = proc_open(
+ $command,
+ array(
+ 1 => array('pipe', 'w'),
+ 2 => array('pipe', 'w')
+ ),
+ $pipes
+ );
return array(
- 'handle' => popen($command, 'rb'),
+ 'process' => $process,
+ 'handle' => $pipes[1],
+ 'stderr' => $pipes[2],
'format' => $transcode_settings['format']
);
diff --git a/lib/log.lib.php b/lib/log.lib.php
index 19aad964..6f9df914 100644
--- a/lib/log.lib.php
+++ b/lib/log.lib.php
@@ -134,7 +134,10 @@ function debug_event($type, $message, $level, $file = '', $username = '') {
$username = $GLOBALS['user']->username;
}
- log_event($username, $type, $message, $file);
+ // If the message is multiple lines, make multiple log lines
+ foreach (explode("\n", $message) as $line) {
+ log_event($username, $type, $line, $file);
+ }
} // debug_event
diff --git a/play/index.php b/play/index.php
index a6638e0c..238e963f 100644
--- a/play/index.php
+++ b/play/index.php
@@ -462,7 +462,11 @@ else {
if ($demo_id) { $democratic->delete_from_oid($oid,'song'); }
if ($transcode) {
- pclose($fp);
+ $stderr = fread($transcoder['stderr'], 8192);
+ fclose($transcoder['stderr']);
+ fclose($fp);
+ proc_close($transcoder['process']);
+ debug_event('transcode_cmd', $stderr, 5);
}
else {
fclose($fp);