Skip to content

Commit 30ec25b

Browse files
authored
Release 0.1.12 (#57)
* Temp exe * Updated temporary exe file * Delete tesla_dashcam_190b3.exe * Fix check release * Updated README with initial 0.1.10 and additional TODO Updated README with items already in progress for 0.1.10 Added items to TODO list * Fix running tesla_dashcam when installed with pip * Updated README with additional items done for next release * Initial set of updates for 0.1.10. * Timestamp sorting fix * Added Chapter Markers in To-Do list * Made behaviour for single folder same as multiple Made behaviour for single folder discovered same as multiple. * --delete_souce now also for execution without --monitor * Updated README and reorged 0.1.10 items a bit * Fix deleting foldr file if name same as clip name * Exclude ffmpeg.exe * Default output folder, change in folder filename Added default output folder Changed folder filename to <Start_Timestamp>_<End_Timestamp> Source is optional now * Set Python version to 3.7 only * Updated readme for 0.1.10 Finished updating readme * Set version to 0.1.10 * Fixed metadata issue Fixed if all 3 files of a timestamp are corrupt Ensured that video_timestamp is dateformat if timestamp was retrieved from filename instead of clip. * Fixed issue if camera file was missing Fixed an issue if a camera file was missing. Removed now unused MOVIE_LAYOUT dictionary * Release 0.1.10 * Fixed traceback issue for ffmpeg (#39) * Added option to test distribution with TestPyPi * Version change to 0.1.11 * Updated README Added 2 fixes for 0.1.11 Added option to crop videos in TODO section * Fixed output folder issues * Missing piece for PyPi Figured out missing piece allowing easy execution from PyPi. * Updated links to executables * Removed DIAGONAL as it is not implemented * Formatting update with Black Formatting update with Black * Fix for folder deletion with empty files Fix for issue #40 where folders would not be deleted if there are 0-byte or corrupt files within the folder * Fixed --output with filename issue Fixed issue #52 with --output when providing a filename * Changed concat for movie creation Changed how to concatenate the clips in create_movie resulting in massive performance improvement. * Updated README for create_movie Updated readme for create_movie performance improvement * Add chapter markers Concatenated video files now will have chapter markers. Folder level will have chapters for each clip, merged will have chapters for each folder * removed single clip exception Removed single clip exception for creating movie as we now add chapters in it as well hence need to process. * Add flags -movstart and +faststart Added flags -movstart and +faststart to movies (not clips) created * Updated README * Version change to 0.1.12 beta 0 * Further fix for output argument Further fix for output argument to determine what was provided. * Fix chapter settings when video speed is adjusted Chapter settings were not taking into consideration that clips were sped-up or slowed-down. * Fix issue 54 (win10toast notifier) Potential fix for issue 54 * Missed something * Fix traceback with invalid output path * Trigger file or folder and few fixes Option to provide a trigger file or folder for monitoring. Fix for sub-dir scanning Fix for nothing being processed if . was provided as source. * Cosmetic fixes * Added chapter offset & movie filename fix Added optional chapter offset for merged video file. Fix for moviefile when output filename is provided on monitor * Beta version 0.1.12.2 * Fix typo in new version check output (#56) * Update README * Final prep of README for 0.1.12 * Cleanup * Fixes for chapter and deletion with corruptio files Fix for chapter of 1st clip Fix for deletion of files & folders with corrupt files. * Fix oopsie * Fix if file does not have timestamp Fix if fiel does not have timestamp for issue introduced with fixing deletion of corrupt/empty files * Added durations of resulting movie to print out * Version to 0.1.12 for release
1 parent ea11d61 commit 30ec25b

File tree

4 files changed

+1573
-1206
lines changed

4 files changed

+1573
-1206
lines changed

README.rst

+78-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Using this program, one can combine all of these into 1 video file. The video of
1313
into one picture, with the video for all the minutes further put together into one.
1414

1515
By default sub-folders are included when retrieving the video clips. One can, for example, just provide the path to the
16-
respective SavedClips folder (i.e. e:\TeslaCam\SavedClips for Windows if drive has letter E,
16+
respective SavedClips folder (i.e. e:\\TeslaCam\\SavedClips for Windows if drive has letter E,
1717
/Volumes/Tesla/TeslaCam/SavedClips on MacOS if drive is mounted on /Volumes/Tesla) and then all folders that were created
1818
within the SavedClips folder will be processed. There will be a movie file for each folder.
1919
When using the option --merge there will also be a movie file created combining the movies from all the folders into 1.
@@ -30,8 +30,24 @@ file for that folder already exist.
3030
It is still possible for --monitor_once to provide a output filename instead of just a folder. For --monitor the filename
3131
will be ignored and the files will be created within the path specified using a unique name instead.
3232

33+
Using the option --monitor_trigger_file one can have it check for existence of a certain file or folder for starting
34+
processing instead of waiting for the disk with the TeslaCam folder to become available. Once available processing will
35+
start, if a trigger file was provided then upon completion of processing the file will then be deleted. If it was a folder
36+
then it will wait for the folder to be removed by something else (or for example link removed) and then wait again for it
37+
to appear again.
38+
If no source folder is provided then folder SavedClips will be processed with assumption it is in the same location as
39+
the trigger file. If source folder is an absolute path (i.e. /Videos/Tesla) then that will be used as source location.
40+
If it is a relative path (i.e. Tesla/MyVideos) then the path will be considered to be relative based on the location
41+
provided for the trigger file.
42+
3343
When using --merge, the name of the resulting video file will be appended with the current timestamp of processing when
3444
--monitor parameter is used, this to ensure that the resulting video file is always unique.
45+
Option --chapter_offset can be provided to offset the chapter markers within the merged video. A negative number would
46+
result in the chapter marker being set not at the start for the folder video but instead be set provided number of
47+
seconds before the end of that video. For example, with 10 minute video for a folder a value of -120 would result
48+
in the chapter markers being set 2 minutes before the end of that video. A positive number will result in chapter marker
49+
being set to provided number of seconds after the start of the video. Value of 600 would result in chapter markers being
50+
set 5 minutes into that folder's video.
3551

3652
If --merge is not provided as an option and there are multiple sub-folders then the filename (if provided in output)
3753
will be ignored. Instead the files will all be placed in the folder identified by the output parameter, one movie file
@@ -51,8 +67,8 @@ Binaries
5167

5268
Stand-alone binaries can be retrieved:
5369

54-
- Windows: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.11/tesla_dashcam.zip
55-
- MacOS (OSX): https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.11/tesla_dashcam.dmg
70+
- Windows: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.12/tesla_dashcam.zip
71+
- MacOS (OSX): https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.12/tesla_dashcam.dmg
5672

5773
`ffmpeg <https://www.ffmpeg.org/legal.html>`_ is included within the respective package.
5874
ffmpeg is a separately licensed product under the `GNU Lesser General Public License (LGPL) version 2.1 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>`_.
@@ -113,9 +129,10 @@ Usage
113129
.. code:: bash
114130
115131
usage: tesla_dashcam.py [-h] [--version] [--exclude_subdirs | --merge]
116-
[--output OUTPUT] [--keep-intermediate]
117-
[--delete_source] [--no-notification]
118-
[--layout {WIDESCREEN,FULLSCREEN,DIAGONAL,PERSPECTIVE}]
132+
[--chapter_offset CHAPTER_OFFSET] [--output OUTPUT]
133+
[--keep-intermediate] [--delete_source]
134+
[--no-notification]
135+
[--layout {WIDESCREEN,FULLSCREEN,PERSPECTIVE}]
119136
[--scale CLIP_SCALE] [--mirror | --rear] [--swap]
120137
[--no-swap] [--slowdown SLOW_DOWN]
121138
[--speedup SPEED_UP]
@@ -126,6 +143,7 @@ Usage
126143
[--quality {LOWEST,LOWER,LOW,MEDIUM,HIGH}]
127144
[--compression {ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow}]
128145
[--ffmpeg FFMPEG] [--monitor] [--monitor_once]
146+
[--monitor_trigger MONITOR_TRIGGER]
129147
[--check_for_update] [--no-check_for_update]
130148
[--include_test]
131149
[source [source ...]]
@@ -139,11 +157,16 @@ Usage
139157
140158
optional arguments:
141159
-h, --help show this help message and exit
142-
--version show program's version number and exit
143-
--exclude_subdirs Do not search all sub folders for video files to.
160+
--version show program''s version number and exit
161+
--exclude_subdirs Do not search sub folders for video files to process.
144162
(default: False)
145163
--merge Merge the video files from different folders into 1
146164
big video file. (default: False)
165+
--chapter_offset CHAPTER_OFFSET
166+
Offset in seconds for chapters in merged video.
167+
Negative offset is \# of seconds before the end of the
168+
subdir video, positive offset if \# of seconds after
169+
the start of the subdir video. (default: 0)
147170
--output OUTPUT Path/Filename for the new movie file. Intermediate files will be stored in same folder.
148171
(default: /Users/ehendrix/Movies/Tesla_Dashcam/)
149172
--keep-intermediate Do not remove the intermediate video files that are
@@ -161,7 +184,6 @@ Usage
161184
--scale CLIP_SCALE Set camera clip scale, scale of 1 is 1280x960 camera clip. Defaults:
162185
WIDESCREEN: 1/2 (640x480, video is 1920x480)
163186
FULLSCREEN: 1/2 (640x480, video is 1280x960)
164-
DIAGONAL: 1/4 (320x240, video is 980x380)
165187
PERSPECTIVE: 1/4 (320x240, video is 980x380)
166188
(default: None)
167189
--mirror Video from side cameras as if being viewed through the
@@ -196,8 +218,7 @@ Usage
196218
For more information on supported cards see:
197219
https://developer.nvidia.com/video-encode-decode-gpu-support-matrix (default: False)
198220
--ffmpeg FFMPEG Path and filename for ffmpeg. Specify if ffmpeg is not
199-
within path. (default: /Users/ehendrix/Documents/GitHu
200-
b/tesla_dashcam/tesla_dashcam/ffmpeg)
221+
within path. (default: tesla_dashcam/ffmpeg)
201222
202223
Timestamp:
203224
Options for timestamp:
@@ -244,6 +265,13 @@ Usage
244265
--monitor_once Enable monitoring and exit once drive with TeslaCam
245266
folder has been attached and files processed.
246267
(default: False)
268+
--monitor_trigger MONITOR_TRIGGER
269+
Trigger file to look for instead of waiting for drive
270+
to be attached. Once file is discovered then
271+
processing will start, file will be deleted when
272+
processing has been completed. If source is not
273+
provided then folder where file is located will be
274+
used as source. (default: None)
247275
248276
Update Check:
249277
Check for updates
@@ -258,7 +286,6 @@ Usage
258286
259287
260288
261-
262289
Layout:
263290
-------
264291
@@ -527,6 +554,30 @@ Also create a movie file that has them all merged together.
527554
528555
python3 tesla_dashcam.py --slowdown 2 --rear --merge --output /home/me/Tesla --monitor_once SavedClips
529556
557+
Enable monitoring using a trigger file (or folder) to start processing all the files from SavedClips.
558+
Note that for source we provide the folder name (SavedClips), the complete path will be created by the program using the
559+
path of the trigger file (if it is a file) or folder. Videos are stored in folder specified by --output. Videos from all
560+
the folders are then merged into 1 folder with name TeslaDashcam followed by timestamp of processing (timestamp is
561+
added automatically). Chapter offset is set to be 2 minutes (120 seconds) before the end of the respective folder clips.
562+
563+
* Windows:
564+
565+
.. code:: bash
566+
567+
tesla_dashcam.exe --merge --chapter_offset -120 --output c:\Tesla\TeslaDashcam.mp4 --monitor --monitor_trigger x:\TeslaCam\start_processing.txt SavedClips
568+
569+
* Mac:
570+
571+
.. code:: bash
572+
573+
tesla_dashcam --merge --chapter_offset -120 --output /Users/me/Desktop/Tesla --monitor --monitor_trigger /Users/me/TeslaCam/start_processing.txt SavedClips
574+
575+
* Linux:
576+
577+
.. code:: bash
578+
579+
python3 tesla_dashcam.py --merge --chapter_offset -120 --output /home/me/Tesla --monitor --monitor_trigger /home/me/TeslaCam/start_processing.txt SavedClips
580+
530581
531582
Argument (Parameter) file
532583
-------------------------
@@ -659,19 +710,30 @@ Release Notes
659710
- Fixed: Python version has to be 3.7 or higher due to use of capture_output `Issue #19 <https://github.com/ehendrix23/tesla_dashcam/issues/19>`_
660711
0.1.11:
661712
- Fixed: Traceback when getting ffmpeg path in Linux `Issue #39 <https://github.com/ehendrix23/tesla_dashcam/issues/39>`_
662-
- Fixed: running tesla_dashcam when installed using pip. `Issue #38 <https://github.com/ehendrix23/tesla_dashcam/issues/38>`_
713+
- Fixed: Running tesla_dashcam when installed using pip. `Issue #38 <https://github.com/ehendrix23/tesla_dashcam/issues/38>`_
663714
- Fixed: Just providing a filename for output would result in traceback.
664715
- Fixed: When providing a folder as output it would be possible that the last folder name was stripped potentially resulting in error.
665-
716+
0.1.12:
717+
- New: Added chapter markers in the concatenated movies. Folder ones will have a chapter marker for each intermediate clip, merged one has a chapter marker for each folder.
718+
- New: Option --chapter_offset for use with --merge to offset the chapter marker in relation to the folder clip.
719+
- New: Added flags -movstart and +faststart for video files better suited with browsers etc. (i.e. YouTube). Thanks to sf302 for suggestion.
720+
- New: Option to add trigger (--monitor_trigger_file) to use existence of a file/folder/link for starting processing instead of USB/SD being inserted.
721+
- Changed: Method for concatenating the clips together has been changed resulting in massive performance improvement (less then 1 second to do concatenation). Big thanks to sf302!
722+
- Fixed: Folders will now be deleted if there are 0-byte or corrupt video files within the folder `Issue #40 <https://github.com/ehendrix23/tesla_dashcam/issues/40>`_
723+
- Fixed: Providing a filename for --output would create a folder instead and not setting resulting file to filename provided `Issue #52 <https://github.com/ehendrix23/tesla_dashcam/issues/52>`_
724+
- Fixed: Thread exception in Windows that ToastNotifier does not have an attribute classAtom (potential fix). `Issue #54 <https://github.com/ehendrix23/tesla_dashcam/issues/54>`_
725+
- Fixed: Traceback when invalid output path (none-existing) is provided or when unable to create target folder in given path.
726+
- Fixed: Including sub dirs did not work correctly, it would only grab the 1st folder.
727+
- Fixed: When using monitor, if . was provided as source then nothing would be processed. Now it will process everything as intended.
728+
- Fixed: File created when providing a filename with --output and --monitor option did not put timestamp in filename to ensure unique filenames
729+
- Fixed: Argument to get release notes was provided incorrectly when checking for updates. Thank you to demonbane for fixing.
666730
667731
TODO
668732
----
669733
670734
* Allow exclusion of camera(s) in output (i.e. don't include right, or don't include front, ...).
671735
* Implement option to crop individual camera output
672736
* Provide option to copy or move from source to output folder before starting to process
673-
* Add chapter markers
674-
* Allow for scanning if there are new folders and process if there are
675737
* Develop method to run as a service with --monitor option
676738
* GUI Front-end
677739
* Support drag&drop of video folder (supported in Windows now, MacOS not yet)

setup.py

+81-46
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@
1414
from setuptools import find_packages, setup, Command # type: ignore
1515

1616
# Package meta-data.
17-
NAME = 'tesla_dashcam'
18-
DESCRIPTION = 'Python program to merge video files created by Tesla ' \
19-
'dashcam'
20-
URL = 'https://github.com/ehendrix23/tesla_dashcam'
21-
22-
AUTHOR = 'Erik Hendrix'
23-
REQUIRES_PYTHON = '>=3.7.0'
17+
NAME = "tesla_dashcam"
18+
DESCRIPTION = "Python program to merge video files created by Tesla " "dashcam"
19+
URL = "https://github.com/ehendrix23/tesla_dashcam"
20+
21+
AUTHOR = "Erik Hendrix"
22+
REQUIRES_PYTHON = ">=3.7.0"
2423
VERSION = None
2524

2625
# What packages are required for this module to be executed?
2726
REQUIRED = [ # type: ignore
28-
'tzlocal',
29-
'requests',
30-
'psutil',
27+
"tzlocal",
28+
"requests",
29+
"psutil",
3130
]
3231

3332
# The rest you shouldn't have to touch too much :)
@@ -40,27 +39,28 @@
4039

4140
# Import the README and use it as the long-description.
4241
# Note: this will only work if 'README.rst' is present in your MANIFEST.in file!
43-
with io.open(os.path.join(HERE, 'README.rst'), encoding='utf-8') as f:
44-
LONG_DESC = '\n' + f.read()
42+
with io.open(os.path.join(HERE, "README.rst"), encoding="utf-8") as f:
43+
LONG_DESC = "\n" + f.read()
4544

4645
# Load the package's __version__.py module as a dictionary.
4746
ABOUT = {} # type: ignore
4847
if not VERSION:
49-
with open(os.path.join(HERE, NAME, '__version__.py')) as f:
48+
with open(os.path.join(HERE, NAME, "__version__.py")) as f:
5049
exec(f.read(), ABOUT) # pylint: disable=exec-used
5150
else:
52-
ABOUT['__version__'] = VERSION
51+
ABOUT["__version__"] = VERSION
52+
5353

5454
class UploadCommand(Command):
5555
"""Support setup.py upload."""
5656

57-
description = 'Build and publish the package.'
57+
description = "Build and publish the package."
5858
user_options = [] # type: ignore
5959

6060
@staticmethod
6161
def status(string):
6262
"""Prints things in bold."""
63-
print('\033[1m{0}\033[0m'.format(string))
63+
print("\033[1m{0}\033[0m".format(string))
6464

6565
def initialize_options(self):
6666
"""Add options for initialization."""
@@ -73,21 +73,62 @@ def finalize_options(self):
7373
def run(self):
7474
"""Run."""
7575
try:
76-
self.status('Removing previous builds…')
77-
rmtree(os.path.join(HERE, 'dist'))
76+
self.status("Removing previous builds…")
77+
rmtree(os.path.join(HERE, "dist"))
7878
except OSError:
7979
pass
8080

81-
self.status('Building Source and Wheel (universal) distribution…')
82-
os.system('{0} setup.py sdist bdist_wheel --universal'.format(
83-
sys.executable))
81+
self.status("Building Source and Wheel (universal) distribution…")
82+
os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable))
8483

85-
self.status('Uploading the package to PyPi via Twine…')
86-
os.system('twine upload dist/*')
84+
self.status("Uploading the package to PyPi via Twine…")
85+
os.system("twine upload dist/*")
8786

88-
self.status('Pushing git tags…')
89-
os.system('git tag v{0}'.format(ABOUT['__version__']))
90-
os.system('git push --tags')
87+
self.status("Pushing git tags…")
88+
os.system("git tag v{0}".format(ABOUT["__version__"]))
89+
os.system("git push --tags")
90+
91+
sys.exit()
92+
93+
94+
class TestUploadCommand(Command):
95+
"""Support setup.py upload."""
96+
97+
description = "Build and publish the package to TestPyPi."
98+
user_options = [] # type: ignore
99+
100+
@staticmethod
101+
def status(string):
102+
"""Prints things in bold."""
103+
print("\033[1m{0}\033[0m".format(string))
104+
105+
def initialize_options(self):
106+
"""Add options for initialization."""
107+
pass
108+
109+
def finalize_options(self):
110+
"""Add options for finalization."""
111+
pass
112+
113+
def run(self):
114+
"""Run."""
115+
try:
116+
self.status("Removing previous builds…")
117+
rmtree(os.path.join(HERE, "dist"))
118+
except OSError:
119+
pass
120+
121+
self.status("Building Source and Wheel (universal) distribution…")
122+
os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable))
123+
124+
self.status("Uploading the package to TestPyPi via Twine…")
125+
os.system(
126+
"twine upload --repository-url " "https://test.pypi.org/legacy/ dist/*"
127+
)
128+
129+
self.status("Pushing git tags…")
130+
os.system("git tag v{0}".format(ABOUT["__version__"]))
131+
os.system("git push --tags")
91132

