yuppity / unifi-video-api

Python API for UniFi Video
MIT License
59 stars 11 forks source link

get_recordings(order=) not working as expected #33

Closed mdrobniu closed 3 years ago

mdrobniu commented 3 years ago

Hey Guys

I'm trying to use order= in get_recordings().

Unfortunately it does not work for me.

What am I doing wrong?

>>> for rec in uva.get_recordings(limit=5,order='desc',start_time='2021-02-15T23:33:02'):
...     print(rec)
...
UnifiVideoRecording: {'_id': '602af6aef650c88a5c8b66b7', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:33:08', 'end_time': '2021-02-15T22:34:18'}
UnifiVideoRecording: {'_id': '602af6f6f650c88a5c8b6723', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:34:20', 'end_time': '2021-02-15T22:35:12'}
UnifiVideoRecording: {'_id': '602af72ff650c88a5c8b6777', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:35:18', 'end_time': '2021-02-15T22:37:36'}
UnifiVideoRecording: {'_id': '602af78bf650c88a5c8b6803', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:36:50', 'end_time': '2021-02-15T22:41:50'}
UnifiVideoRecording: {'_id': '602af7a2f650c88a5c8b6826', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:37:16', 'end_time': '2021-02-15T22:42:16'}
>>> for rec in uva.get_recordings(limit=5,order='asc',start_time='2021-02-15T23:33:02'):
...     print(rec)
...
UnifiVideoRecording: {'_id': '602af6aef650c88a5c8b66b7', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:33:08', 'end_time': '2021-02-15T22:34:18'}
UnifiVideoRecording: {'_id': '602af6f6f650c88a5c8b6723', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:34:20', 'end_time': '2021-02-15T22:35:12'}
UnifiVideoRecording: {'_id': '602af72ff650c88a5c8b6777', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:35:18', 'end_time': '2021-02-15T22:37:36'}
UnifiVideoRecording: {'_id': '602af78bf650c88a5c8b6803', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:36:50', 'end_time': '2021-02-15T22:41:50'}
UnifiVideoRecording: {'_id': '602af7a2f650c88a5c8b6826', 'rec_type': 'motionRecording', 'start_time': '2021-02-15T22:37:16', 'end_time': '2021-02-15T22:42:16'}
yuppity commented 3 years ago

You're doing nothing wrong, it's definitely a bug. It's already fixed on master but I'll bump the version tonight and make it available on PyPI too.

yuppity commented 3 years ago

Should be in PyPI now. Let me know if this is still a thing after updating.

mdrobniu commented 3 years ago

That is awesome news. Thanks!

mdrobniu commented 3 years ago

It works now 👍

yuppity commented 3 years ago

Great. Thanks for letting me know.