cplay-ng

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

commit
1fb8370be32a0e38948a4eadfd70b8462b1b80e2
parent
e825a7b1533a7e6daaa130fe90f34a9fc08def7d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-12-28 22:40
allow to refresh file list

Diffstat

M cplay.py 7 ++++++-

1 files changed, 6 insertions, 1 deletions


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

@@ -44,6 +44,7 @@ Filelist
   44    44 a            : add to playlist
   45    45 s            : recursive search
   46    46 BS           : go to parent dir
   -1    47 r            : refresh
   47    48 
   48    49 Playlist
   49    50 --------
@@ -420,12 +421,14 @@ class Filelist(List):
  420   421             s += '/'
  421   422         return s
  422   423 
  423    -1     def set_path(self, path, prev=None):
   -1   424     def set_path(self, path, *, prev=None, refresh=False):
  424   425         if path != self.path:
  425   426             self.path = path
  426   427             os.chdir(path)
  427   428             relpath.cache_clear()
  428   429             self.search_cache = []
   -1   430         elif refresh:
   -1   431             self.search_cache = []
  429   432         self.all_items = []
  430   433         self.rsearch_str = ''
  431   434 
@@ -494,6 +497,8 @@ class Filelist(List):
  494   497         elif key == '\n':
  495   498             if self.items:
  496   499                 self.activate(self.items[self.cursor])
   -1   500         elif key == 'r':
   -1   501             self.set_path(self.path, refresh=True)
  497   502         elif key == curses.KEY_BACKSPACE:
  498   503             if self.rsearch_str:
  499   504                 self.set_path(self.path)