Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
SHMCamStudio
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
SHMCamStudio
Commits
fa0cb6f4
Commit
fa0cb6f4
authored
Nov 28, 2024
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add obs thread, basic main program logic thread
parent
b9d880fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
6 deletions
+91
-6
shmcamstudio
shmcamstudio
+23
-6
obs.py
shmcs/obs.py
+42
-0
studio.py
shmcs/studio.py
+26
-0
No files found.
shmcamstudio
View file @
fa0cb6f4
...
@@ -60,6 +60,8 @@ builtins.TEMPLATE_DIR=os.path.join(os.path.dirname(__file__), 'templates')
...
@@ -60,6 +60,8 @@ builtins.TEMPLATE_DIR=os.path.join(os.path.dirname(__file__), 'templates')
from
shmcs
import
run_command
,
check_port_available
,
create_daemon
from
shmcs
import
run_command
,
check_port_available
,
create_daemon
from
shmcs.webpanel
import
run_flask_app
from
shmcs.webpanel
import
run_flask_app
from
shmcs.panel
import
create_panel_gui
from
shmcs.panel
import
create_panel_gui
from
shmcs.studio
import
run_camstudio
from
shmcs.obs
import
run_obs_controller
def
main
():
def
main
():
# Setup argument parser
# Setup argument parser
...
@@ -75,10 +77,6 @@ def main():
...
@@ -75,10 +77,6 @@ def main():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
try
:
try
:
# Daemon mode for web interface
if
args
.
nogui
or
args
.
daemon
:
run_flask_app
(
port
=
args
.
port
,
daemon_mode
=
args
.
daemon
)
else
:
# Start web interface in a background thread
# Start web interface in a background thread
web_thread
=
threading
.
Thread
(
web_thread
=
threading
.
Thread
(
target
=
run_flask_app
,
target
=
run_flask_app
,
...
@@ -87,6 +85,25 @@ def main():
...
@@ -87,6 +85,25 @@ def main():
)
)
web_thread
.
start
()
web_thread
.
start
()
obs_thread
=
threading
.
Thread
(
target
=
run_obs_controller
,
kwargs
=
{},
daemon
=
True
)
obs_thread
.
start
()
# Daemon mode for web interface
if
args
.
nogui
or
args
.
daemon
:
run_camstudio
(
args
.
daemon
)
else
:
core_thread
=
threading
.
Thread
(
target
=
run_camstudio
,
kwargs
=
{},
daemon
=
True
)
core_thread
.
start
()
# Launch Tkinter GUI
# Launch Tkinter GUI
window
=
create_panel_gui
()
window
=
create_panel_gui
()
window
.
mainloop
()
window
.
mainloop
()
...
...
shmcs/obs.py
0 → 100644
View file @
fa0cb6f4
# Copyright (C) 2023 Stefy Lanza <stefy@nexlab.net> and SexHack.me
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import
obsws_python
as
obs
import
time
def
on_scene_item_enable_state_changed
(
data
):
print
(
"scscene_item_enable_state_changed"
)
print
(
data
.
attrs
())
print
(
data
.
scene_item_enabled
,
data
.
scene_item_id
,
data
.
scene_name
,
data
.
scene_uuid
)
def
run_obs_controller
():
cl
=
obs
.
EventClient
(
host
=
'192.168.42.115'
,
port
=
4455
,
password
=
'motorol4'
)
cr
=
obs
.
ReqClient
(
host
=
'192.168.42.115'
,
port
=
4455
,
password
=
'motorol4'
)
cl
.
callback
.
register
(
on_scene_item_enable_state_changed
)
print
(
cl
.
callback
.
get
())
#cl.callback.deregister(on_input_mute_state_changed)
now
=
time
.
time
()
-
30
while
True
:
if
(
time
.
time
()
-
now
)
>
30
:
now
=
time
.
time
()
cr
.
broadcast_custom_event
({
'eventData'
:
{
'eventType'
:
'Ping'
,
'time'
:
time
.
time
()}})
time
.
sleep
(
.01
)
shmcs/studio.py
0 → 100644
View file @
fa0cb6f4
# Copyright (C) 2023 Stefy Lanza <stefy@nexlab.net> and SexHack.me
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import
time
import
sys
from
utils
import
create_daemon
def
camstudio
():
while
True
:
time
.
sleep
(
.001
)
def
run_camstudio
(
daemon
=
False
):
if
daemon
and
sys
.
platform
!=
'win32'
:
create_daemon
()
camstudio
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment