Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
31570b497a
|
@ -301,7 +301,7 @@ class CampcasterApiClient(ApiClientInterface):
|
||||||
url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"]
|
url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"]
|
||||||
url = url.replace("%%media_id%%", str(media_id))
|
url = url.replace("%%media_id%%", str(media_id))
|
||||||
url = url.replace("%%schedule_id%%", str(schedule_id))
|
url = url.replace("%%schedule_id%%", str(schedule_id))
|
||||||
url += "&api_key=" + self.config["api_key"]
|
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||||
logger.debug(url)
|
logger.debug(url)
|
||||||
response = urllib.urlopen(url)
|
response = urllib.urlopen(url)
|
||||||
response = json.read(response.read())
|
response = json.read(response.read())
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
ls_user="pypo"
|
ls_user="pypo"
|
||||||
export HOME="/home/pypo/"
|
export HOME="/home/pypo/"
|
||||||
ls_path="/usr/local/bin/liquidsoap"
|
#ls_path="/usr/local/bin/liquidsoap"
|
||||||
|
ls_path="/opt/pypo/bin/liquidsoap/liquidsoap"
|
||||||
ls_param="/opt/pypo/bin/scripts/ls_script.liq"
|
ls_param="/opt/pypo/bin/scripts/ls_script.liq"
|
||||||
echo "*** Daemontools: starting liquidsoap"
|
echo "*** Daemontools: starting liquidsoap"
|
||||||
|
echo "cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp"
|
||||||
cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp
|
cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
exec sudo -u ${ls_user} ${ls_path} ${ls_param}
|
echo "exec sudo -u ${ls_user} ${ls_path} ${ls_param} "
|
||||||
|
cd /opt/pypo/bin/scripts && sudo -u ${ls_user} ${ls_path} ${ls_param}
|
||||||
# EOF
|
# EOF
|
||||||
|
|
|
@ -35,7 +35,15 @@ def create_user(username):
|
||||||
os.system("adduser --system --quiet --group --disabled-login "+username)
|
os.system("adduser --system --quiet --group --disabled-login "+username)
|
||||||
else:
|
else:
|
||||||
print "User already exists."
|
print "User already exists."
|
||||||
|
|
||||||
|
def copy_dir(src_dir, dest_dir):
|
||||||
|
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
|
||||||
|
print "Removing old directory "+dest_dir
|
||||||
|
shutil.rmtree(dest_dir)
|
||||||
|
if not (os.path.exists(dest_dir)):
|
||||||
|
print "Copying directory "+src_dir+" to "+dest_dir
|
||||||
|
shutil.copytree(src_dir, dest_dir)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create users
|
# Create users
|
||||||
create_user("pypo")
|
create_user("pypo")
|
||||||
|
@ -60,38 +68,22 @@ try:
|
||||||
print "Copying pypo files"
|
print "Copying pypo files"
|
||||||
shutil.copy("../scripts/silence-playlist.lsp", BASE_PATH+"files/basic")
|
shutil.copy("../scripts/silence-playlist.lsp", BASE_PATH+"files/basic")
|
||||||
shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic")
|
shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic")
|
||||||
shutil.copy("../pypo-cli.py", BASE_PATH+"bin")
|
#shutil.copy("../pypo-cli.py", BASE_PATH+"bin")
|
||||||
shutil.copy("../pypo-notify.py", BASE_PATH+"bin")
|
#shutil.copy("../pypo-notify.py", BASE_PATH+"bin")
|
||||||
shutil.copy("../logging.cfg", BASE_PATH+"bin")
|
#shutil.copy("../logging.cfg", BASE_PATH+"bin")
|
||||||
shutil.copy("../config.cfg", BASE_PATH+"bin")
|
#shutil.copy("../config.cfg", BASE_PATH+"bin")
|
||||||
shutil.copy("../pypo-log.sh", BASE_PATH+"bin")
|
#shutil.copy("../pypo-log.sh", BASE_PATH+"bin")
|
||||||
print "Copying directory util"
|
copy_dir("..", BASE_PATH+"bin/")
|
||||||
shutil.copytree("../util", BASE_PATH+"bin/util")
|
#copy_dir("../util", BASE_PATH+"bin/")
|
||||||
print "Copying directory api_clients"
|
#copy_dir("../api_clients", BASE_PATH+"bin/api_clients")
|
||||||
shutil.copytree("../api_clients", BASE_PATH+"bin/api_clients")
|
#copy_dir("../scripts", BASE_PATH+"bin/scripts")
|
||||||
print "Copying directory scripts"
|
#copy_dir("../dls", BASE_PATH+"bin/dls")
|
||||||
shutil.copytree("../scripts", BASE_PATH+"bin/scripts")
|
#copy_dir("../dls", BASE_PATH+"bin/dls")
|
||||||
|
|
||||||
print "Setting permissions"
|
print "Setting permissions"
|
||||||
os.system("chmod -R 755 "+BASE_PATH)
|
os.system("chmod -R 755 "+BASE_PATH)
|
||||||
os.system("chown -R pypo:pypo "+BASE_PATH)
|
os.system("chown -R pypo:pypo "+BASE_PATH)
|
||||||
|
|
||||||
print "Installing daemontool script pypo-liquidsoap"
|
|
||||||
create_path("/etc/service/pypo-liquidsoap")
|
|
||||||
create_path("/etc/service/pypo-liquidsoap/log")
|
|
||||||
shutil.copy("pypo-daemontools-liquidsoap.sh", "/etc/service/pypo-liquidsoap/run")
|
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
|
|
||||||
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
|
|
||||||
|
|
||||||
print "Installing daemontool script pypo-push"
|
|
||||||
create_path("/etc/service/pypo-push")
|
|
||||||
create_path("/etc/service/pypo-push/log")
|
|
||||||
shutil.copy("pypo-daemontools-push.sh", "/etc/service/pypo-push/run")
|
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
|
|
||||||
os.system("chmod -R 755 /etc/service/pypo-push")
|
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-push")
|
|
||||||
|
|
||||||
print "Installing daemontool script pypo-fetch"
|
print "Installing daemontool script pypo-fetch"
|
||||||
create_path("/etc/service/pypo-fetch")
|
create_path("/etc/service/pypo-fetch")
|
||||||
create_path("/etc/service/pypo-fetch/log")
|
create_path("/etc/service/pypo-fetch/log")
|
||||||
|
@ -99,6 +91,27 @@ try:
|
||||||
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-fetch/log/run")
|
||||||
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
os.system("chmod -R 755 /etc/service/pypo-fetch")
|
||||||
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
|
os.system("chown -R pypo:pypo /etc/service/pypo-fetch")
|
||||||
|
os.system("svc -t /etc/service/pypo-fetch")
|
||||||
|
|
||||||
|
print "Installing daemontool script pypo-push"
|
||||||
|
create_path("/etc/service/pypo-push")
|
||||||
|
create_path("/etc/service/pypo-push/log")
|
||||||
|
shutil.copy("pypo-daemontools-push.sh", "/etc/service/pypo-push/run")
|
||||||
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-push/log/run")
|
||||||
|
os.system("chmod -R 755 /etc/service/pypo-push")
|
||||||
|
os.system("chown -R pypo:pypo /etc/service/pypo-push")
|
||||||
|
os.system("svc -t /etc/service/pypo-push")
|
||||||
|
|
||||||
|
print "Installing daemontool script pypo-liquidsoap"
|
||||||
|
os.system("svc -dk /etc/service/pypo-liquidsoap")
|
||||||
|
os.system("killall liquidsoap")
|
||||||
|
create_path("/etc/service/pypo-liquidsoap")
|
||||||
|
create_path("/etc/service/pypo-liquidsoap/log")
|
||||||
|
shutil.copy("pypo-daemontools-liquidsoap.sh", "/etc/service/pypo-liquidsoap/run")
|
||||||
|
shutil.copy("pypo-daemontools-logger.sh", "/etc/service/pypo-liquidsoap/log/run")
|
||||||
|
os.system("chmod -R 755 /etc/service/pypo-liquidsoap")
|
||||||
|
os.system("chown -R pypo:pypo /etc/service/pypo-liquidsoap")
|
||||||
|
os.system("svc -u /etc/service/pypo-liquidsoap")
|
||||||
|
|
||||||
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
|
||||||
output = p.stdout.read()
|
output = p.stdout.read()
|
||||||
|
|
|
@ -2,10 +2,16 @@
|
||||||
# Dynamic variables
|
# Dynamic variables
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
|
playlist_type = ref '0'
|
||||||
pypo_data = ref '0'
|
pypo_data = ref '0'
|
||||||
|
|
||||||
|
def set_playlist_type(s)
|
||||||
|
playlist_type := s
|
||||||
|
end
|
||||||
|
|
||||||
def set_pypo_data(s)
|
def set_pypo_data(s)
|
||||||
pypo_data := s
|
pypo_data := s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
server.register(namespace="vars", "playlist_type", fun (s) -> begin set_playlist_type(s) "Done!" end)
|
||||||
server.register(namespace="vars", "pypo_data", fun (s) -> begin set_pypo_data(s) "Done!" end)
|
server.register(namespace="vars", "pypo_data", fun (s) -> begin set_pypo_data(s) "Done!" end)
|
|
@ -4,5 +4,4 @@
|
||||||
# needed here to keep dirs/configs clean #
|
# needed here to keep dirs/configs clean #
|
||||||
# and maybe to set user-rights #
|
# and maybe to set user-rights #
|
||||||
############################################
|
############################################
|
||||||
cd ../
|
cd ../ && ./pypo-notify.py $1 $2 $3 $4 $5 $6 $7 $8 &
|
||||||
./pypo_notify.py $1 $2 $3 $4 $5 $6 $7 $8 &
|
|
||||||
|
|
Loading…
Reference in New Issue