Last active
February 8, 2021 23:10
-
-
Save martip07/f5bcbaad950a531a9ab7c2adb5094d97 to your computer and use it in GitHub Desktop.
monit-proc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_regexVolume(out_value): | |
for volume_i in out_value: | |
if "mean_volume" in volume_i: | |
print(volume_i) | |
return volume_i | |
def ffmpeg_checkaudio(station, audio_uri): | |
cmd = ["ffmpeg", "-t", "10", "-i", audio_uri, "-af", "'volumedetect'", "-f", 'null', "\/dev\/null"] | |
try: | |
monitor_exec = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | |
out = str(monitor_exec).split("\\n") | |
#out_data = out[38].split(" ") | |
new_volume_arr = check_regexVolume(out) | |
out_data = new_volume_arr.split(" ") | |
out_value = out_data[4] | |
print(out_value) | |
#return out_value | |
#out_value = str(-60) | |
check_data = check_volume(station, out_value) | |
return check_data | |
except IOError as proc_error: | |
print(proc_error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment