Coder Social home page Coder Social logo

upgradeq / obs-studio-python-scripting-cheatsheet-obspython-examples-of-api Goto Github PK

View Code? Open in Web Editor NEW
311.0 7.0 32.0 464 KB

:black_circle: OBS Studio API with Python

License: MIT License

Python 99.51% HTML 0.49%
python obs-studio obs-api hotkey callbacks obs-scripts obs api example obs-studio-api

obs-studio-python-scripting-cheatsheet-obspython-examples-of-api's People

Contributors

hahaslav avatar mariomey avatar tutaf avatar upgradeq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

obs-studio-python-scripting-cheatsheet-obspython-examples-of-api's Issues

Help wanted! Offtop: controlling sceneitems within a group

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...

Add Items to Editable List via Script?

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!

[request] "Duplicate source"

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" 😁.

Implicit Settings on Button Callback

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!

Retrieve a obs_source_info from a obs_source_t?

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!

ImportError: DLL load failed

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: Не найден указанный модуль.

[query] Which is better to use...?

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? 😁

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.