You've already forked RadioPlayer
mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-02-26 21:53:54 +01:00
some changes
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
from modules import InterModuleCommunication
|
from modules import InterModuleCommunication
|
||||||
from . import ActiveModifier, log95, Track
|
from . import ActiveModifier, log95, Track
|
||||||
import os
|
import os, subprocess, glob, datetime
|
||||||
import subprocess
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
from .advisor import MORNING_START, DAY_END
|
from .advisor import MORNING_START, DAY_END
|
||||||
|
|
||||||
@@ -29,6 +27,9 @@ class Module(ActiveModifier):
|
|||||||
if not self.playlist: return track
|
if not self.playlist: return track
|
||||||
if not os.path.exists("/tmp/radioPlayer_toplay"): open("/tmp/radioPlayer_toplay", "a").close()
|
if not os.path.exists("/tmp/radioPlayer_toplay"): open("/tmp/radioPlayer_toplay", "a").close()
|
||||||
with open("/tmp/radioPlayer_toplay", "r") as f: songs = [s.strip() for s in f.readlines() if s.strip()]
|
with open("/tmp/radioPlayer_toplay", "r") as f: songs = [s.strip() for s in f.readlines() if s.strip()]
|
||||||
|
|
||||||
|
songs[:] = [f for s in songs for f in glob.glob(s) if os.path.isfile(f)] # expand glob
|
||||||
|
|
||||||
if len(songs):
|
if len(songs):
|
||||||
song = songs.pop(0)
|
song = songs.pop(0)
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ DEBUG = False
|
|||||||
import time
|
import time
|
||||||
import os, subprocess, importlib.util, types
|
import os, subprocess, importlib.util, types
|
||||||
import sys, signal, threading, glob
|
import sys, signal, threading, glob
|
||||||
import unidecode
|
import libcache
|
||||||
from dataclasses import dataclass
|
|
||||||
import log95, libcache
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from modules import *
|
from modules import *
|
||||||
|
|
||||||
@@ -115,13 +113,13 @@ def handle_sigint(signum, frame):
|
|||||||
else:
|
else:
|
||||||
logger.warning("Force-Quit pending")
|
logger.warning("Force-Quit pending")
|
||||||
procman.stop_all()
|
procman.stop_all()
|
||||||
exit(0)
|
raise SystemExit
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, handle_sigint)
|
signal.signal(signal.SIGINT, handle_sigint)
|
||||||
|
|
||||||
def load_filelines(path):
|
def load_filelines(path):
|
||||||
try:
|
try:
|
||||||
with open(path, 'r') as f: return [unidecode.unidecode(line.strip()) for line in f.readlines() if unidecode.unidecode(line.strip())]
|
with open(path, 'r') as f: return [line.strip() for line in f.readlines() if line.strip()]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
logger.error(f"Playlist not found: {path}")
|
logger.error(f"Playlist not found: {path}")
|
||||||
return []
|
return []
|
||||||
@@ -259,7 +257,10 @@ def main():
|
|||||||
module.__package__ = MODULES_PACKAGE
|
module.__package__ = MODULES_PACKAGE
|
||||||
|
|
||||||
if not spec.loader: continue
|
if not spec.loader: continue
|
||||||
spec.loader.exec_module(module)
|
try: spec.loader.exec_module(module)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed loading {module_name} due to {e}")
|
||||||
|
continue
|
||||||
|
|
||||||
if md := getattr(module, "module", None):
|
if md := getattr(module, "module", None):
|
||||||
if isinstance(md, list): simple_modules.extend(md)
|
if isinstance(md, list): simple_modules.extend(md)
|
||||||
|
|||||||
Reference in New Issue
Block a user