Ansible adaptions
This commit is contained in:
parent
5140a7c51f
commit
8d9508f4fb
@ -1,41 +0,0 @@
|
||||
#!/bin/python
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
|
||||
SERVICE_FILE = """
|
||||
[Unit]
|
||||
Description=MPD Monitor Service
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
User=%(UID)d
|
||||
Group=%(GID)d
|
||||
ExecStart=%(MY_PATH)s/mpd_monitor.sh
|
||||
Type=simple
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
"""
|
||||
|
||||
|
||||
def help():
|
||||
print("Usage: prog <UID> <GID> <TARGET_PATH>")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 4:
|
||||
try:
|
||||
uid = int(sys.argv[1])
|
||||
gid = int(sys.argv[2])
|
||||
except ValueError:
|
||||
help()
|
||||
else:
|
||||
if os.path.isdir(sys.argv[3]):
|
||||
with open(os.path.join(sys.argv[3], 'mpd_monitor.service'), "w") as fh:
|
||||
fh.write(SERVICE_FILE % {
|
||||
"MY_PATH": os.path.dirname(os.path.abspath(__file__)),
|
||||
"UID": uid,
|
||||
"GID": gid})
|
||||
else:
|
||||
help()
|
||||
else:
|
||||
help()
|
@ -3,10 +3,10 @@
|
||||
import os
|
||||
import report
|
||||
|
||||
MQTT_USER = "user"
|
||||
MQTT_PASS = "pass"
|
||||
MQTT_SERVER = "localhost"
|
||||
MQTT_TOPIC = "hifi/mpd"
|
||||
MQTT_SERVER = "<mqtt_smarthome_hostname>"
|
||||
MQTT_USER = "<mqtt_smarthome_username>"
|
||||
MQTT_PASS = "<mqtt_smarthome_password>"
|
||||
MQTT_TOPIC = "<mqtt_mpd_topic>"
|
||||
|
||||
#
|
||||
# Logging
|
||||
@ -14,7 +14,7 @@ MQTT_TOPIC = "hifi/mpd"
|
||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
||||
APP_NAME = "mpd"
|
||||
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
||||
LOGLVL = 'DEBUG'
|
||||
LOGLVL = 'INFO'
|
||||
|
||||
LOGHOST = 'cutelog'
|
||||
LOGPORT = 19996
|
||||
|
8
init_venv
Executable file
8
init_venv
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
BASEPATH=`realpath $(dirname $0)`
|
||||
|
||||
python3 -m venv $BASEPATH/venv
|
||||
$BASEPATH/venv/bin/pip install --upgrade pip
|
||||
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
|
||||
$BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
BASEPATH=`dirname $0`
|
||||
$BASEPATH/venv/bin/python $BASEPATH/mpd_monitor.py
|
4
smart_mpd.sh
Executable file
4
smart_mpd.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
BASEPATH=`dirname $0`
|
||||
$BASEPATH/venv/bin/python $BASEPATH/smart_mpd.py
|
Loading…
x
Reference in New Issue
Block a user