Add set_up_threshold in generate_demuxer.py.

This commit is contained in:
Jarosław Wieczorek 2021-01-18 12:14:23 +01:00
parent b5f57bf4c6
commit e164389424
2 changed files with 20 additions and 0 deletions

View File

@ -8,34 +8,51 @@ inertia_s = 0.3
inertia_samples = inertia_s * graph_density
def set_up_threshold(new_value: int):
"""Setup threshold value"""
global threshold_at_point
if new_value > 0 and isinstance(new_value, int):
threshold_at_point = int(new_value)
return True
else:
return False
def s(n: int):
"""Frame conversions"""
global graph_density
return n / graph_density
def seconds(units: int):
"""Return seconds."""
return math.floor(s(units) % 60)
def minutes(units: int):
"""Return minutes."""
return math.floor(s(units) / 60)
def hours(units: int):
"""Return hours."""
return math.floor(s(units) / 60 / 60)
def formatTime(units: int):
"""Format time HH:MM:SS."""
return f"{hours(units)}:{minutes(units)}:{seconds(units)}"
def new_mode(m, s):
"""Set new node"""
data = m
data[s['label']] = s['loud']
return data
def mode_to_string(mode):
"""Convert mode type to string"""
if mode['left'] and mode['right']:
return 'both'
elif mode['left']:
@ -47,6 +64,7 @@ def mode_to_string(mode):
def run(tmp_dir):
"""Main method to run generating demuxer.txt"""
global inertia_samples
out_demuxer = 'demuxer.txt'

View File

@ -230,6 +230,8 @@ class MainWindow(QMainWindow, QApplication, Ui_MainWindow):
def generate_video_podcast(self, start=None, end=None):
"""Generate podcast based on values from UI."""
threshold_value = int(self.threshold_lcd.value())
generate_demuxer.set_up_threshold(threshold_value)
connected_channels = self.check_box_connected_channels.isChecked()
# Setup images