cplay-ng

simple curses audio player
git clone https://git.ce9e.org/cplay-ng.git

commit
9371eb724b1caf3d4e06d08ea73db80a11aed625
parent
92ac5aeb56dc6078105643157a1def40830824c4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2021-07-26 18:43
ignore property-change events without data

fixes #4

I am confused that this does even happen. The documentation states that
property-change events always have a data field:
https://mpv.io/manual/master/#list-of-events

Diffstat

M ChangeLog 1 +
M cplay.py 4 ++--

2 files changed, 3 insertions, 2 deletions


diff --git a/ChangeLog b/ChangeLog

@@ -9,6 +9,7 @@ unreleased  Tobias Bengfort <tobias.bengfort@posteo.de>
    9     9 	  parsing command line output.
   10    10 	- fix: stop playback when cplay crashes
   11    11 	- fix: do not crash on tiny screen size
   -1    12 	- fix: mpv 0.33 compatibility
   12    13 
   13    14 2020-09-07  Tobias Bengfort <tobias.bengfort@posteo.de>
   14    15 

diff --git a/cplay.py b/cplay.py

@@ -170,10 +170,10 @@ class Player:
  170   170 
  171   171     def handle_ipc(self, data):
  172   172         if data.get('event') == 'property-change' and data['id'] == 1:
  173    -1             if data['data'] is not None and not self._seek_step:
   -1   173             if data.get('data') is not None and not self._seek_step:
  174   174                 self.position = data['data']
  175   175         elif data.get('event') == 'property-change' and data['id'] == 2:
  176    -1             if data['data'] is not None:
   -1   176             if data.get('data') is not None:
  177   177                 self.length = data['data']
  178   178         elif data.get('event') == 'end-file':
  179   179             self._playing -= 1