Add MacOS .app support via Platypus, change port to 13500

This commit is contained in:
Matthew Stratford 2020-11-01 00:38:46 +00:00
parent 5228cfd279
commit 90b6707cdf
No known key found for this signature in database
GPG key ID: 9E53C8B3F0B57395
9 changed files with 5357 additions and 6 deletions

5297
build/BAPSicle.platypus Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
brew install tcl cd "$(dirname "$0")"
pip3 install -r requirements.txt pip3 install -r requirements.txt
pip3 install -r requirements-macos.txt pip3 install -r requirements-macos.txt
@ -10,3 +10,10 @@ python3 ./generate-build-exe-config.py
python3 ./build-exe.py python3 ./build-exe.py
bash ./build-exe-pyinstaller-command.sh bash ./build-exe-pyinstaller-command.sh
rm ./*.spec
brew install platypus
platypus --load-profile ./BAPSicle.platypus --overwrite ./output/BAPSicle.app

BIN
build/icon.icns Normal file

Binary file not shown.

BIN
build/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

27
build/macos-platypus.sh Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
if [ "$1" == "" ]
then
echo "DISABLED|BAPSicle Server"
echo "----"
if curl --output /dev/null --silent --head --fail --max-time 1 "http://localhost:13500"
then
echo "Status"
echo "Config"
echo "Logs"
echo "----"
echo "Stop Server"
else
echo "DISABLED|Status"
echo "DISABLED|Config"
echo "DISABLED|Logs"
echo "----"
echo "Start Server"
fi
exit
fi
if [ "$1" == "Stop Server" ]
then
curl "http://localhost:13500/quit"
else
./BAPSicle "$1"
fi

View file

@ -28,7 +28,7 @@ nssm set %service_name% AppStopMethodConsole 5000
nssm set %service_name% AppStopMethodWindow 5000 nssm set %service_name% AppStopMethodWindow 5000
nssm set %service_name% AppStopMethodThreads 5000 nssm set %service_name% AppStopMethodThreads 5000
nssm set %service_name% DisplayName "BAPSicle Server" nssm set %service_name% DisplayName "BAPSicle Server"
nssm set %service_name% Description "The next gen Broadcast and Presenting Suite server! Access settings on port 5000." nssm set %service_name% Description "The next gen Broadcast and Presenting Suite server! Access settings on port 13500."
nssm set %service_name% ObjectName LocalSystem nssm set %service_name% ObjectName LocalSystem
nssm set %service_name% Start SERVICE_AUTO_START nssm set %service_name% Start SERVICE_AUTO_START
nssm set %service_name% Type SERVICE_INTERACTIVE_PROCESS nssm set %service_name% Type SERVICE_INTERACTIVE_PROCESS
@ -41,4 +41,4 @@ nssm start %service_name%
timeout 4 /nobreak timeout 4 /nobreak
explorer "http://localhost:5000/" explorer "http://localhost:13500/"

View file

@ -1,5 +1,7 @@
import multiprocessing import multiprocessing
import time import time
import sys
import webbrowser
from server import BAPSicleServer from server import BAPSicleServer
@ -21,4 +23,22 @@ def startServer():
sys.exit(0) sys.exit(0)
if __name__ == '__main__': if __name__ == '__main__':
startServer() if len(sys.argv) > 1:
# We got an argument! It's probably Platypus's UI.
try:
if (sys.argv[1]) == "Start Server":
print("NOTIFICATION:Welcome to BAPSicle!")
webbrowser.open("http://localhost:13500/")
startServer()
if (sys.argv[1] == "Status"):
webbrowser.open("http://localhost:13500/status")
if (sys.argv[1] == "Config"):
webbrowser.open("http://localhost:13500/config")
if (sys.argv[1] == "Logs"):
webbrowser.open("http://localhost:13500/logs")
except Exception as e:
print("ALERT:BAPSicle failed with exception:\n", e)
sys.exit(0)
else:
startServer()

View file

@ -374,7 +374,7 @@ if __name__ == "__main__":
# Do some testing # Do some testing
in_q.put("LOADED?") in_q.put("LOADED?")
in_q.put("PLAY") in_q.put("PLAY")
in_q.put("LOAD:\\Users\\matth\\Documents\\GitHub\\bapsicle\\dev\\test.mp3") in_q.put("LOAD:\\Users\\mstratford\\Documents\\Dev\\GitHub\\bapsicle\\dev\\test.mp3")
in_q.put("LOADED?") in_q.put("LOADED?")
in_q.put("PLAY") in_q.put("PLAY")
print("Entering infinite loop.") print("Entering infinite loop.")

View file

@ -188,7 +188,7 @@ def startServer():
channel_p[channel].start() channel_p[channel].start()
# Don't use reloader, it causes Nested Processes! # Don't use reloader, it causes Nested Processes!
app.run(host='0.0.0.0', port=5000, debug=True, use_reloader=False) app.run(host='0.0.0.0', port=13500, debug=True, use_reloader=False)
def stopServer(): def stopServer():