From f78d152c881a1892d65c356a78a758a8bc7eda24 Mon Sep 17 00:00:00 2001 From: Riviera Date: Thu, 7 Dec 2023 11:14:20 +0000 Subject: [PATCH] for chopchop --- archive-restart.timer | 9 +++++++++ archive-stop.service | 16 ++++++++++++++++ archive-stop.sh | 5 +++++ archive-stop.timer | 9 +++++++++ scmixer.service | 5 +++-- server.py | 16 ++++++++-------- vlc-stop.sh | 2 ++ vlc.service | 13 +++++++++++++ vlc.timer | 9 +++++++++ vlcwrapper.sh | 4 ++++ 10 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 archive-restart.timer create mode 100644 archive-stop.service create mode 100644 archive-stop.sh create mode 100644 archive-stop.timer create mode 100644 vlc-stop.sh create mode 100644 vlc.service create mode 100644 vlc.timer create mode 100755 vlcwrapper.sh diff --git a/archive-restart.timer b/archive-restart.timer new file mode 100644 index 0000000..5a9132f --- /dev/null +++ b/archive-restart.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Start playing audio from the archive again + +[Timer] +OnCalendar=*-*-* *:16:00 +Unit=scmixer.service + +[Install] +WantedBy=multi-user.target diff --git a/archive-stop.service b/archive-stop.service new file mode 100644 index 0000000..f31cb6d --- /dev/null +++ b/archive-stop.service @@ -0,0 +1,16 @@ +[Unit] +Description=Stop playing from the Archive +After=syslog.target network.target + +[Service] +Type=simple +User=xpub +Group=xpub +WrokingDirectory=/home/xpub +ExecStart=/home/xpub/archive-stop.sh +Restart=always + +[Install] +WantedBy=multi-user.target + + diff --git a/archive-stop.sh b/archive-stop.sh new file mode 100644 index 0000000..f8fab33 --- /dev/null +++ b/archive-stop.sh @@ -0,0 +1,5 @@ +#!/bin/bash +systemctl stop scmixer.service; +systemctl stop jack.service; +systemctl stop oscserver.service; + diff --git a/archive-stop.timer b/archive-stop.timer new file mode 100644 index 0000000..05115b3 --- /dev/null +++ b/archive-stop.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Stop playing audio from the archive + +[Timer] +OnCalendar=*-*-* *:10:00 +Unit=archive-stop.service + +[Install] +WantedBy=multi-user.target diff --git a/scmixer.service b/scmixer.service index be19137..69e5020 100644 --- a/scmixer.service +++ b/scmixer.service @@ -1,13 +1,14 @@ [Unit] Description=Start the Supercollider Application After=syslog.target network.target -Requires=oscserver.service jack.service +Requires=jack.service oscserver.service +Conflicts=vlc.service [Service] Type=simple User=xpub Group=xpub -WrokingDirectory=/home/xpub +WorkingDirectory=/home/xpub ExecStart=/home/xpub/scmixer.sh Restart=always diff --git a/server.py b/server.py index 312f102..712dc88 100755 --- a/server.py +++ b/server.py @@ -12,42 +12,42 @@ def send_message(channel, message): client.send_message(channel, message) def track_0(): - cmd_0 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_0 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/00.wav" + cmd_0 = "cp \"$(tree -if /var/www/html/radio/random-radio-radio/webinterface/uploads | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/00.wav" proc_0 = subprocess.Popen(cmd_0,shell=True) wav_0 = proc_0.communicate()[0] def track_1(): - cmd_1 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_0 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/01.wav" + cmd_1 = "cp \"$(tree -if /var/www/html/radio/random-radio-radio/webinterface/uploads | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/01.wav" proc_1 = subprocess.Popen(cmd_1,shell=True) wav_1 = proc_1.communicate()[0] def track_2(): - cmd_2 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_1 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/02.wav" + cmd_2 = "cp \"$(tree -if /home/xpub/audio_1 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/02.wav" proc_2 = subprocess.Popen(cmd_2,shell=True) wav_2 = proc_2.communicate()[0] def track_3(): - cmd_3 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_1 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/03.wav" + cmd_3 = "cp \"$(tree -if /home/xpub/audio_1 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/03.wav" proc_3 = subprocess.Popen(cmd_3,shell=True) wav_3 = proc_3.communicate()[0] def track_4(): - cmd_4 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_2 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/04.wav" + cmd_4 = "cp \"$(tree -if /home/xpub/audio_2 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/04.wav" proc_4 = subprocess.Popen(cmd_4,shell=True) wav_4 = proc_4.communicate()[0] def track_5(): - cmd_5 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_2 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/05.wav" + cmd_5 = "cp \"$(tree -if /home/xpub/audio_2 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/05.wav" proc_5 = subprocess.Popen(cmd_5,shell=True) wav_5 = proc_5.communicate()[0] def track_6(): - cmd_6 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_3 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/06.wav" + cmd_6 = "cp \"$(tree -if /home/xpub/audio_3 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/06.wav" proc_6 = subprocess.Popen(cmd_6,shell=True) wav_6 = proc_6.communicate()[0] def track_7(): - cmd_7 = "ffmpeg -y -i \"$(tree -if /home/xpub/audio_3 | grep -Eo '^(.*/)([^/]*)\.mp3$' | shuf -n 1)\" /home/xpub/wav_files/07.wav" + cmd_7 = "cp \"$(tree -if /home/xpub/audio_3 | grep -Eo '^(.*/)([^/]*)\.wav$' | shuf -n 1)\" /home/xpub/wav_files/07.wav" proc_7 = subprocess.Popen(cmd_7,shell=True) wav_7 = proc_7.communicate()[0] diff --git a/vlc-stop.sh b/vlc-stop.sh new file mode 100644 index 0000000..e2c13a8 --- /dev/null +++ b/vlc-stop.sh @@ -0,0 +1,2 @@ +#!/bin/bash +systemctl stop vlc.service diff --git a/vlc.service b/vlc.service new file mode 100644 index 0000000..e4fbe1b --- /dev/null +++ b/vlc.service @@ -0,0 +1,13 @@ +[Unit] +Description=VLC +After=sound.target + +[Service] +Type=forking +User=xpub +Environment="DISPLAY=:0.0" +ExecStart=/home/xpub/vlcwrapper.sh +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/vlc.timer b/vlc.timer new file mode 100644 index 0000000..ec7af4b --- /dev/null +++ b/vlc.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run VLC every minute + +[Timer] +OnCalendar=*-*-* *:*:00 +Unit=vlc.service + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/vlcwrapper.sh b/vlcwrapper.sh new file mode 100755 index 0000000..ddb731b --- /dev/null +++ b/vlcwrapper.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# cvlc --alsa-audio-device jack https://streaming.domainepublic.net/radiopanik.mp3?94ba3374-26b9-4f04-91d2-293ebe24d5c0 +cvlc --alsa-audio-device jack https://s2.radio.co/sde6c7b42e/listen +# --alsa-audio-device jack / hw:1