-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMDb_Analyzer.py
43 lines (35 loc) · 1.43 KB
/
IMDb_Analyzer.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
from UserDataDownloader import *
from PieceDownloader import *
from AnalysisMaker import *
import sys
import os
from Constants import *
from UserWatchlistDownloader import UserWatchlistDownloader
class IMDb_Analayzer:
def __init__(self, user, userURL = "", command = ""):
self.user = user
self.userURL = userURL
dataDirectoryName = DATA_FILE_NAME
self.createDataDirectory(dataDirectoryName)
if not userURL == "":
if command == "-wl":
UserWatchlistDownloader(self.user,self.userURL)
else:
UserDataDownloader(self.user, self.userURL, dataDirectoryName)
pieceDownloader = PieceDownloader(self.user, dataDirectoryName)
pieceDownloader.downloadUserPieces()
analysisMaker = AnalysisMaker(self.user, dataDirectoryName)
analysisMaker.makeAnalysis()
analysisMaker.printAnalysis()
def createDataDirectory(self, dataDirectoryName):
if not os.path.exists(os.path.join(os.getcwd(),dataDirectoryName)):
os.makedirs(os.path.join(os.getcwd(),dataDirectoryName))
os.makedirs(os.path.join(os.getcwd(),dataDirectoryName,PIECES_STORAGE_FILE_NAME))
if len(sys.argv) == 2:
IMDb_Analayzer(sys.argv[1])
elif len(sys.argv) == 3:
IMDb_Analayzer(sys.argv[1], sys.argv[2])
elif len(sys.argv) == 4:
IMDb_Analayzer(sys.argv[1], sys.argv[2], sys.argv[3])
else:
print("Wrong input!")