From 02e2ae3080a58b5f97701b708e0d7589c980519d Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 31 May 2026 18:36:52 +0200 Subject: [PATCH] glob isnt that good it looks like --- modules/active_modifier.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/active_modifier.py b/modules/active_modifier.py index 5cf025c..dff74c2 100644 --- a/modules/active_modifier.py +++ b/modules/active_modifier.py @@ -44,8 +44,16 @@ class Module(ActiveModifier): TOPLAY.touch() with open(TOPLAY, "r") as f: songs = [s.strip() for s in f.readlines() if s.strip()] - songs[:] = [('!' if s.startswith('!') else '') + f for s in songs for f in glob.glob(s.removeprefix("!")) if os.path.isfile(f)] + def expand_song(s): + prefix = '!' if s.startswith('!') else '' + path = s.removeprefix('!') + if any(c in path for c in ('*', '?')): + return [(prefix + f) for f in glob.glob(path) if os.path.isfile(f)] + else: + return [(prefix + path)] if os.path.isfile(path) else [] + songs[:] = [result for s in songs for result in expand_song(s)] + def get_song(pop: bool = True): nonlocal songs if pop: song = songs.pop(0)