[fix] fix missing content before inserting

This commit is contained in:
alban 2020-11-10 19:44:42 +01:00
parent fbb9ee57d8
commit fcd15ef0ea

View File

@ -1,3 +1,4 @@
#! /usr/bin/python2.7
""" """
Sends live audio analysis to the terminal. Sends live audio analysis to the terminal.
@ -227,9 +228,9 @@ def m_spectrum(audio_data):
#debug( 'spectrum_120:{} '.format(spectrum_120)) #debug( 'spectrum_120:{} '.format(spectrum_120))
#debug( 'spectrum_10:{}'.format(spectrum_10)) #debug( 'spectrum_10:{}'.format(spectrum_10))
#debug( 'rms:{}'.format(rms_avg)) #debug( 'rms:{}'.format(rms_avg))
r.set( 'spectrum_120', json.dumps( spectrum_120 ) ) if len(spectrum_120): r.set( 'spectrum_120', json.dumps( spectrum_120 ) )
r.set( 'spectrum_10', json.dumps( spectrum_10 ) ) if len(spectrum_10): r.set( 'spectrum_10', json.dumps( spectrum_10 ) )
r.set( 'rms', "{}".format(rms_avg) ) if rms : r.set( 'rms', "{}".format(rms_avg) )
return True return True