-
Notifications
You must be signed in to change notification settings - Fork 3
/
video_test.py
executable file
·53 lines (43 loc) · 1.49 KB
/
video_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 by Murray Altheim. All rights reserved. This file is part of
# the Robot Operating System project and is released under the "Apache Licence,
# Version 2.0". Please see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2019-12-23
# modified: 2021-03-24
#
# Once running, access the video stream from: http://your-pi-address:8001/
#
# source: https://picamera.readthedocs.io/en/release-1.13/recipes2.html#web-streaming
#
import sys, time, traceback
from colorama import init, Fore, Style
init()
from lib.config_loader import ConfigLoader
from lib.logger import Level
from lib.video import Video
# main .........................................................................
def main(argv):
_video = None
try:
# read YAML configuration
_loader = ConfigLoader(Level.INFO)
_config = _loader.configure('config.yaml')
_video = Video(_config, Level.INFO)
_video.start()
while True:
time.sleep(1.0)
except KeyboardInterrupt:
print(Fore.CYAN + Style.BRIGHT + 'caught Ctrl-C; exiting...')
except Exception:
print(Fore.RED + Style.BRIGHT + 'error starting ros: {}'.format(traceback.format_exc()) + Style.RESET_ALL)
finally:
if _video is not None:
_video.stop()
# call main ....................................................................
if __name__== "__main__":
main(sys.argv[1:])
#EOF