Script does not handle impact recording types
ThinkSteve74 opened this issue · comments
The script currently does not handle impact recording types ('I') which causes an exception when sorting the files after getting the list from the dashcam:
ERROR 'NoneType' object has no attribute 'datetime'
I think there will be more types of filenames according to: https://blackvue.com/major-update-improved-blackvue-app-ui-dark-mode-live-event-upload-and-more/.
The ones not metioned on that page are MNP.
The solution seems to be simple:
filename_re = re.compile(r"""(?P<base_filename>(?P\d\d\d\d)(?P\d\d)(?P\d\d)
_(?P\d\d)(?P\d\d)(?P\d\d))
_(?P[NEPM])
(?P[FR])
.(?Pmp4)""", re.VERBOSE)
Becomes:
filename_re = re.compile(r"""(?P<base_filename>(?P\d\d\d\d)(?P\d\d)(?P\d\d)
_(?P\d\d)(?P\d\d)(?P\d\d))
_(?P[MEATBOIRXGNP])
(?P[FR])
.(?Pmp4)""", re.VERBOSE)
And manual_event_sort_key gets updarted to something like:
def manual_event_sort_key(recording):
"""sorts by recording type, then datetime, then front/rear direction"""
return "MEATBOIRXGNP".find(recording.type), recording.datetime, "FR".find(recording.direction)
Thanks,
Thank you for your report!
I made the necessary changes pretty much as you suggested.
I would appreciate it if you were able to test it out on a real cam and let me know how that goes. (I tested this on the emulator, and it'll be a bit before I drive.)
I created a github account just to thank you both, and to let you know that this resolved the issue for me on my DR900x.
I've been using this script for a few months and then it broke yesterday - it may or may not have been due to upgrading to firmware 1.006.
Huge thanks to acolomba for writing this script, and thanks to ThinkSteve74 for fixing this issue!
Great, I believe I can close this issue then.
Thank you both very much!