- commit
- 08c04b4655985146d607834ddc7fb139549365a6
- parent
- d2f6d5bf1ce251ba006d3ae422451eb119fd97df
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-06-17 21:15
turn is_playing/is_finished into properties
Diffstat
| M | cplay.py | 10 | ++++++---- |
1 files changed, 6 insertions, 4 deletions
diff --git a/cplay.py b/cplay.py
@@ -201,12 +201,14 @@ class Player: 201 201 if self._seek_timeout and time.time() >= self._seek_timeout: 202 202 self._seek_timeout = None 203 203 self._seek_step = 0204 -1 if self.is_playing():-1 204 if self.is_playing: 205 205 self._play() 206 206 -1 207 @property 207 208 def is_playing(self): 208 209 return self._proc is not None 209 210 -1 211 @property 210 212 def is_finished(self): 211 213 return self._proc is not None and self._proc.poll() is not None 212 214 @@ -666,7 +668,7 @@ class Application: 666 668 status = self.input.prompt + self.input.str 667 669 elif self.tab == helplist: 668 670 status = __version__669 -1 elif player.is_playing():-1 671 elif player.is_playing: 670 672 status = 'Playing %s' % relpath(player.path) 671 673 else: 672 674 status = '' @@ -731,7 +733,7 @@ class Application: 731 733 while True: 732 734 player.finish_seek() 733 735734 -1 timeout = 0.5 if player.is_playing() else None-1 736 timeout = 0.5 if player.is_playing else None 735 737 for key, mask in sel.select(timeout): 736 738 if key.fileobj is self.resize_in: 737 739 os.read(self.resize_in, 8) @@ -742,7 +744,7 @@ class Application: 742 744 elif key.fileobj is player.stderr_r: 743 745 player.parse_progress(player.stderr_r) 744 746745 -1 if player.is_finished():-1 747 if player.is_finished: 746 748 player.play(playlist.next()) 747 749 748 750 self.render()