-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.py
More file actions
28 lines (24 loc) · 1.07 KB
/
Program.py
File metadata and controls
28 lines (24 loc) · 1.07 KB
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
import sys
from ImageClusteringComponents.PDFBooksFolderClusteringComponent import PDFBooksFolderClusteringComponent
from Classes.PDFBooksFolder import PDFBooksFolder
from Utilities.Utils import Utils
import time
constErrorMessage = "An exception occurred\nPlease check the PDF books folder path"
def performAMethodInTryCatchBlock(i_MethodPointer, i_ErrorMessage):
try:
start = time.time()
i_MethodPointer()
end = time.time()
print("\nElapsed time = {}\n".format(end - start))
except:
print(i_ErrorMessage)
finally:
Utils.PlayFinishSound()
if len(sys.argv) > 1:
pdfBooksFolderPath = sys.argv[1]
pdfBooksFolder = PDFBooksFolder(pdfBooksFolderPath)
performAMethodInTryCatchBlock(pdfBooksFolder.StartImageProcessingOnPDFBooksFolder, constErrorMessage)
pdfBooksFolderClusteringComponent = PDFBooksFolderClusteringComponent(pdfBooksFolderPath)
performAMethodInTryCatchBlock(pdfBooksFolderClusteringComponent.StartImageClusteringOnPDFBooksFolder, constErrorMessage)
else:
print("Please enter a pdf books folder path")