From efdd151c7ee9b42a80aa5068e3740de04c3503f3 Mon Sep 17 00:00:00 2001 From: Stefan Heid Date: Thu, 22 Apr 2021 20:41:36 +0200 Subject: [PATCH 1/4] Added requirements to setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 5d22f05..96934c1 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,8 @@ name='PySplit', version=pysplit.__version__, packages=['pysplit', 'pysplit.client'], + install_requires=['requests>=2.20.0', 'PyYAML>=5.3.1', + 'Flask>=1.1.2', 'tornado~=5.1'], entry_points={ 'console_scripts': ['pysplit = pysplit.runner:main'] } From fa0c7eb486b5a5bc639a3d933b3eb5bd63be7a97 Mon Sep 17 00:00:00 2001 From: Stefan Heid Date: Thu, 22 Apr 2021 20:43:36 +0200 Subject: [PATCH 2/4] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 96934c1..e1698c2 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ version=pysplit.__version__, packages=['pysplit', 'pysplit.client'], install_requires=['requests>=2.20.0', 'PyYAML>=5.3.1', - 'Flask>=1.1.2', 'tornado~=5.1'], + 'Flask>=1.1.2', 'tornado>=5.1'], entry_points={ 'console_scripts': ['pysplit = pysplit.runner:main'] } From 1a6ea6c5b96b8d3bfee871c2b08c36e2b7620b7a Mon Sep 17 00:00:00 2001 From: Stefan Heid Date: Thu, 22 Apr 2021 21:36:27 +0200 Subject: [PATCH 3/4] added playsound to dependencies --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e1698c2..4f46a4e 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ version=pysplit.__version__, packages=['pysplit', 'pysplit.client'], install_requires=['requests>=2.20.0', 'PyYAML>=5.3.1', - 'Flask>=1.1.2', 'tornado>=5.1'], + 'Flask>=1.1.2', 'tornado>=5.1', 'playsound>=1.2'], entry_points={ 'console_scripts': ['pysplit = pysplit.runner:main'] } From ad657a0a1b3cfa933582ac470f0ad195d55d362d Mon Sep 17 00:00:00 2001 From: Stefan Heid Date: Thu, 22 Apr 2021 21:37:49 +0200 Subject: [PATCH 4/4] made sound replay platform independend AND using multiprocessing to avoid beeing slowed by the pythons GIL --- pysplit/client/curses_timer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pysplit/client/curses_timer.py b/pysplit/client/curses_timer.py index c103001..6fde6db 100644 --- a/pysplit/client/curses_timer.py +++ b/pysplit/client/curses_timer.py @@ -3,12 +3,13 @@ import signal import datetime import traceback +from functools import partial from time import sleep from os.path import isfile -from threading import Thread -from subprocess import check_call from pysplit.client import records from pysplit.config import cfg +from multiprocessing import Process +from playsound import playsound def now(): @@ -213,9 +214,8 @@ def print(self, string): @staticmethod def play_sound(sound_file): - if isfile(sound_file): - t = Thread(target=check_call, args=(['afplay', sound_file],)) - t.start() + if sound_file and isfile(sound_file): + Process(target=partial(playsound, sound_file)).start() class Descriptor: