Cleanup and readme notes

This commit is contained in:
Lukas Bachschwell 2020-04-05 18:29:27 +02:00
parent 5c65f305da
commit 4d8c80c2d8
Signed by: lbsadmin
GPG Key ID: CCC6AA87CC8DF425
7 changed files with 29 additions and 206 deletions

View File

@ -1,68 +0,0 @@
function script_description()
return "This script lets you select a text source to force it to reread files every frame instead of once per second."
end
obs = obslua
source_name = nil
local open = io.open
local function read_file(path)
local file = open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
function script_update(settings)
source_name = obs.obs_data_get_string(settings, "source")
filepath = obs.obs_data_get_string(settings, "filepath")
local fileContent = read_file("/Users/LB/Desktop/z_Projects/chorus-client/racestate.txt");
set_text(fileContent)
end
function script_properties()
local props = obs.obs_properties_create()
local p = obs.obs_properties_add_list(props, "source", "Text Source", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local p2 = obs.obs_properties_add_path(props, "filepath", "File", obs.OBS_PATH_FILE, nil, nil)
local sources = obs.obs_enum_sources()
if sources ~= nil then
for _, source in ipairs(sources) do
source_id = obs.obs_source_get_id(source)
if source_id == "text_gdiplus" or source_id == "text_ft2_source" or source_id == "text_pango_source" then
local name = obs.obs_source_get_name(source)
obs.obs_property_list_add_string(p, name, name)
end
end
end
obs.source_list_release(sources)
return props
end
function set_text(text)
local source = obs.obs_get_source_by_name(source_name)
if source ~= nil then
local settings = obs.obs_data_create()
obs.obs_data_set_string(settings, "text", text)
obs.obs_source_update(source, settings)
obs.obs_data_release(settings)
obs.obs_source_release(source)
end
end
function script_tick(seconds)
if source_name == nil then return end
local fileContent = read_file(filepath);
set_text(fileContent)
end

View File

@ -1,68 +0,0 @@
function script_description()
return "This script lets you select a text source to force it to reread files every frame instead of once per second."
end
obs = obslua
source_name = nil
local open = io.open
local function read_file(path)
local file = open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
function script_update(settings)
source_name = obs.obs_data_get_string(settings, "source")
filepath = obs.obs_data_get_string(settings, "filepath")
local fileContent = read_file("/Users/LB/Desktop/z_Projects/chorus-client/racestate.txt");
set_text(fileContent)
end
function script_properties()
local props = obs.obs_properties_create()
local p = obs.obs_properties_add_list(props, "source", "Text Source", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local p2 = obs.obs_properties_add_path(props, "filepath", "File", obs.OBS_PATH_FILE, nil, nil)
local sources = obs.obs_enum_sources()
if sources ~= nil then
for _, source in ipairs(sources) do
source_id = obs.obs_source_get_id(source)
if source_id == "text_gdiplus" or source_id == "text_ft2_source" or source_id == "text_pango_source" then
local name = obs.obs_source_get_name(source)
obs.obs_property_list_add_string(p, name, name)
end
end
end
obs.source_list_release(sources)
return props
end
function set_text(text)
local source = obs.obs_get_source_by_name(source_name)
if source ~= nil then
local settings = obs.obs_data_create()
obs.obs_data_set_string(settings, "text", text)
obs.obs_source_update(source, settings)
obs.obs_data_release(settings)
obs.obs_source_release(source)
end
end
function script_tick(seconds)
if source_name == nil then return end
local fileContent = read_file(filepath);
set_text(fileContent)
end

View File

@ -1,68 +0,0 @@
function script_description()
return "This script lets you select a text source to force it to reread files every frame instead of once per second."
end
obs = obslua
source_name = nil
local open = io.open
local function read_file(path)
local file = open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
function script_update(settings)
source_name = obs.obs_data_get_string(settings, "source")
filepath = obs.obs_data_get_string(settings, "filepath")
local fileContent = read_file("/Users/LB/Desktop/z_Projects/chorus-client/racestate.txt");
set_text(fileContent)
end
function script_properties()
local props = obs.obs_properties_create()
local p = obs.obs_properties_add_list(props, "source", "Text Source", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING)
local p2 = obs.obs_properties_add_path(props, "filepath", "File", obs.OBS_PATH_FILE, nil, nil)
local sources = obs.obs_enum_sources()
if sources ~= nil then
for _, source in ipairs(sources) do
source_id = obs.obs_source_get_id(source)
if source_id == "text_gdiplus" or source_id == "text_ft2_source" or source_id == "text_pango_source" then
local name = obs.obs_source_get_name(source)
obs.obs_property_list_add_string(p, name, name)
end
end
end
obs.source_list_release(sources)
return props
end
function set_text(text)
local source = obs.obs_get_source_by_name(source_name)
if source ~= nil then
local settings = obs.obs_data_create()
obs.obs_data_set_string(settings, "text", text)
obs.obs_source_update(source, settings)
obs.obs_data_release(settings)
obs.obs_source_release(source)
end
end
function script_tick(seconds)
if source_name == nil then return end
local fileContent = read_file(filepath);
set_text(fileContent)
end

View File

@ -1,10 +1,37 @@
# ChorusOBSsync # Chorus32 OBS Sync
This project tries to connect to a Chorus32 DroneRacing Laptimer and then sends the laptimes to OBS Studio via its websockets api. It is written in Rust
This project is still under development, but feel free to play with it, no guarantees made.
# Basic Concepts
## Basic Laptimes
For normal use one would create some scenes in OBS with Freetype Texts. These text sources should have names like "RX1LapTime" or similar and be put into the config.toml
Then add the IP address of your OBS into the config, connect the Chorus32 to your Network (Using the client mode) and add its IP to the config as well.
Then start using `cargo run`
You should be able to see your laptimes in OBS
## Masking unused Channels (very experimental)
For recieving the drones in OBS I use some Eachine Receivers. But when a drone is powered off that receiver will display noise and noise degrades the quality of the stream (cause it is though for the codec to encode a random pattern efficiently, so it takes more datarate)
Therefore I add a filter onto the camera source in OBS. The Filter should be Type Blend (Addition), 100% Opacity and Color White. Then select the bars.png from the OBSTools Folder
and name the filter eg mask. (Make sure to add the name to the Config.toml file). You can then set a threshold rssi to enable the bars overlay once the receiver powers off.
## Filemode
When the filemode option is on the laptime info is written into text files than can be fetched from OBS, so the websocket api is not needed. This used to be the simpelst way to add data into obs.
## Todo
- [ ] Finish serde config parsing (more optionals, no filemode flag in clap)
- [x] No OBS Mode - [x] No OBS Mode
- [x] Less errors! - [x] Less errors!
- [x] OBS Error message decodinng - [x] OBS Error message decodinng
- [x] Initial states for race and beginning - [x] Initial states for race and beginning
- [ ] Finish serde config parsing (more optionals, no filemode flag in clap)
- [ ] make lap decoding inndepedent of amount - [ ] make lap decoding inndepedent of amount
- [ ] Make parsing rssi better! - [ ] Make parsing rssi better!
- [ ] Could add some disconection handeling of the chorus device in rssi request (if it fails 5 times churus has disconnnected and conenction should be reinitialized ?!) - [ ] Could add some disconection handeling of the chorus device in rssi request (if it fails 5 times churus has disconnnected and conenction should be reinitialized ?!)