upgradeq / obs-studio-python-scripting-cheatsheet-obspython-examples-of-api Goto Github PK
View Code? Open in Web Editor NEW:black_circle: OBS Studio API with Python
License: MIT License
:black_circle: OBS Studio API with Python
License: MIT License
the opened page said:
The master branch of OBS-Studio-Python-Scripting-Cheatsheet-obspython-Examples-of-API does not contain the path src/example_class.py.
Offtop, help wanted!
Здравствуйте! Изучаю сейчас скриптинг для OBS, правда на пайтоне, и столкнулся с такой проблемой: не получается включать/выключать отображение объекта sceneitem, который находится внутри группы, с помощью obs_sceneitem_set_visible. Отображение самой группы легко переключается, но никак не могу достучаться до объектов внутри нее. Если не трудно, можете объяснить как правильно управлять sceneitem'ами внутри групп? Есть предположение, что группу надо понимать как отдельную сцену со своими sceneitem'ами, но не уверен что это так. Простите, что пишу здесь, не знаю больше способов как с вами связаться...
Hello! I'm learning OBS-scripting now, but it's with Python, and have faced with this issue: I can't control visibility of sceneitems that are inside of a group by obs_sceneitem_set_visible function. Visibility of the group is controlled easily, but I can't control sceneitems inside this group. If it's not difficult, could you please explain how to control sceneitems within a group? I have a suggestion that the group should be considered as a separate scene with its own sceneitems, but I'm not sure if this is the case. Sorry for creating this issue here, I don't know how to contact you by another way...
like src/change_order.py
this file can not run sucessfully
cause obs_scene_enum_items()
's arguments not correct(wasting a lot of my time😔)
It should say "item", not "source".
https://github.com/upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet-obspython-Examples-of-API#toggle-source-visibility
Hi upgradeQ - first off thank you VERY much for your great tutorial/cheatsheet - it has helped me wrap my head around the various OBS objects. I have a question you might be able to answer - let me first setup the problem. I have a string list stored programmatically (e.g. from a pandas dataframe), let's say list_items = ["Item 1", "Item 2", "Item 3"]
. I noticed that the regular list/combo-box has the function obs_obs_property_list_add_string(obs_property_t *p, const char *name, const char *val)
to insert items. My question is if you are familiar with how to do likewise for the editable list? I can't find much in the documentation regarding this. Thank you for your help and advice!
I'm transporting my code that used obs-websockets-py to an OBS script. Now, every request that I did with websockets, I have to do it with Python. This cheatsheet is very usefull for me! Now, I have to transport this simple code:
ws.call(requests.DuplicateSceneItem(item, fromScene=fromScene, toScene=toScene))
But I think it is not that simple to do it as script. Can you give me a hand? Also, it would be great if there was both options: "Reference" and "Duplicate" 😁.
Hi, sorry to bother it's me again. I have another question popping up in the property_modification.py
example. Namely, in callback
you mention that settings are passed implicitly, however, how do you access them within the callback? I've tried a for key, val in kwargs.items(): print(key, val)
, but it does not produce anything. Thank you!
Hi!
I was wondering if you could maybe help me with this.
I'm trying to retrieve a obs_source_info
from a obs_source_t
but can't figure how to. Both types are documented on the same page so I guess they are related. I can't access the obs_source_info
's attributes directly on obs_source_t
(i.e. AttributeError: 'SwigPyObject' object has no attribute '…'
) but I can't find any method like get_source_info
either.
I am especially interested in the media_get_time
attribute from obs_source_info
.
Here is the code I have so far.
I retrieve the source of a scene item (i.e. obs_source_t
) and I'd would like to get its obs_source_info
:
import obspython as obs
current_scene = obs.obs_frontend_get_current_scene()
print("current_scene", current_scene) # <Swig Object of type 'obs_source_t *' at 0x12...>
if current_scene:
scene = obs.obs_scene_from_source(current_scene)
scene_item = obs.obs_scene_find_source(scene, "stream_source")
print("scene_item", scene_item) # <Swig Object of type 'obs_sceneitem_t *' at 0x12...>
if scene_item:
source = obs.obs_sceneitem_get_source(scene_item)
print("source", source) # <Swig Object of type 'obs_source_t *' at 0x12...>
print("source media_get_time", source.media_get_time) # AttributeError: 'SwigPyObject' object has no attribute 'media_get_time'
# How to get a obs_source_info then?
# …
Thanks!
D:\Programms\obs-studio\data\obs-scripting\64bit> python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import obspython
Traceback (most recent call last):
File "D:\Programms\obs-studio\data\obs-scripting\64bit\obspython.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in create_module
File "", line 205, in _call_with_frames_removed
ImportError: DLL load failed: Не найден указанный модуль.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "D:\Programms\obs-studio\data\obs-scripting\64bit\obspython.py", line 17, in
_obspython = swig_import_helper()
File "D:\Programms\obs-studio\data\obs-scripting\64bit\obspython.py", line 16, in swig_import_helper
return importlib.import_module('obspython')
File "C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: Не найден указанный модуль.
Seeing change_order.py, I realized that you used @contextmanager
functions to use with
statement. You didn't use them in other scripts. I would like to know why you used it. Is it better? Does it close automatically the reference or something like that?
Another question: can I ask this queries here? 😁
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.