mirror of
https://github.com/gtalent/sc9k.git
synced 2025-07-03 05:11:44 -05:00
Compare commits
2 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
09065f3e92 | |||
0ff1dfd300 |
36
obs_scene_switcher.py
Normal file
36
obs_scene_switcher.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||||
|
from urllib.parse import urlparse, parse_qs
|
||||||
|
import threading
|
||||||
|
import obspython as obs
|
||||||
|
|
||||||
|
def set_current_scene(scene_name):
|
||||||
|
scenes = obs.obs_frontend_get_scenes()
|
||||||
|
for scene in scenes:
|
||||||
|
name = obs.obs_source_get_name(scene)
|
||||||
|
if name == scene_name:
|
||||||
|
obs.obs_frontend_set_current_scene(scene)
|
||||||
|
return 0
|
||||||
|
return 1
|
||||||
|
|
||||||
|
class RqstHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
up = urlparse(self.path)
|
||||||
|
if up.path == '/Scene':
|
||||||
|
qc = parse_qs(up.query)
|
||||||
|
set_current_scene(qc.get('name', [''])[0])
|
||||||
|
self.send_response(200)
|
||||||
|
self.end_headers()
|
||||||
|
elif up.path == '/ping':
|
||||||
|
self.send_response(200)
|
||||||
|
self.end_headers()
|
||||||
|
|
||||||
|
def log_message(self, format, *args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(name):
|
||||||
|
httpd = HTTPServer(('127.0.0.1', 9302), RqstHandler)
|
||||||
|
httpd.serve_forever()
|
||||||
|
|
||||||
|
t = threading.Thread(target=run, args=(1,), daemon=True)
|
||||||
|
t.start()
|
@ -6,7 +6,9 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QFormLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
Reference in New Issue
Block a user