From d4601a77b9d153e74fec7b7c3a11c65c5463c49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= <mordae@anilinux.org> Date: Sat, 8 Mar 2025 21:23:57 +0100 Subject: [PATCH] Only offer video files --- lazy_player/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lazy_player/__init__.py b/lazy_player/__init__.py index 245b1cb..e3cb326 100644 --- a/lazy_player/__init__.py +++ b/lazy_player/__init__.py @@ -57,6 +57,7 @@ class MainWindow(Gtk.ApplicationWindow): left_box.set_valign(Gtk.Align.CENTER) left_box.set_halign(Gtk.Align.FILL) self.file_info_label = Gtk.Label(label="") + self.file_info_label.set_wrap(True) left_box.append(self.file_info_label) # Right two-thirds (2/3 width) @@ -157,9 +158,12 @@ class MainWindow(Gtk.ApplicationWindow): with os.scandir(".") as it: for entry in it: if entry.name == ".." or not entry.name.startswith("."): + parts = entry.name.split(".") + suffix = parts[-1] if len(parts) >= 2 else "" + if entry.is_dir(): directories.append(entry.name + "/") - else: + elif suffix in ("mkv", "mp4", "avi"): files.append(entry.name) directories.sort(key=lambda x: x.lower())