volume?
This commit is contained in:
parent
77871514af
commit
67367c50e1
1 changed files with 7 additions and 7 deletions
14
app.py
14
app.py
|
|
@ -4,12 +4,13 @@ import time
|
|||
from flask import Flask, abort, request, jsonify, g, url_for
|
||||
import jwt
|
||||
from pipewire_python import link
|
||||
from pipewire_python.controller import Controller
|
||||
|
||||
inputs = link.list_inputs()
|
||||
outputs = link.list_outputs()
|
||||
source = outputs[-1]
|
||||
sink = inputs[-1]
|
||||
|
||||
audio_controller = Controller()
|
||||
|
||||
# initialization
|
||||
app = Flask(__name__)
|
||||
|
|
@ -46,12 +47,6 @@ def get_auth_token():
|
|||
return jsonify({'token': token.decode('ascii'), 'duration': 600})
|
||||
|
||||
|
||||
@app.route('/api/resource')
|
||||
# @auth.login_required
|
||||
def get_resource():
|
||||
return jsonify({'data': 'Hello, %s!' % g.user.username})
|
||||
|
||||
|
||||
@app.route('/api/connect')
|
||||
# @auth.login_required
|
||||
def connect():
|
||||
|
|
@ -64,6 +59,11 @@ def disconnect():
|
|||
source.disconnect(sink)
|
||||
return jsonify({'data': 'disconnect'})
|
||||
|
||||
@app.route('/api/volume/<float:vol>')
|
||||
def set_volume(vol):
|
||||
audio_controller.set_config(volume=vol)
|
||||
return jsonify({'data': 'volume set'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
# if not os.path.exists('db.sqlite'):
|
||||
# db.create_all()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue