forked from dangmai/looper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (36 loc) · 1.24 KB
/
main.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Program to loop videos based on timestamps in a text file
"""
import argparse
import os
import sys
from gui import MainWindow
from PyQt5.QtWidgets import QApplication
def main():
"""
Main function for the program
"""
parser = argparse.ArgumentParser(
description="Loop a video between 2 points in time based on rules in "
"a text file."
)
parser.add_argument('timestamp_filename', metavar='F', nargs='?',
help='the location of the timestamp file')
parser.add_argument('--video_filename', metavar='V',
help='the location of the video file')
args = parser.parse_args()
app = QApplication(sys.argv)
with open("gui/application.qss", "r") as theme_file:
app.setStyleSheet(theme_file.read())
main_window = MainWindow()
if args.timestamp_filename:
timestamp_filename = os.path.abspath(args.timestamp_filename)
main_window.set_timestamp_filename(timestamp_filename)
if args.video_filename:
video_filename = os.path.abspath(args.video_filename)
main_window.set_video_filename(video_filename)
sys.exit(app.exec_())
if __name__ == '__main__':
main()