-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (23 loc) · 1.51 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
#!/usr/bin/python
import sys, os;
import argparse;
from os.path import expanduser;
from resizeFile import resizeFile;
__author__ = "Jeetesh Mangwani"
def main():
parser = argparse.ArgumentParser(description="This script compresses photos and videos in a given directory");
parser.add_argument("-id", "--inputdirectory", type=str, help="The input directory that will be traversed for photos and videos", required=False, default=expanduser("~\my-photos\input"));
parser.add_argument("-od", "--outputdirectory", type=str, help="The output directory where resized photos and videos will be put", required=False, default=expanduser("~\my-photos\output"));
parser.add_argument("-is", "--imagesize", type=str, help="Output image size; one of 'small', 'medium' or 'large'", required=False, default="small");
parser.add_argument("-vs", "--videosize", type=str, help="Output video size; one of 'small', 'medium', or 'large'", required=False, default="small");
parser.add_argument("-v", "--verbose", help="Whether to output verbose output messages", required=False, default=False);
args = parser.parse_args();
print("Input directory: ", args.inputdirectory);
print("Output directory: ", args.outputdirectory);
print("Output image size: ", args.imagesize);
print("Output video size: ", args.videosize);
print("Verbosity of log messages: ", args.verbose);
for path, subdirs, files in os.walk(args.inputdirectory):
for file in files:
resizeFile(path, subdirs, file, args)
main();