- commit
- d5c5634972c9c4d12b08d6ea8f8c5656805669d4
- parent
- 09507f1f7af6c50c89431668c7cfa9bc22b71c8f
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-09-05 13:33
perf: avoid calling os.path.isdir() in format_item()
Diffstat
| M | cplay.py | 8 | +++++--- |
1 files changed, 5 insertions, 3 deletions
diff --git a/cplay.py b/cplay.py
@@ -268,8 +268,6 @@ class List: 268 268 name = os.path.relpath(item) 269 269 else: 270 270 name = os.path.basename(item)271 -1 if os.path.isdir(item):272 -1 name += '/'273 271 return name 274 272 275 273 def render(self): @@ -345,7 +343,11 @@ class Filelist(List): 345 343 return title 346 344 347 345 def format_item(self, item):348 -1 return super().format_item(item, force_verbose=self.rsearch_str)-1 346 s = super().format_item(item, force_verbose=self.rsearch_str) -1 347 ext = get_ext(item) -1 348 if not (ext in AUDIO_EXTENSIONS or ext == 'm3u'): -1 349 s += '/' -1 350 return s 349 351 350 352 def set_path(self, path, prev=None): 351 353 if path != self.path: