- commit
- 18f6fdc93557330f91bf0e514362c8ae62f11f97
- parent
- 4c8298087cbb49c9acec0811f6d7dd3ef7cc94e3
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-09-05 07:22
allow to set playlist path
Diffstat
| M | cplay.py | 12 | ++++++++++-- |
1 files changed, 10 insertions, 2 deletions
diff --git a/cplay.py b/cplay.py
@@ -47,6 +47,7 @@ d, D : delete item/all 47 47 m, M : move item down/up 48 48 r, R : toggle repeat/random 49 49 s, S : shuffle/sort playlist -1 50 w : enter filename for current playlist 50 51 C : close current playlist 51 52 @ : jump to current track""" 52 53 @@ -212,8 +213,8 @@ class Input: 212 213 self.active = False 213 214 self.str = '' 214 215215 -1 def start(self, prompt, on_input):216 -1 self.str = ''-1 216 def start(self, prompt, on_input, initial=''): -1 217 self.str = initial 217 218 self.prompt = prompt 218 219 self.on_input = on_input 219 220 self.active = True @@ -578,6 +579,9 @@ class Playlist(List): 578 579 except IOError: 579 580 pass 580 581 -1 582 def set_path(self, path): -1 583 self.path = path -1 584 581 585 def process_key(self, key): 582 586 if key == 'm': 583 587 self.move_item(1) @@ -605,6 +609,10 @@ class Playlist(List): 605 609 self.repeat = not self.repeat 606 610 elif key == 'R': 607 611 self.random = not self.random -1 612 elif key == 'w': -1 613 app.input.start( -1 614 'playlist path: ', self.set_path, self.path or filelist.path -1 615 ) 608 616 else: 609 617 return super().process_key(key) 610 618 self.write()