updating readme

This commit is contained in:
evilchili
2024-03-05 22:51:04 -08:00
parent 5f4418bbf6
commit affcf2d7dc
4 changed files with 42 additions and 48 deletions
+12 -26
View File
@@ -19,25 +19,18 @@ SETUP_HELP = """
# Root directory for croaker configuration and logs. See also croaker --root.
CROAKER_ROOT=~/.dnd/croaker
## COMMAND AND CONTROL WEBSERVER
# Please make sure you set SECRET_KEY in your environment if you are running
# the command and control webserver. Clients do not need this.
SECRET_KEY=
# Where the record the webserver daemon's PID
PIDFILE=~/.dnd/croaker/croaker.pid
HOST=0.0.0.0
PORT=8003
## MEDIA
# where to store playlist sources
PLAYLIST_ROOT=~/.dnd/croaker/playlists
#PLAYLIST_ROOT=$CROAKER_ROOT/playlists
# where to cache transcoded media files
CACHE_ROOT=~/.dnd/croaker/cache
#CACHE_ROOT=$CROAKER_ROOT/cache
# Where the record the daemon's PID
#PIDFILE=$CROAKER_ROOT/croaker.pid
# Command and Control TCP Server bind address
HOST=0.0.0.0
PORT=8003
# the kinds of files to add to playlists
MEDIA_GLOB=*.mp3,*.flac,*.m4a
@@ -47,11 +40,6 @@ MEDIA_GLOB=*.mp3,*.flac,*.m4a
# the cached output location, respectively.
TRANSCODER=/usr/bin/ffmpeg -i INFILE '-hide_banner -loglevel error -codec:v copy -codec:a libmp3lame -q:a 2' OUTFILE
## LIQUIDSOAP AND ICECAST
# The liquidsoap executable
LIQUIDSOAP=/usr/bin/liquidsoap
# Icecast2 configuration for Liquidsoap
ICECAST_PASSWORD=
ICECAST_MOUNT=
@@ -108,13 +96,11 @@ def setup(context: typer.Context):
@app.command()
def start(
context: typer.Context,
daemonize: bool = typer.Option(True, help="Daemonize the webserver."),
daemonize: bool = typer.Option(True, help="Daemonize the server."),
):
"""
Start the Croaker command and control webserver.
Start the Croaker command and control server.
"""
logger.debug("Switching to session_start playlist...")
logger.debug("Starting server...")
if daemonize:
server.daemonize()
else:
@@ -124,7 +110,7 @@ def start(
@app.command()
def stop():
"""
Terminate the webserver process and liquidsoap.
Terminate the server.
"""
server.stop()
+2 -7
View File
@@ -10,15 +10,10 @@ def root():
def cache_root():
path = Path(os.environ.get("CACHE_ROOT", root() / Path("cache"))).expanduser()
path = Path(os.environ.get("CACHE_ROOT", root() / "cache")).expanduser()
return path
def playlist_root():
path = Path(os.environ.get("PLAYLIST_ROOT", root() / Path("playlsits"))).expanduser()
return path
def transcoded_media(relpath):
path = cache_root() / Path(relpath + ".webm")
path = Path(os.environ.get("PLAYLIST_ROOT", root() / "playlists")).expanduser()
return path
+5 -2
View File
@@ -73,9 +73,12 @@ class CroakerServer(socketserver.TCPServer):
def tell_controller(self, msg):
self._queue.put(msg)
def bind_address(self):
return (os.environ["HOST"], int(os.environ["PORT"]))
def daemonize(self) -> None:
logger.info(f"Daemonizing controller; pidfile and output in {path.root()}")
super().__init__((os.environ["HOST"], int(os.environ["PORT"])), RequestHandler)
logger.info(f"Daemonizing controller on {self.bind_address()}; pidfile and output in {path.root()}")
super().__init__(self.bind_address(), RequestHandler)
self._context.pidfile = self._pidfile()
self._context.stdout = open(path.root() / Path("croaker.out"), "wb")