Created
February 7, 2020 19:53
-
-
Save jaspervdj/64177596eb3aec4fe38ae117fc63db42 to your computer and use it in GitHub Desktop.
Zero-config MiniDLNA/ReadyMedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset -o errexit -o pipefail | |
# Create temporary locations for the configuration and data directories. | |
CONFIG="$(mktemp)" | |
DATADIR="$(mktemp -d)" | |
# Write the configuration to the temporary location. | |
echo "media_dir=$PWD" >>"$CONFIG" | |
echo "db_dir=$DATADIR" >>"$CONFIG" | |
echo "log_dir=$DATADIR" >>"$CONFIG" | |
echo 'force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title' >>"$CONFIG" | |
cat $CONFIG | |
# Make sure everything is cleaned up when this process is killed. | |
function cleanup { | |
rm -r "$DATADIR" | |
rm "$CONFIG" | |
} | |
trap cleanup exit | |
# Run minidlnad with the following flags: | |
# | |
# - `-f "$CONFIG"`: use the configuration we wrote. | |
# - `-f "$PWD/minidlnad.pid"`: store the `.pid` in the current directory. | |
# - `-d`: don't daemonize, we'll kill this when we're done. This also | |
# enabled "debug" mode; but I haven't seen any considerable slowdown | |
# from this. | |
minidlnad -f "$CONFIG" -P "$PWD/minidlnad.pid" -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment