groundlight / framegrab

Library to easily grab frames from cameras or streams and do simple local analysis
MIT License
18 stars 0 forks source link

Fixing RTSP Grabber Exception Handling #35

Closed timmarkhuff closed 6 months ago

timmarkhuff commented 6 months ago

Previously, when a user did not provide an RTSP URL for an RTSP grabber, it raised this exception:

raise ValueError("RTSP URL should contain exactly one placeholder for the password.")

It would be more helpful to raise an exception that says "please provide an RTSP URL"

I adjusted the order of the guard clauses to allow this to happen.

I also made it possible for users to not use password substitution. We should discuss if this is okay, but I believe some users might want to just have passwords in their yaml, which as far as I know, is okay.

I changed _substitute_rtsp_password to be a static method because it didn't actually use self, and I wanted to write a test for it without having to create an instance of the class.

I added a few tests for the changes I made.