1
0
Fork 0
mirror of https://github.com/fastogt/fastocloud_admin.git synced 2025-03-09 23:38:52 +00:00

Start/Stop/Restart multy stream

This commit is contained in:
topilski 2019-06-04 22:49:53 -04:00
parent b13ee6c773
commit edaef13a4d
2 changed files with 26 additions and 17 deletions

View file

@ -25,8 +25,10 @@ class StreamView(FlaskView):
def start(self):
server = current_user.get_current_server()
if server:
sid = request.form['sid']
server.start_stream(sid)
data = request.get_json()
sids = data['sids']
for sid in sids:
server.start_stream(sid)
return jsonify(status='ok'), 200
return jsonify(status='failed'), 404
@ -35,8 +37,10 @@ class StreamView(FlaskView):
def stop(self):
server = current_user.get_current_server()
if server:
sid = request.form['sid']
server.stop_stream(sid)
data = request.get_json()
sids = data['sids']
for sid in sids:
server.start_stream(sid)
return jsonify(status='ok'), 200
return jsonify(status='failed'), 404
@ -45,8 +49,10 @@ class StreamView(FlaskView):
def restart(self):
server = current_user.get_current_server()
if server:
sid = request.form['sid']
server.restart_stream(sid)
data = request.get_json()
sids = data['sids']
for sid in sids:
server.start_stream(sid)
return jsonify(status='ok'), 200
return jsonify(status='failed'), 404
@ -318,8 +324,11 @@ class StreamView(FlaskView):
def remove(self):
server = current_user.get_current_server()
if server:
sid = request.form['sid']
server.remove_stream(sid)
data = request.get_json()
sids = data['sids']
for sid in sids:
server.stop_stream(sid)
server.remove_stream(sid)
return jsonify(status='ok'), 200
return jsonify(status='failed'), 404

View file

@ -46,6 +46,7 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
}
</style>
{{super()}}
{% endblock %}
@ -711,8 +712,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
$.ajax({
url: "{{ url_for('StreamView:remove') }}",
type: "POST",
dataType: 'json',
data: {"sid":sid},
contentType : 'application/json',
data: JSON.stringify({sids: [sid]}),
success: function (response) {
console.log(response);
window.location.reload();
@ -757,8 +758,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
$.ajax({
url: "{{ url_for('StreamView:start') }}",
type: "POST",
dataType: 'json',
data: {"sid":sid},
contentType : 'application/json',
data: JSON.stringify({sids: [sid]}),
success: function (response) {
console.log(response);
// window.location.reload();
@ -773,8 +774,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
$.ajax({
url: "{{ url_for('StreamView:stop') }}",
type: "POST",
dataType: 'json',
data: {"sid":sid},
contentType : 'application/json',
data: JSON.stringify({sids: [sid]}),
success: function (response) {
console.log(response);
// window.location.reload();
@ -789,8 +790,8 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
$.ajax({
url: "{{ url_for('StreamView:restart') }}",
type: "POST",
dataType: 'json',
data: {"sid":sid},
contentType : 'application/json',
data: JSON.stringify({sids: [sid]}),
success: function (response) {
console.log(response);
// window.location.reload();
@ -801,6 +802,5 @@ Dashboard | {{ config['PUBLIC_CONFIG'].site.title }}
});
}
</script>
{% endblock %}