Skip to content
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

ExportRecordedData #86

Closed
wants to merge 24 commits into from
Closed

ExportRecordedData #86

wants to merge 24 commits into from

Conversation

paoloo
Copy link
Collaborator

@paoloo paoloo commented Nov 26, 2024

What and Why

Implementation of the functions required to get recorded data as a URI.

Verification Steps

  • mix test test/replay/
  • mix test test/recording/
  • Onvif.Recording.CreateRecording
  • Onvif.Recording.GetRecordingJobs
  • Onvif.Recording.GetRecordings
  • Onvif.Recording.GetRecordingJobs
  • Onvif.Replay.GetServiceCapabilities
  • Onvif.Replay.GetReplayUri

Tested on

Video
Axis ✔️
Uniview
Hikivision
Dahua

@paoloo paoloo requested a review from waranlogesh November 26, 2024 15:12
lib/replay.ex Outdated Show resolved Hide resolved
Co-authored-by: Yuri Oliveira <[email protected]>
@paoloo paoloo marked this pull request as ready for review November 26, 2024 18:19
@paoloo paoloo requested a review from hammeraj as a code owner November 26, 2024 18:19
@paoloo paoloo requested a review from yuriploc November 26, 2024 18:19
Copy link
Collaborator

@yuriploc yuriploc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

recording_token: ~x"//trc:JobConfiguration/tt:RecordingToken/text()"so,
mode: ~x"//trc:JobConfiguration/tt:Mode/text()"so,
priority: ~x"//trc:JobConfiguration/tt:Priority/text()"so
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be parsed / structified with the RecordingJob module?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very specific for this case, the schema is also different. This information is available on other API calls, this is the only one that I was trying to do differently, but if you rather have a standard "austin model" approach, I chan revert to ths standard one

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsing looks exactly the same to me in the code (with the exception that the namespace for JobConfiguration is different), except you aren't pulling the source out here. But it's optional so the parsing should still work if it is present, and then you get a nice struct as the result

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly the namespace difference would cause issues here, but if you could test it just so we know and add a note that the ONVIF api spec has a bug that would be nice

@@ -0,0 +1,168 @@
defmodule Onvif.Recording.Recordings do
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defmodule Onvif.Recording.Recordings do
defmodule Onvif.Recording do

Same as above, without the module stuttering

xmap(
doc,
job_token: ~x"./tt:JobToken/text()"so,
job_configuration: ~x"./tt:JobConfiguration"eo |> transform_by(&parse_job_configuration/1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should tt:JobConfiguration be trc:JobConfiguration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I looked through the docs and it appears that the JobConfiguration in the Create response should also be in the tt namespace but there are inconsistencies with the Onvif documentation

@hammeraj
Copy link
Owner

This is quite large, and it seems like there are some easy demarcations between recordings and job recordings where you could have split it into a few PRs

Onvif.Recording.request(device, args, __MODULE__)
end

def request_body(%{name: name, content: content, max_retention: max_retention}) do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should accept recording configuration as input like we do here. So that we can set all the input attrs. Right now I see we are defaulting to "" for some attrs. With the current approach of map as input we need to start adding new keys if we want to support setting all the attrs from the spec.

image

@paoloo paoloo closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants