I am working on a project based off of this example https://gitlab.gnome.org/-/snippets/39
我正在做一个基于这个例子https://gitlab.gnome.org/-/snippets/39的项目
I changed this function:
我更改了此函数:
def on_create_session_response(response, results):
if response != 0:
print("Failed to create session: %d"%response)
terminate()
return
global session
session = results['session_handle']
print("session %s created"%session)
remote_desktop_call(portal.SelectDevices, on_select_devices_response,
session,
options={ 'types': dbus.UInt32(7) })
to this:
对此:
def on_create_session_response(response, results):
if response != 0:
print("Failed to create session: %d"%response)
terminate()
os._exit(2)
return
global session
session = results['session_handle']
#print(session)
print("session %s created"%session)
if restore_token is not None:
remote_desktop_call(portal.SelectDevices, on_select_devices_response,
session,
options={ 'types': dbus.UInt32(3), 'restore_token': restore_token ,'persist_mode': dbus.UInt32(2)})
x =GLib.Variant.lookup_value(results,"restore_token",GLib.VariantType("s"))
print(x)
else:
remote_desktop_call(portal.SelectDevices, on_select_devices_response,
session,
options={ 'types': dbus.UInt32(3), 'restore_token': "NULL" ,'persist_mode': dbus.UInt32(2)})
according to the XDG Docs and some browsing of the OBS Studio source code, I should be able to now get a restore token i can capture in this function:
根据XDG文档和对OBS Studio源代码的一些浏览,我现在应该能够获得我可以在此函数中捕获的恢复令牌:
def on_start_response(response, results):
if response != 0:
print("Failed to start: %s"%response)
terminate()
return
print(results)
print("streams:")
if 'streams' in results:
for (node_id, stream_properties) in results['streams']:
print("stream {}".format(node_id))
play_pipewire_stream(node_id)
else:
print("no screen casting")
print("devices: {}".format(results['devices']))
However I am not getting a restore token. my operating system is ubuntu 23.10 amd64. I have flipped thru the OBS source code screencast-portal.c to check my work. and i tried moving the print statement to try and locate the missing token but it isnt coming up. I should be able to get in the results a value that says "restore_token"
但是,我没有得到恢复令牌。我的操作系统是ubuntu 23.10 AMD64。我已经翻阅了OBS源代码Screencast-portal.c来检查我的工作。我尝试移动print语句,试图找到丢失的令牌,但它没有出现。我应该能够在结果中获得一个值“RESTORE_TOKEN”
更多回答
我是一名优秀的程序员,十分优秀!