mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-07-29 23:39:15 +02:00
massive clean ups (i wonder if it starts)
This commit is contained in:
+8
-8
@@ -8,22 +8,22 @@ Reacts to the 'no_jingle' argument, for global usage it does not add jingles to
|
||||
|
||||
import random
|
||||
|
||||
from . import PlaylistModifierModule
|
||||
from . import PlaylistModifierModule, Track
|
||||
|
||||
class Module(PlaylistModifierModule):
|
||||
def __init__(self, file: str) -> None:
|
||||
self.file = file
|
||||
def modify(self, global_args: dict, playlist: list[tuple[str, bool, bool, bool, dict]]):
|
||||
def modify(self, global_args: dict, playlist: list[Track]):
|
||||
if int(global_args.get("no_jingle", 0)): return playlist
|
||||
out: list[tuple[str, bool, bool, bool, dict]] = []
|
||||
out: list[Track] = []
|
||||
last_jingiel = True
|
||||
for (track, _, _, _, args) in playlist:
|
||||
if not last_jingiel and random.choice([False, True, False, False]) and self.file and int(args.get("no_jingle", 0)) == 0:
|
||||
out.append((track, True, False, True, args))
|
||||
out.append((self.file, False, False, False, {}))
|
||||
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):
|
||||
out.append(Track(track, True, False, True, track.args))
|
||||
out.append(Track(self.file, False, False, False, {}))
|
||||
last_jingiel = True
|
||||
else:
|
||||
out.append((track, True, True, True, args))
|
||||
out.append(Track(track, True, True, True, track.args))
|
||||
last_jingiel = False
|
||||
del last_jingiel
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user