- commit
- 82f109c6c09efece6d53638bdfaf1a69ee60a295
- parent
- 497d020a526b8c7a77693408cd0a2bfcfff550b0
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-07-17 18:04
breaking: do not implicitly write playlist file
Diffstat
| M | cplay.py | 17 | ++++++----------- |
1 files changed, 6 insertions, 11 deletions
diff --git a/cplay.py b/cplay.py
@@ -454,7 +454,6 @@ class Filelist(List): 454 454 if not self.items: 455 455 return True 456 456 if playlist.add(self.items[self.cursor]):457 -1 playlist.write()458 457 self.move_cursor(1) 459 458 elif key == 's': 460 459 app.input.start('search: ', on_input=self.filter) @@ -612,19 +611,16 @@ class Playlist(List): 612 611 self.add_playlist(path) 613 612 self.path = path 614 613615 -1 def write(self):616 -1 if not self.path:617 -1 return-1 614 def write(self, path): 618 615 try:619 -1 with open(self.path, 'w') as fh:-1 616 with open(path, 'w') as fh: 620 617 for item in self.items: 621 618 fh.write('%s\n' % item) -1 619 self.path = path -1 620 self.items_written = self.items.copy() 622 621 except IOError: 623 622 pass 624 623625 -1 def set_path(self, path):626 -1 self.path = path627 -1628 624 def process_key(self, key): 629 625 if key == 'm': 630 626 self.move_item(1) @@ -654,13 +650,12 @@ class Playlist(List): 654 650 self.random = not self.random 655 651 elif key == 'w': 656 652 app.input.start(657 -1 'playlist path: ',658 -1 on_submit=self.set_path,-1 653 'write playlist to path: ', -1 654 on_submit=self.write, 659 655 initial=self.path or filelist.path, 660 656 ) 661 657 else: 662 658 return super().process_key(key)663 -1 self.write()664 659 return True 665 660 666 661