-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
59 lines (47 loc) · 1.31 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/env python3
import sys
import os
from src.Photo import Photo
from src.Importer import Importer
import random
from src.Relationship import get_relationship
import zipfile
from src.Chaining import run
from src.MergeVerticals import merge_verticals
def zipdir():
zipf = zipfile.ZipFile('outputs/output.zip', 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk("src/"):
for file in files:
zipf.write(os.path.join(root, file))
zipf.write("main.py")
inputs = {
"a": "a_example.txt",
"b": "b_lovely_landscapes.txt",
"c": "c_memorable_moments.txt",
"d": "d_pet_pictures.txt",
"e": "e_shiny_selfies.txt"
}
inSet = ""
inFile = ""
if len(sys.argv) >= 2 and sys.argv[1] in inputs.keys():
inSet = sys.argv[1]
inFile = "inputs/" + inputs[inSet]
else:
print("Please specify a input set from the following:")
for i in inputs.keys():
print(str(i), end=" ")
sys.exit()
importer = Importer(inFile)
photos = importer.import_data_set()
print("Initial size: " + str(len(photos)))
# Let's get started
slides = merge_verticals(photos)
print("Slides: " + str(len(slides)))
print()
slides = run(slides)
f = open("outputs/"+inSet+".txt", "w")
f.write(str(len(slides)) + "\n")
for slide in slides:
f.write(slide.get_output_line() + "\n")
f.close()
zipdir()