Skip to content

Commit

Permalink
Release 0.1.12 (#57)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ehendrix23 authored Aug 20, 2019
1 parent ea11d61 commit 30ec25b
Show file tree
Hide file tree
Showing 4 changed files with 1,573 additions and 1,206 deletions.
94 changes: 78 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Using this program, one can combine all of these into 1 video file. The video of
into one picture, with the video for all the minutes further put together into one.

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

Using the option --monitor_trigger_file one can have it check for existence of a certain file or folder for starting
processing instead of waiting for the disk with the TeslaCam folder to become available. Once available processing will
start, if a trigger file was provided then upon completion of processing the file will then be deleted. If it was a folder
then it will wait for the folder to be removed by something else (or for example link removed) and then wait again for it
to appear again.
If no source folder is provided then folder SavedClips will be processed with assumption it is in the same location as
the trigger file. If source folder is an absolute path (i.e. /Videos/Tesla) then that will be used as source location.
If it is a relative path (i.e. Tesla/MyVideos) then the path will be considered to be relative based on the location
provided for the trigger file.

When using --merge, the name of the resulting video file will be appended with the current timestamp of processing when
--monitor parameter is used, this to ensure that the resulting video file is always unique.
Option --chapter_offset can be provided to offset the chapter markers within the merged video. A negative number would
result in the chapter marker being set not at the start for the folder video but instead be set provided number of
seconds before the end of that video. For example, with 10 minute video for a folder a value of -120 would result
in the chapter markers being set 2 minutes before the end of that video. A positive number will result in chapter marker
being set to provided number of seconds after the start of the video. Value of 600 would result in chapter markers being
set 5 minutes into that folder's video.

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

Stand-alone binaries can be retrieved:

- Windows: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.11/tesla_dashcam.zip
- MacOS (OSX): https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.11/tesla_dashcam.dmg
- Windows: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.12/tesla_dashcam.zip
- MacOS (OSX): https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.12/tesla_dashcam.dmg

`ffmpeg <https://www.ffmpeg.org/legal.html>`_ is included within the respective package.
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>`_.
Expand Down Expand Up @@ -113,9 +129,10 @@ Usage
.. code:: bash
usage: tesla_dashcam.py [-h] [--version] [--exclude_subdirs | --merge]
[--output OUTPUT] [--keep-intermediate]
[--delete_source] [--no-notification]
[--layout {WIDESCREEN,FULLSCREEN,DIAGONAL,PERSPECTIVE}]
[--chapter_offset CHAPTER_OFFSET] [--output OUTPUT]
[--keep-intermediate] [--delete_source]
[--no-notification]
[--layout {WIDESCREEN,FULLSCREEN,PERSPECTIVE}]
[--scale CLIP_SCALE] [--mirror | --rear] [--swap]
[--no-swap] [--slowdown SLOW_DOWN]
[--speedup SPEED_UP]
Expand All @@ -126,6 +143,7 @@ Usage
[--quality {LOWEST,LOWER,LOW,MEDIUM,HIGH}]
[--compression {ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow}]
[--ffmpeg FFMPEG] [--monitor] [--monitor_once]
[--monitor_trigger MONITOR_TRIGGER]
[--check_for_update] [--no-check_for_update]
[--include_test]
[source [source ...]]
Expand All @@ -139,11 +157,16 @@ Usage
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--exclude_subdirs Do not search all sub folders for video files to.
--version show program''s version number and exit
--exclude_subdirs Do not search sub folders for video files to process.
(default: False)
--merge Merge the video files from different folders into 1
big video file. (default: False)
--chapter_offset CHAPTER_OFFSET
Offset in seconds for chapters in merged video.
Negative offset is \# of seconds before the end of the
subdir video, positive offset if \# of seconds after
the start of the subdir video. (default: 0)
--output OUTPUT Path/Filename for the new movie file. Intermediate files will be stored in same folder.
(default: /Users/ehendrix/Movies/Tesla_Dashcam/)
--keep-intermediate Do not remove the intermediate video files that are
Expand All @@ -161,7 +184,6 @@ Usage
--scale CLIP_SCALE Set camera clip scale, scale of 1 is 1280x960 camera clip. Defaults:
WIDESCREEN: 1/2 (640x480, video is 1920x480)
FULLSCREEN: 1/2 (640x480, video is 1280x960)
DIAGONAL: 1/4 (320x240, video is 980x380)
PERSPECTIVE: 1/4 (320x240, video is 980x380)
(default: None)
--mirror Video from side cameras as if being viewed through the
Expand Down Expand Up @@ -196,8 +218,7 @@ Usage
For more information on supported cards see:
https://developer.nvidia.com/video-encode-decode-gpu-support-matrix (default: False)
--ffmpeg FFMPEG Path and filename for ffmpeg. Specify if ffmpeg is not
within path. (default: /Users/ehendrix/Documents/GitHu
b/tesla_dashcam/tesla_dashcam/ffmpeg)
within path. (default: tesla_dashcam/ffmpeg)
Timestamp:
Options for timestamp:
Expand Down Expand Up @@ -244,6 +265,13 @@ Usage
--monitor_once Enable monitoring and exit once drive with TeslaCam
folder has been attached and files processed.
(default: False)
--monitor_trigger MONITOR_TRIGGER
Trigger file to look for instead of waiting for drive
to be attached. Once file is discovered then
processing will start, file will be deleted when
processing has been completed. If source is not
provided then folder where file is located will be
used as source. (default: None)
Update Check:
Check for updates
Expand All @@ -258,7 +286,6 @@ Usage
Layout:
-------
Expand Down Expand Up @@ -527,6 +554,30 @@ Also create a movie file that has them all merged together.
python3 tesla_dashcam.py --slowdown 2 --rear --merge --output /home/me/Tesla --monitor_once SavedClips
Enable monitoring using a trigger file (or folder) to start processing all the files from SavedClips.
Note that for source we provide the folder name (SavedClips), the complete path will be created by the program using the
path of the trigger file (if it is a file) or folder. Videos are stored in folder specified by --output. Videos from all
the folders are then merged into 1 folder with name TeslaDashcam followed by timestamp of processing (timestamp is
added automatically). Chapter offset is set to be 2 minutes (120 seconds) before the end of the respective folder clips.
* Windows:
.. code:: bash
tesla_dashcam.exe --merge --chapter_offset -120 --output c:\Tesla\TeslaDashcam.mp4 --monitor --monitor_trigger x:\TeslaCam\start_processing.txt SavedClips
* Mac:
.. code:: bash
tesla_dashcam --merge --chapter_offset -120 --output /Users/me/Desktop/Tesla --monitor --monitor_trigger /Users/me/TeslaCam/start_processing.txt SavedClips
* Linux:
.. code:: bash
python3 tesla_dashcam.py --merge --chapter_offset -120 --output /home/me/Tesla --monitor --monitor_trigger /home/me/TeslaCam/start_processing.txt SavedClips
Argument (Parameter) file
-------------------------
Expand Down Expand Up @@ -659,19 +710,30 @@ Release Notes
- 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>`_
0.1.11:
- Fixed: Traceback when getting ffmpeg path in Linux `Issue #39 <https://github.com/ehendrix23/tesla_dashcam/issues/39>`_
- Fixed: running tesla_dashcam when installed using pip. `Issue #38 <https://github.com/ehendrix23/tesla_dashcam/issues/38>`_
- Fixed: Running tesla_dashcam when installed using pip. `Issue #38 <https://github.com/ehendrix23/tesla_dashcam/issues/38>`_
- Fixed: Just providing a filename for output would result in traceback.
- Fixed: When providing a folder as output it would be possible that the last folder name was stripped potentially resulting in error.
0.1.12:
- 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.
- New: Option --chapter_offset for use with --merge to offset the chapter marker in relation to the folder clip.
- New: Added flags -movstart and +faststart for video files better suited with browsers etc. (i.e. YouTube). Thanks to sf302 for suggestion.
- 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.
- 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!
- 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>`_
- 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>`_
- 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>`_
- Fixed: Traceback when invalid output path (none-existing) is provided or when unable to create target folder in given path.
- Fixed: Including sub dirs did not work correctly, it would only grab the 1st folder.
- Fixed: When using monitor, if . was provided as source then nothing would be processed. Now it will process everything as intended.
- Fixed: File created when providing a filename with --output and --monitor option did not put timestamp in filename to ensure unique filenames
- Fixed: Argument to get release notes was provided incorrectly when checking for updates. Thank you to demonbane for fixing.
TODO
----
* Allow exclusion of camera(s) in output (i.e. don't include right, or don't include front, ...).
* Implement option to crop individual camera output
* Provide option to copy or move from source to output folder before starting to process
* Add chapter markers
* Allow for scanning if there are new folders and process if there are
* Develop method to run as a service with --monitor option
* GUI Front-end
* Support drag&drop of video folder (supported in Windows now, MacOS not yet)
Expand Down
127 changes: 81 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
from setuptools import find_packages, setup, Command # type: ignore

# Package meta-data.
NAME = 'tesla_dashcam'
DESCRIPTION = 'Python program to merge video files created by Tesla ' \
'dashcam'
URL = 'https://github.com/ehendrix23/tesla_dashcam'
EMAIL = 'hendrix_erik@hotmail.com'
AUTHOR = 'Erik Hendrix'
REQUIRES_PYTHON = '>=3.7.0'
NAME = "tesla_dashcam"
DESCRIPTION = "Python program to merge video files created by Tesla " "dashcam"
URL = "https://github.com/ehendrix23/tesla_dashcam"
EMAIL = "hendrix_erik@hotmail.com"
AUTHOR = "Erik Hendrix"
REQUIRES_PYTHON = ">=3.7.0"
VERSION = None

# What packages are required for this module to be executed?
REQUIRED = [ # type: ignore
'tzlocal',
'requests',
'psutil',
"tzlocal",
"requests",
"psutil",
]

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

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

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


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

description = 'Build and publish the package.'
description = "Build and publish the package."
user_options = [] # type: ignore

@staticmethod
def status(string):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(string))
print("\033[1m{0}\033[0m".format(string))

def initialize_options(self):
"""Add options for initialization."""
Expand All @@ -73,21 +73,62 @@ def finalize_options(self):
def run(self):
"""Run."""
try:
self.status('Removing previous builds…')
rmtree(os.path.join(HERE, 'dist'))
self.status("Removing previous builds…")
rmtree(os.path.join(HERE, "dist"))
except OSError:
pass

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

self.status('Uploading the package to PyPi via Twine…')
os.system('twine upload dist/*')
self.status("Uploading the package to PyPi via Twine…")
os.system("twine upload dist/*")

self.status('Pushing git tags…')
os.system('git tag v{0}'.format(ABOUT['__version__']))
os.system('git push --tags')
self.status("Pushing git tags…")
os.system("git tag v{0}".format(ABOUT["__version__"]))
os.system("git push --tags")

sys.exit()


class TestUploadCommand(Command):
"""Support setup.py upload."""

description = "Build and publish the package to TestPyPi."
user_options = [] # type: ignore

@staticmethod
def status(string):
"""Prints things in bold."""
print("\033[1m{0}\033[0m".format(string))

def initialize_options(self):
"""Add options for initialization."""
pass

def finalize_options(self):
"""Add options for finalization."""
pass

def run(self):
"""Run."""
try:
self.status("Removing previous builds…")
rmtree(os.path.join(HERE, "dist"))
except OSError:
pass

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

self.status("Uploading the package to TestPyPi via Twine…")
os.system(
"twine upload --repository-url " "https://test.pypi.org/legacy/ dist/*"
)

self.status("Pushing git tags…")
os.system("git tag v{0}".format(ABOUT["__version__"]))
os.system("git push --tags")

sys.exit()

Expand Down Expand Up @@ -135,39 +176,33 @@ def run(self):
# Where the magic happens:
setup(
name=NAME,
version=ABOUT['__version__'],
version=ABOUT["__version__"],
description=DESCRIPTION,
long_description=LONG_DESC,
long_description_content_type='text/x-rst',
long_description_content_type="text/x-rst",
author=AUTHOR,
# author_email=EMAIL,
python_requires=REQUIRES_PYTHON,
url=URL,
packages=find_packages(exclude=('tests',)),
packages=find_packages(exclude=("tests",)),
# If your package is a single module, use this instead of 'packages':
# py_modules=['tesla_dashcam'],

entry_points={
'console_scripts': ['tesla_dashcam=tesla_dashcam:main'],
},
entry_points={"console_scripts": ["tesla_dashcam=tesla_dashcam:main"]},
install_requires=REQUIRED,
include_package_data=True,
license='Apache License 2.0',
license="Apache License 2.0",
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Multimedia :: Video :: Conversion',
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Multimedia :: Video :: Conversion",
],
# $ setup.py publish support.
cmdclass={
'upload': UploadCommand,
'testupload': TestUploadCommand,
},
cmdclass={"upload": UploadCommand, "testupload": TestUploadCommand},
)
2 changes: 1 addition & 1 deletion tesla_dashcam/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.11'
__version__ = "0.1.12"
Loading

0 comments on commit 30ec25b

Please sign in to comment.