cooldown logging
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 6 Jun 2019 13:07:35 +0000 (15:07 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 6 Jun 2019 13:07:35 +0000 (15:07 +0200)
cooldown logging
no need to convert to 64 bit floating point as sox handle this automagically

music_assistant/modules/http_streamer.py
music_assistant/modules/web.py

index 0ded2873556643623947243e5a60d00b9ec76b63..6a2411117ddb5bec7a81165a67b72e1208168500 100755 (executable)
@@ -252,14 +252,14 @@ class HTTPStreamer():
         if os.path.isfile(cachefile):
             # we have a cache file for this track which we can use
             # always convert to 64 bit floating point to do any processing/effects
-            args = 'sox -t flac "%s" -t wav -c 2 -e floating-point -b 64 - | sox -t wav - -t raw %s vol %s dB rate -v %s' % (cachefile, temp_audiofile.name, gain_correct, sample_rate)
+            args = 'sox -V3 -t flac "%s" -t wav -c 2 -e floating-point -b 64 - | sox -V3 -t wav - -t raw %s vol %s dB rate -v %s' % (cachefile, temp_audiofile.name, gain_correct, sample_rate)
             process = await asyncio.create_subprocess_shell(args)
         else:
             # stream from provider
             # always convert to 64 bit floating point to do any processing/effects
             input_content_type = await self.mass.music.providers[provider].get_stream_content_type(track_id)
             assert(input_content_type)
-            args = 'sox -t %s - -t wav -c 2 -e floating-point -b 64 - | sox -t wav - -t raw %s vol %s dB rate -v %s' % (input_content_type, temp_audiofile.name, gain_correct, sample_rate)
+            args = 'sox -V3 -t %s - -t wav -c 2 -e floating-point -b 64 - | sox -V3 -t wav - -t raw %s vol %s dB rate -v %s' % (input_content_type, temp_audiofile.name, gain_correct, sample_rate)
             process = await asyncio.create_subprocess_shell(args,
                     stdin=asyncio.subprocess.PIPE)
             asyncio.get_event_loop().create_task(
@@ -278,11 +278,10 @@ class HTTPStreamer():
         if os.path.isfile(cachefile):
             # we have a cache file for this track which we can use
             if sox_effects.strip():
-                # always convert to 64 bit floating point to do any processing/effects
-                args = 'sox -t flac "%s" -t wav -b 64 -e floating-point - | sox -t wav - -t flac -C 2 - %s' % (cachefile, sox_effects)
+                args = 'sox -V3 -t flac "%s" -t flac -C 0 - %s' % (cachefile, sox_effects)
             else:
-                args = 'sox -t flac "%s" -t flac -C 2 - %s' % cachefile
-            LOGGER.info("Running sox with args: %s" % args)
+                args = 'sox -t flac "%s" -t flac -C 0 - %s' % cachefile
+            LOGGER.debug("Running sox with args: %s" % args)
             process = await asyncio.create_subprocess_shell(args, 
                     stdout=asyncio.subprocess.PIPE)
             buffer_task = None
@@ -291,11 +290,10 @@ class HTTPStreamer():
             input_content_type = await self.mass.music.providers[provider].get_stream_content_type(track_id)
             assert(input_content_type)
             if sox_effects.strip():
-                # always convert to 64 bit floating point to do any processing/effects
-                args = 'sox -t %s - -t wav -b 64 -e floating-point - | sox -t wav - -t flac -C 2 - %s' % (input_content_type, sox_effects)
+                args = 'sox -V3 -t %s - -t flac -C 0 - %s' % (input_content_type, sox_effects)
             else:
                 args = 'sox -t %s - -t flac -C 0 -' % (input_content_type)
-            LOGGER.info("Running sox with args: %s" % args)
+            LOGGER.debug("Running sox with args: %s" % args)
             process = await asyncio.create_subprocess_shell(args,
                     stdout=asyncio.subprocess.PIPE, stdin=asyncio.subprocess.PIPE)
             buffer_task = asyncio.get_event_loop().create_task(
@@ -312,9 +310,9 @@ class HTTPStreamer():
         await process.wait()
         await audioqueue.put('') # indicate EOF
         if cancelled.is_set():
-            LOGGER.info("__get_audio_stream for track_id %s interrupted" % track_id)
+            LOGGER.warning("__get_audio_stream for track_id %s interrupted" % track_id)
         else:
-            LOGGER.info("__get_audio_stream for track_id %s completed" % track_id)
+            LOGGER.debug("__get_audio_stream for track_id %s completed" % track_id)
 
     async def __get_player_sox_options(self, track_id, provider, player_id, is_radio):
         ''' get player specific sox options '''
index 8db5d85ace96db2210fde4c98743def3e0e99b3b..5d001c3e00994437b1ff9eb4e467d3c4a71d2c59 100755 (executable)
@@ -90,7 +90,7 @@ class Web():
         app.add_routes([web.get('/api/{media_type}/{media_id}', self.get_item)])
         app.add_routes([web.get('/', self.index)])
         app.router.add_static("/", "./web")  
-        self.runner = web.AppRunner(app)
+        self.runner = web.AppRunner(app, access_log=None)
         await self.runner.setup()
         http_site = web.TCPSite(self.runner, '0.0.0.0', self._http_port)
         await http_site.start()