- commit
- c1d2831c69fc4bf1983025eb440631dfd67ca679
- parent
- f3351337f91d4d655b52aa13aa11adad8c504b8e
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-05-27 06:15
stop playback on exit previously we relied on the OS to reap children, which caused a slight delay
Diffstat
| M | cplay.py | 8 | +++++--- |
1 files changed, 5 insertions, 3 deletions
diff --git a/cplay.py b/cplay.py
@@ -149,11 +149,13 @@ class Player: 149 149 return 0 150 150 return self.position / self.length 151 151152 -1 def _play(self):-1 152 def stop(self): 153 153 if self._proc: 154 154 self._proc.terminate() 155 155 self._proc = None 156 156 -1 157 def _play(self): -1 158 self.stop() 157 159 if not self.path: 158 160 return 159 161 @@ -180,8 +182,7 @@ class Player: 180 182 181 183 def toggle(self): 182 184 if self._proc:183 -1 self._proc.terminate()184 -1 self._proc = None-1 185 self.stop() 185 186 elif self.path: 186 187 self._play() 187 188 @@ -711,6 +712,7 @@ class Application: 711 712 elif key == 'h': 712 713 self.help = True 713 714 elif key in ['q', 'Q']: -1 715 player.stop() 714 716 sys.exit(0) 715 717 elif key == '\t': 716 718 app.toggle_tabs()