-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (29 loc) · 828 Bytes
/
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
import os.path
import sys
import glob
import scenedetector as sd
def process_one_file(file):
"""
Run SceneExtractor for a single file. The extracted scenes are stored in the current directory.
Parameters:
file (string): filename
"""
sd.find_scenes(file)
def process_dir(path):
"""
Run SceneExtractor for all files in a directory. The extracted scenes are stored in the current directory.
Parameters:
path (string): director path
"""
files = glob.glob(path+"/*.mp4")
for file in files:
process_one_file(file)
def main(source):
if os.path.isdir(source):
process_dir(source)
elif os.path.isfile(source):
process_one_file(source)
else: print("Cannot open " + source)
if __name__ == '__main__' :
args = sys.argv[1:]
main(args[0])