- commit
- d8bc0d5c31e28addaf46afca364a948f75a14ce8
- parent
- 72a4edbc65681b812816f2257383305249f02735
- Author
- Rosie <42421590+AlkyoneAoide@users.noreply.github.com>
- Date
- 2023-02-09 22:27
use mpv's native volume controls
Diffstat
| M | README.rst | 1 | - |
| M | cplay.py | 11 | ++++------- |
2 files changed, 4 insertions, 8 deletions
diff --git a/README.rst b/README.rst
@@ -21,7 +21,6 @@ Requirements 21 21 22 22 - `python3 <http://www.python.org/>`_ 23 23 - `mpv <https://mpv.io/>`_24 -1 - pulseaudio-utils, specifically the ``pactl`` command25 24 26 25 Installation 27 26 ------------
diff --git a/cplay.py b/cplay.py
@@ -78,12 +78,6 @@ def str_match(query, s): 78 78 return all(q in s.lower() for q in query.lower().split()) 79 79 80 8081 -1 def set_volume(vol):82 -1 subprocess.check_call([83 -1 'pactl', 'set-sink-volume', '@DEFAULT_SINK@', '%i%%' % int(vol * 100)84 -1 ])85 -186 -187 81 def resize(*args): 88 82 os.write(app.resize_out, b'.') 89 83 @@ -205,6 +199,9 @@ class Player: 205 199 title = '{} [{}]'.format(title, self.metadata['icy-title']) 206 200 return title 207 201 -1 202 def set_volume(self, vol): -1 203 self._ipc('set', 'volume', str(vol)) -1 204 208 205 def stop(self): 209 206 self.is_playing = False 210 207 self._ipc('stop') @@ -761,7 +758,7 @@ class Application: 761 758 elif self.tab.process_key(key): 762 759 pass 763 760 elif key in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:764 -1 set_volume(int(key, 10) / 9.0)-1 761 player.set_volume(int(key, 10) * 11) 765 762 elif key == curses.KEY_RIGHT: 766 763 player.seek(1) 767 764 elif key == curses.KEY_LEFT: