ez-nvr icon indicating copy to clipboard operation
ez-nvr copied to clipboard

Special chars in camera name

Open pengu-fr opened this issue 1 year ago • 3 comments

Hi,

Thanks for this lightweight NVR !

When using special chars in camera name (Séjour, Façade...), the directory includes single quotes (which isn't nice looking in the filesystem), and the recording fails. NVR: Recording for camera 'Façade' has stopped unexpectedly! Indeed, the directory is created is : /storage/'Séjour'/raw/

I've seen a resolved issue about space in the name... I guess this is linked.

pengu-fr avatar Dec 28 '23 11:12 pengu-fr

If I manually remove the quotes from the directory name, it's kinda working... : /storage/Séjour/raw/ recording are saved, but every minutes it writes a new file, and the log says : NVR: Recording for camera 'Séjour' has stopped unexpectedly!

And... if I symlink the Séjour directory to 'Séjour'... then everything works as expected. ln -sf Séjour/ 'Séjour'

pengu-fr avatar Dec 28 '23 11:12 pengu-fr

Yes, seems like problem due to shlex.quote() which was implemented to resolve space issue. To handle that, space or non-alphanumeric characters can be converted to undersocre "_" and for your special character issue, we can covert accented characters into their base form (e.g., "é" -> "e", "ç" -> "c"). I have updated the code with possible fix in 'dev' branch and docker image with 'dev' tag. Please check and let me know if this fixes your issue.

cyb3rdoc avatar Nov 08 '24 16:11 cyb3rdoc

Thank you for working on this. I'm not sure replacing all non ASCII char to '_' is the way to go here. As long as the filesystem allow them, why would ez-nvr replace these chars ? I'm not a python developper, but maybe this library could help you : https://pathvalidate.readthedocs.io/

Sanitize will remove invalid characters for a target platform (Linux, Windows, macOS, POSIX, universal)

pengu-fr avatar Nov 12 '24 12:11 pengu-fr