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

Script does not handle impact recording types #3

Closed
ThinkSteve74 opened this issue May 14, 2021 · 4 comments
Closed

Script does not handle impact recording types #3

ThinkSteve74 opened this issue May 14, 2021 · 4 comments

Comments

@ThinkSteve74
Copy link

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,

@acolomba
Copy link
Owner

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.)

@ThinkSteve74
Copy link
Author

ThinkSteve74 commented May 16, 2021 via email

@adamcurrey
Copy link

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!

@acolomba
Copy link
Owner

Great, I believe I can close this issue then.

Thank you both very much!

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

No branches or pull requests

3 participants