diff --git a/configuration.default.ini b/configuration.default.ini
index eb6f42a..ff15036 100644
--- a/configuration.default.ini
+++ b/configuration.default.ini
@@ -105,6 +105,7 @@ password =
[debug]
# Set ffmpeg to True if you want to display DEBUG level log of ffmpeg.
ffmpeg = False
+redirect_ffmpeg_log = True
mumbleConnection = False
# This is a list of default radio stations.
diff --git a/interface.py b/interface.py
index 4693884..93a8d3d 100644
--- a/interface.py
+++ b/interface.py
@@ -236,6 +236,7 @@ def status():
'play': not var.bot.is_pause,
'mode': var.playlist.mode,
'volume': var.bot.volume_set})
+
else:
return jsonify({'ver': var.playlist.version,
'current_index': var.playlist.current_index,
@@ -412,6 +413,7 @@ def post():
else:
# value for new volume is between 0 and 1, round to two decimal digits
var.bot.volume_set = round(float(request.form['new_volume']), 2)
+
var.db.set('bot', 'volume', str(var.bot.volume_set))
log.info("web: volume set to %d" % (var.bot.volume_set * 100))
diff --git a/mumbleBot.py b/mumbleBot.py
index b71d914..cf89acd 100644
--- a/mumbleBot.py
+++ b/mumbleBot.py
@@ -30,7 +30,7 @@ from media.cache import MusicCache
class MumbleBot:
- version = '6.1.1'
+ version = '6.1.2'
def __init__(self, args):
self.log = logging.getLogger("bot")
@@ -162,6 +162,8 @@ class MumbleBot:
self._display_rms = False
self._max_rms = 0
+ self.redirect_ffmpeg_log = var.config.getboolean('debug', 'redirect_ffmpeg_log', fallback=True)
+
# Set the CTRL+C shortcut
def ctrl_caught(self, signal, frame):
@@ -375,9 +377,12 @@ class MumbleBot:
# The ffmpeg process is a thread
# prepare pipe for catching stderr of ffmpeg
- pipe_rd, pipe_wd = os.pipe()
- util.pipe_no_wait(pipe_rd) # Let the pipe work in non-blocking mode
- self.thread_stderr = os.fdopen(pipe_rd)
+ if self.redirect_ffmpeg_log:
+ pipe_rd, pipe_wd = util.pipe_no_wait() # Let the pipe work in non-blocking mode
+ self.thread_stderr = os.fdopen(pipe_rd)
+ else:
+ pipe_rd, pipe_wd = None, None
+
self.thread = sp.Popen(command, stdout=sp.PIPE, stderr=pipe_wd, bufsize=480)
self.is_pause = False
self.read_pcm_size = 0
@@ -449,12 +454,13 @@ class MumbleBot:
raw_music = self.thread.stdout.read(480)
self.read_pcm_size += 480
- try:
- self.last_ffmpeg_err = self.thread_stderr.readline()
- if self.last_ffmpeg_err:
- self.log.debug("ffmpeg: " + self.last_ffmpeg_err.strip("\n"))
- except:
- pass
+ if self.redirect_ffmpeg_log:
+ try:
+ self.last_ffmpeg_err = self.thread_stderr.readline()
+ if self.last_ffmpeg_err:
+ self.log.debug("ffmpeg: " + self.last_ffmpeg_err.strip("\n"))
+ except:
+ pass
if raw_music:
# Adjust the volume and send it to mumble
@@ -623,9 +629,12 @@ class MumbleBot:
self.log.info("bot: execute ffmpeg command: " + " ".join(command))
# The ffmpeg process is a thread
# prepare pipe for catching stderr of ffmpeg
- pipe_rd, pipe_wd = os.pipe()
- util.pipe_no_wait(pipe_rd) # Let the pipe work in non-blocking mode
- self.thread_stderr = os.fdopen(pipe_rd)
+ if self.redirect_ffmpeg_log:
+ pipe_rd, pipe_wd = util.pipe_no_wait() # Let the pipe work in non-blocking mode
+ self.thread_stderr = os.fdopen(pipe_rd)
+ else:
+ pipe_rd, pipe_wd = None, None
+
self.thread = sp.Popen(command, stdout=sp.PIPE, stderr=pipe_wd, bufsize=480)
self.last_volume_cycle_time = time.time()
self.pause_at_id = ""
diff --git a/templates/index.html b/templates/index.html
index c85aa76..4925416 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -72,6 +72,7 @@
+