diff --git a/README.md b/README.md index dc3312d..69f750a 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ I have no idea if it will function on platforms besides Linux. Code was written [ check the releases tab ] ``` -pip3 install https://github.com/evilchili/grooveondemand/releases/download/beta/grooveondemand-0.9.tar.gz +pip3 install https://github.com/evilchili/grooveondemand/releases/download/beta/grooveondemand-0.10.tar.gz ``` -### 2. Generate the default configuration +### 3. Generate the default configuration ``` mkdir ~/.groove @@ -29,7 +29,7 @@ mkdir ~/.groove ### 3. Set the Media Root -Edit `~/.groove` and define `MEDIA_ROOT` to point to the directory containing your local audio files. For example: +Edit `~/.groove/defaults` and define `MEDIA_ROOT` to point to the directory containing your local audio files. For example: ``` MEDIA_ROOT=/media/audio/lossless diff --git a/groove/cli.py b/groove/cli.py index cd2eb05..1907a1e 100644 --- a/groove/cli.py +++ b/groove/cli.py @@ -34,8 +34,8 @@ MEDIA_GLOB=*.mp3,*.flac,*.m4a # If defined, transcode media before streaming it, and cache it to disk. The # strings INFILE and OUTFILE will be replaced with the media source file and -# the cached output location, respectively. -# +# the cached output location, respectively. The default below uses ffmpeg to +# transcode to webm with a reasonable trade-off between file size and quality. TRANSCODER=/usr/bin/ffmpeg -i INFILE -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 256k -c:a libopus OUTFILE # where to cache transcoded media files diff --git a/groove/media/transcoder.py b/groove/media/transcoder.py index 7e5ea85..ad6f00d 100644 --- a/groove/media/transcoder.py +++ b/groove/media/transcoder.py @@ -18,8 +18,6 @@ from rich.progress import ( import groove.path -from groove.exceptions import ConfigurationError - @rich.repr.auto(angular=True) class Transcoder: @@ -48,7 +46,8 @@ class Transcoder: count = len(sources) if not os.environ.get('TRANSCODER', None): - raise ConfigurationError("Cannot transcode tracks without a TRANSCODR defined in your environment.") + self.console.error("Cannot transcode tracks without a TRANSCODER defined in your environment.") + return cache = groove.path.cache_root() if not cache.exists(): diff --git a/groove/shell/interactive_shell.py b/groove/shell/interactive_shell.py index f164c18..4574d6d 100644 --- a/groove/shell/interactive_shell.py +++ b/groove/shell/interactive_shell.py @@ -97,7 +97,9 @@ class InteractiveShell(BasePrompt): Groove on Demand will stream audio to web clients in the native format of your source media files, but for maximum portability, performance, and interoperability with reverse proxies, it's a good idea to transcode to .webm first. Use the [b]transcode[/b] command to cache transcoded copies of every track currently in a playlist that isn't - already in .webm format. Existing cache entries will be skipped. See also [b]cache[/b]. + already in .webm format. Existing cache entries will be skipped. + + The default Groove on Demand configuration uses ffmpeg; try [b]groove setup[/b] from the command-line. [title]USAGE[/title] diff --git a/groove/webserver/webserver.py b/groove/webserver/webserver.py index b361b85..d53d5dd 100644 --- a/groove/webserver/webserver.py +++ b/groove/webserver/webserver.py @@ -78,8 +78,10 @@ def serve_track(request, track_id, db): except (NoResultFound, MultipleResultsFound): return HTTPResponse(status=404, body="Not found") - path = groove.path.media(track['relpath']) - logging.debug(f"Service track {path.name} from {path.parent}") + path = groove.path.transcoded_media(track['relpath']) + if not path.exists(): + path = groove.path.media(track['relpath']) + logging.debug(f"Serving track {path.name}") return static_file(path.name, root=path.parent) diff --git a/pyproject.toml b/pyproject.toml index 9fab1da..4339284 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "grooveondemand" -version = "0.9" +version = "0.10" description = "audio playlist server" authors = ["evilchili "] license = "MIT License"