Add backend
This commit is contained in:
parent
2288cff13b
commit
a22822f719
|
@ -0,0 +1 @@
|
||||||
|
__pycache__
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
from flask import Flask
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/mute')
|
||||||
|
def mute():
|
||||||
|
call(['pactl', 'set-sink-mute', '0', 'toggle'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/vol_down')
|
||||||
|
def vol_down():
|
||||||
|
call(['pactl', 'set-sink-volume', '0', '-5%'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/vol_up')
|
||||||
|
def vol_up():
|
||||||
|
call(['pactl', 'set-sink-volume', '0', '+5%'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/prev')
|
||||||
|
def prev():
|
||||||
|
call(['cmus-remote', '-p'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/play')
|
||||||
|
def play():
|
||||||
|
call(['cmus-remote', '-u'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/next')
|
||||||
|
def next():
|
||||||
|
call(['cmus-remote', '-n'])
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[uwsgi]
|
||||||
|
plugins = python
|
||||||
|
module = wsgi:app
|
||||||
|
|
||||||
|
socket = /srv/http/i3control/i3control.sock
|
||||||
|
|
||||||
|
master = true
|
||||||
|
threads = 2
|
||||||
|
stats = 127.0.0.1:9191
|
||||||
|
vacuum = true
|
||||||
|
|
||||||
|
die-on-term = true
|
|
@ -0,0 +1,6 @@
|
||||||
|
from run import app
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run()
|
||||||
|
|
Loading…
Reference in New Issue