minor bugfixes, started the README

This commit is contained in:
evilchili
2022-12-21 23:40:09 -08:00
parent 7caf3302db
commit 83f32d82ed
5 changed files with 93 additions and 22 deletions
+16 -19
View File
@@ -1,3 +1,4 @@
import io
import logging
import os
import sys
@@ -20,33 +21,33 @@ from groove.exceptions import ConfigurationError
from groove.console import Console
SETUP_HELP = """
Please make sure you set MEDIA_ROOT and SECRET_KEY in your environment.
By default, Groove on Demand will attempt to load these variables from
~/.groove, which may contain the following variables as well. See also
the --env paramter.
# Please make sure you set MEDIA_ROOT and SECRET_KEY in your environment.
# By default, Groove on Demand will attempt to load these variables from
# ~/.groove, which may contain the following variables as well. See also
# the --env paramter.
# Set this one. The path containing your media files
MEDIA_ROOT=
# the kinds of files to import
# MEDIA_GLOB=*.mp3,*.flac,*.m4a
MEDIA_GLOB=*.mp3,*.flac,*.m4a
# where to store the groove_on_demand.db sqlite database.
# DATABASE_PATH=~
DATABASE_PATH=~
# Try 'groove themes' to see a list of available themes.
# DEFAULT_THEME=blue_train
DEFAULT_THEME=blue_train
# Web interface configuration
# HOST=127.0.0.1
# PORT=2323
HOST=127.0.0.1
PORT=2323
# Set this to a suitably random string.
SECRET_KEY=much secret very private
SECRET_KEY=
# Console configuration
# EDITOR=
# CONSOLE_WIDTH=auto
EDITOR=vim
CONSOLE_WIDTH=auto
"""
app = typer.Typer()
@@ -61,6 +62,7 @@ def main(
)
):
load_dotenv(env.expanduser())
load_dotenv(stream=io.StringIO(SETUP_HELP))
debug = os.getenv('DEBUG', None)
logging.basicConfig(
format='%(message)s',
@@ -86,13 +88,8 @@ def setup(context: typer.Context):
"""
(Re)Initialize Groove on Demand.
"""
print(dedent(
"""
Interactive setup is not yet available. Sorry!
{SETUP_HELP}
"""
))
sys.stderr.write("Interactive setup is not yet available. Sorry!\n")
print(dedent(SETUP_HELP))
@app.command()
+1 -1
View File
@@ -68,7 +68,7 @@ class PlaylistEditor:
try:
with self.path as fh:
fh.write(playlist.as_yaml.encode())
subprocess.check_call([os.environ['EDITOR'], self.path.name])
subprocess.check_call([os.environ.get('EDITOR', 'vim'), self.path.name])
except (IOError, OSError, FileNotFoundError) as e:
logging.error(e)
raise RuntimeError("Could not invoke the editor! If the error persists, try enabling DEBUG mode.")
+1 -1
View File
@@ -73,7 +73,7 @@ class Playlist:
@property
def url(self) -> str:
return f"http://{os.environ['HOST']}:{os.environ['PORT']}/{self.slug}"
return f"http://{os.environ['HOST']}:{os.environ['PORT']}/playlist/{self.slug}"
@property
def slug(self) -> str:
+2
View File
@@ -1,4 +1,6 @@
/*!
* This player is a modified version of:
*
* Howler.js Audio Player Demo
* howlerjs.com
*