Van dit project is een service gemaakt:
cat /etc/systemd/system/octotrigger.service [Unit] Description=OctoTrigger Web Listener After=network.target
[Service]
Replace with your actual username (e.g., pi, root, wouter)
User=root Group=root
Replace with the output of 'pwd'
WorkingDirectory=/root/octotrigger
Replace with output of 'which python3' and your script path
ExecStart=/usr/bin/python3 -u server.py
Restart automatically if it crashes
Restart=always RestartSec=5
Output logs to system journal
StandardOutput=journal StandardError=journal
[Install] WantedBy=multi-user.target
Relevante bijbehorende commandos bij de service: sudo systemctl daemon-reload sudo systemctl restart octotrigger /etc/systemd/system/octotrigger.service
Twee voorbeeld commandos om de service aan te roepen:
curl -X POST http://192.168.1.72:5000/trigger
-H "Content-Type: application/json"
-d '{
"playlist_name": "Cyberpunk Industrial Ritual",
"tracks": [
["In This Moment", "The In-Between"],
["In This Moment", "Roots"],
["Poppy", "Bloodmoney"],
["Poppy", "Her"],
["Void of Vision", "ALTAR"]
]
}'
curl -X POST http://192.168.1.72:5000/trigger
-H "Content-Type: application/json"
-d '{
"playlist_name": "Melodic Fury & Siren Screams",
"tracks": [
["Jinjer", "Pisces"],
["Amaranthe", "Archangel"],
["Nightwish", "Noise"],
["Halestorm", "I Miss The Misery"],
["In This Moment", "Whore"],
["Beyond The Black", "Reincarnation"],
["Ad Infinitum", "Seth"],
["The Agonist", "Remnants in Time"],
["Epica", "Abyss of Time - Countdown to Singularity"],
["New Years Day", "Angel Eyes"],
["Seven Spires", "Gods of Debauchery"],
["Delain", "Burning Bridges"],
["Cellar Darling", "Black Moon"],
["Battle Beast", "Eye of the Storm"],
["Eluveitie", "Rebirth"],
["Enemy Inside", "Falling Away"],
["Once Human", "Deadlock"],
["Visions of Atlantis", "Legion of the Seas"],
["Dream State", "Primordial"],
["Flyleaf", "I'm So Sick"],
["Sirenia", "Into the Night"],
["Eleine", "We Shall Remain"],
["Xandria", "You Will Never Be Our God"],
["Leaves' Eyes", "Dark Love Empress"],
["Ignea", "Nomad's Luck"]
]
}'