92133
sys.exit()
93134

@@ -135,39 +176,33 @@ def run(self):
135176
# Where the magic happens:
136177
setup(
137178
name=NAME,
138-
version=ABOUT['__version__'],
179+
version=ABOUT["__version__"],
139180
description=DESCRIPTION,
140181
long_description=LONG_DESC,
141-
long_description_content_type='text/x-rst',
182+
long_description_content_type="text/x-rst",
142183
author=AUTHOR,
143184
# author_email=EMAIL,
144185
python_requires=REQUIRES_PYTHON,
145186
url=URL,
146-
packages=find_packages(exclude=('tests',)),
187+
packages=find_packages(exclude=("tests",)),
147188
# If your package is a single module, use this instead of 'packages':
148189
# py_modules=['tesla_dashcam'],
149-
150-
entry_points={
151-
'console_scripts': ['tesla_dashcam=tesla_dashcam:main'],
152-
},
190+
entry_points={"console_scripts": ["tesla_dashcam=tesla_dashcam:main"]},
153191
install_requires=REQUIRED,
154192
include_package_data=True,
155-
license='Apache License 2.0',
193+
license="Apache License 2.0",
156194
classifiers=[
157195
# Trove classifiers
158196
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
159-
'Intended Audience :: End Users/Desktop',
160-
'License :: OSI Approved :: Apache Software License',
161-
'Programming Language :: Python',
162-
'Programming Language :: Python :: 3',
163-
'Programming Language :: Python :: 3.7',
164-
'Programming Language :: Python :: Implementation :: CPython',
165-
'Programming Language :: Python :: Implementation :: PyPy',
166-
'Topic :: Multimedia :: Video :: Conversion',
197+
"Intended Audience :: End Users/Desktop",
198+
"License :: OSI Approved :: Apache Software License",
199+
"Programming Language :: Python",
200+
"Programming Language :: Python :: 3",
201+
"Programming Language :: Python :: 3.7",
202+
"Programming Language :: Python :: Implementation :: CPython",
203+
"Programming Language :: Python :: Implementation :: PyPy",
204+
"Topic :: Multimedia :: Video :: Conversion",
167205
],
168206
# $ setup.py publish support.
169-
cmdclass={
170-
'upload': UploadCommand,
171-
'testupload': TestUploadCommand,
172-
},
207+
cmdclass={"upload": UploadCommand, "testupload": TestUploadCommand},
173208
)

tesla_dashcam/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.11'
1+
__version__ = "0.1.12"

0 commit comments

Comments
 (0)