-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db: Update database models for compatibility with 2.0.12 / HEAD #9
base: master
Are you sure you want to change the base?
Conversation
src/models/global.rs
Outdated
#[validate(range(min = 10))] | ||
pub width: u32, | ||
#[validate(range(min = 10))] | ||
pub height: u32, | ||
pub fps: u32, | ||
pub framerates: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's a list of framerates, maybe it should be a Vec<u32>
? Do we have a spec/schema for this somewhere?
src/models/global.rs
Outdated
pub fps: u32, | ||
pub framerates: String, | ||
pub input: u32, | ||
pub resolutions: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for framerates, this looks like a list, maybe it should be a Vec with Resolution suitably defined?
src/models/global.rs
Outdated
pub available_devices: String, | ||
pub device: String, | ||
#[serde(rename = "device_inputs")] | ||
pub device_inputs: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as below, this should be a list if it's a list of devices, not a String
When you are suggesting changes from That are:
Here's the schemas btw: https://github.com/hyperion-project/hyperion.ng/tree/master/libsrc/hyperion/schema |
6d36ed0
to
eafea22
Compare
Yes, I think we need (at least) a custom deserializer, maybe a serializer if we intend to write back to the database. I had a look at the schema and it does say string, but parts of the JS code for the UI seem to treat this as some kind of list? e.g. To give more context on the config loading, I went with the "make the parsing as strict as possible", so we only have to do the hard reverse engineering work once, and then the rest of the engine has ready-to-use explicit values (hence the enums, Options, etc. which are not present in the original schema). |
2ec9949
to
ef79296
Compare
Did not have the time yet to look into those pseudo-list config options .. |
59ef06c
to
0f1b81f
Compare
Deserializes string value into Option<String> -> `None` if string is "None" (case-insensitive check) else `Some(str)`
0f1b81f
to
848c485
Compare
So here's what I gathered from a fresh 2.0.12 install: {
"available_devices": "UVC Camera (046d:0825)",
"blueSignalThreshold": 0,
"cecDetection": false,
"cropBottom": 0,
"cropLeft": 0,
"cropRight": 0,
"cropTop": 0,
"device": "/dev/video1",
"device_inputs": "0",
"enable": true,
"encoding": "YUYV",
"flip": "NO_CHANGE",
"fps": 15,
"fpsSoftwareDecimation": 0,
"framerates": "15",
"greenSignalThreshold": 100,
"hardware_brightness": 128,
"hardware_contrast": 32,
"hardware_hue": 0,
"hardware_saturation": 32,
"height": 480,
"input": 0,
"noSignalCounterThreshold": 200,
"redSignalThreshold": 0,
"resolutions": "8",
"sDHOffsetMax": 0.46,
"sDHOffsetMin": 0.4,
"sDVOffsetMax": 0.9,
"sDVOffsetMin": 0.1,
"signalDetection": false,
"sizeDecimation": 8,
"standard": "NONE",
"width": 640
} It seems that even though the field names are plural, they only represent a single value in the UI (there's only one of each capture device type selected for any single instance), so they're not lists, and their type is as follows:
|
Thx for posting the json representation of the config section in question. For the deserialization #[serde_as]
#[derive(Deserialize, Serialize)]
struct Foo {
// Serialize with Display, deserialize with FromStr
#[serde_as(as = "DisplayFromStr")]
bar: u8,
} |
Good idea, I wasn't aware of |
Incorrect, V4L2 does not inherit all the fields from Framebuffer... annoying! |
f29fefa
to
8cadf4d
Compare
This change makes hyperion.rs compatible with latest hyperion.ng database, so settings can be imported from
hyperion.db
and dumped into TOML-representation if desired.