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

[Feature Request] Ability to include sub folders #6

Closed
dcoen opened this issue Apr 3, 2019 · 9 comments
Closed

[Feature Request] Ability to include sub folders #6

dcoen opened this issue Apr 3, 2019 · 9 comments

Comments

@dcoen
Copy link

dcoen commented Apr 3, 2019

I would be wonderful if you could add the ability to point this at a directory and have it crawl all of the directories under it and create videos for every video set it finds.

e.g. Point it at T:\TeslaCam\SavedClips and have it create one video for each of the dated folders under it.

@ehendrix23
Copy link
Owner

Started to look into it. :-)

@dcoen
Copy link
Author

dcoen commented Apr 3, 2019

Awesome! It would be even better if it could recognize that a USB device is plugged in and has a "TeslaCam" directory in it too - instead needing the input argument.

@dcoen
Copy link
Author

dcoen commented Apr 3, 2019

P.S. End game here in my mind is to stick in a USB drive and have this automatically start converting them according to my previously saved preferences.

i.e. stick in USB, see files show up on NAS.

@ehendrix23
Copy link
Owner

Just did a quick look into this. There does not seem to be a cross-platform method to wait for a USB to be plugged in. BUT, there does seem to be a way to get list of drives attached.
Thus, what could be done is:

  1. Execute tesla_dashcam as one would do now but additional parameter to monitor (i.e. --monitor).
  2. Program will check if there is a device attached with the TeslaCam folder. If there is, it will then start converting all the files in there.
  3. Once completed, wait again until USB drive is added again.

Depending on impact, could poll like every minute or every 30 seconds or so.

Few initial questions going through my mind with this:

  1. Should all of them then to be combined into 1 video file or create a separate video per folder? This could be an option (actually might not be a bad option even just with subdirs).
  2. What if for example you plug it in, it starts conversion, then later you take it out. Put it back in your car to later on plug it back into your PC. Folders that were converted before technically speaking would be done again. Would that be expected behavior? If not then I would need to store somewhere what was already done before. This would then need to go into a file to ensure that it is not lost when the program is stopped.

@dcoen
Copy link
Author

dcoen commented Apr 3, 2019

My thoughts RE your questions are:

  1. I think 80% of users would want one video per timestamp-folder. This would correspond to every time you click the record-that icon in the car, you would get one 10 min long video as a result of all this. That being said, if it's easy enough to make it a new option, that would make 100% of peeps happy and also provide benefit for just the subdir-don't-monitor use case as you mentioned.
  2. You can probably get away with just deriving the destination file name before you do anything and see if there is already a file there with that name & therefore assume you already converted it. This assumes that the destination file name will be unique and not use the constant command line argument anymore (that will just be a directory name now). Since the TeslaCam directories are unique by time-stamp, you should also be unique.
    If you want to gold plate this thing, you can add another command line argument for overwrite that will either a) overwrite, b) skip conversion or c) append unique number to file name and convert again.
    Alternatively, you could go all the way and start keeping a log file - just make sure that if someone has multiple Tesla/USBs you can correctly disambiguate them (although the time-stamps across USB will most likely still be unique enough).

@TomFaulkner
Copy link

I second the subfolders. One video per subfolder would be great. I don't mind specifying the path to TeslaCam.

One 10 minute video containing all cameras is what I would think is the ideal default.

@supercazzola
Copy link

first, I want to thank you for all of the work you did to make this awesome utility. I do think crawling directories recursively would be a nice feature. In the meantime, I am happy using the tool as it is. Thank you again for all of the time and effort you put into this.

@ehendrix23
Copy link
Owner

OK,

Took me a bit (mainly due to other activities ... driving my Tesla .)

Got a test release ready (v0.1.9b0). Would appreciate it if you all could test it out. Seems to be working fine for me.

You can see the release notes for it, but just to wet your appetite:

  1. Scanning of sub-folders (this is by default). All movie files from the folder provided and any sub-folders will be processed. A movie file will be created for each folder and put in the output folder you specified using the folder name as filename. Use --exclude_subdirs to prevent scanning sub-folders.

  2. Ability to create 1 video file that has all the video files concatenated. Not default, use --merge for this.

  3. Wait for a partition (drive) that is mounted with in its root the TeslaCam folder. Process all files once mounted (processing will start immediately if drive was already inserted). This is done using --monitor (use --monitor_once to have it stop after the 1st time it was processed, otherwise it will go back waiting for the drive to be ejected and then a new one to be inserted. When using this, the source to be specified works a bit different. When providing . (dot) it will scan for all files (and in sub-folders unless --exclude_subdirs is provided) within the TeslaCam folder. Providing SavedClips will only scan TeslaCam/SavedClips (and sub-folders). Note that if the movie file for the folder already exist in the output folder then the folder will be skipped.

  4. Further, with --monitor (or --monitor_once) there is all the option --delete_source. This will then delete the files (and folder) from the drive once the movie file for that folder has been created.

  5. Each time the program is run it will check if there is a new release available. This can also be executed by the parameter --check_for_update, which will then also provide the release notes if a new release is available. Using --include_test it will also check for any beta (test) releases. Automatic checking can be disabled using --no-check_for_update.

  6. After processing the time it took to process will be provided.

  7. Better handling if a video file from a camera is corrupt (i.e. zero-byte file). Before it would throw an error resulting in nothing being merged for that minute. Now it will just show the black for that camera but continue to merge the video from the other camera.

In reality, now with this release one could almost like "set it and forget it" by using --monitor and --delete_source. The program can be run indefinitely using those 2 options. Anytime the USB drive is then inserted it will detect it, scan and process all video files, and then delete them from the USB drive so that it has sufficient space again.

Let me know of any issues etc.. I've provided both the MacOS and Windows binaries as well.

You can retrieve it from here:
https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9b0

@ehendrix23
Copy link
Owner

Including subfolders is now part of it and default.
Further, ability to monitor for drive is included as well.

Release v0.1.9: https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9

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

4 participants