From e164389424ee84fb7d55ad64e688424412709a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Wieczorek?= Date: Mon, 18 Jan 2021 12:14:23 +0100 Subject: [PATCH] Add set_up_threshold in generate_demuxer.py. --- generate_demuxer.py | 18 ++++++++++++++++++ src/python/classes/mainwindow.py | 2 ++ 2 files changed, 20 insertions(+) diff --git a/generate_demuxer.py b/generate_demuxer.py index 808d1fc..a463335 100644 --- a/generate_demuxer.py +++ b/generate_demuxer.py @@ -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' diff --git a/src/python/classes/mainwindow.py b/src/python/classes/mainwindow.py index 6ee1f04..e64d711 100644 --- a/src/python/classes/mainwindow.py +++ b/src/python/classes/mainwindow.py @@ -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