From 4455c69c2e6eccd51e59f330c7bf51c2cac7425f Mon Sep 17 00:00:00 2001 From: KubaPro010 <132459354+KubaPro010@users.noreply.github.com> Date: Sun, 9 Nov 2025 09:15:31 +0100 Subject: [PATCH] fix jingles --- modules/jingle.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/jingle.py b/modules/jingle.py index dd668ee..e69a216 100644 --- a/modules/jingle.py +++ b/modules/jingle.py @@ -12,21 +12,20 @@ from . import PlaylistModifierModule, Track, Path class Module(PlaylistModifierModule): def __init__(self, file: Path) -> None: - self.file = file + self.file = file.absolute() assert file.exists() def modify(self, global_args: dict, playlist: list[Track]) -> list[Track] | None: - if int(global_args.get("no_jingle", 0)): return None + if int(global_args.get("no_jingle", 0)) != 0: return None out: list[Track] = [] last_jingiel = True for track in playlist: - if not last_jingiel and random.choice([False, True, False, False]) and self.file and (track.args and int(track.args.get("no_jingle", 0)) == 0): + if not last_jingiel and (random.randint(1,4) == 1) and self.file and (track.args and int(track.args.get("no_jingle", 0)) != 0): out.append(Track(track.path, True, False, True, track.args)) out.append(Track(self.file, False, False, False, {})) last_jingiel = True continue out.append(Track(track.path, True, True, True, track.args)) last_jingiel = False - del last_jingiel return out playlistmod = (Module(Path("/home/user/Jingiel.mp3")), 1) \ No newline at end of file