-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
143 lines (121 loc) · 5.13 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#import places as places
import PlacesAPI as placesApi
import userpref as userpref
import map
if __name__ == "__main__":
#Get user input
userSimInput = input("Simulate in home country or outside of home country?")
if userSimInput == "In":
user = userpref.User([["Chinese",4],["Korean",4], ["Quiet",3], ["Mediterranean",1]],[["Fine arts",3],["Theatre",2]],[["Movie",8],["KTV",2]],[["Althetic",3],["Formal",2]], True)
else:
user = userpref.User([["Chinese",4],["Korean",4], ["Quiet",3], ["Mediterranean",1]],[["Fine arts",3],["Theatre",2]],[["Movie",8],["KTV",2]],[["Althetic",3],["Formal",2]], False)
i = 0
listCategory = {"Restaurant":0,"Arts & Culture":0,"Entertainment":0,"Shopping":0}
if (user.in_home_country == False):
done = 0
newFoodPref = ""
newArtPref = ""
newEntInput = ""
newShopInput = ""
while done != 1:
print("What do you want to try in this new country?\nCategories to add new prefereces for:\n0: Restaurant\n1: Arts & Culture\n2: Entertainment\n3: Shopping\nSeparated by commas. -1 to exit\n")
userQuery = int(input())
if (userQuery == 0):
print("What do you want to try new in food?")
newFoodPref = input()
if (userQuery == 1):
print("What do you want to try new in Arts & Culture?")
newArtPref = input()
if (userQuery == 2):
print("What do you want to try new in the Entertainment?")
newEntInput = input()
if (userQuery == 3):
print("What do you want to try new in the Shopping")
newShopInput = input()
if (userQuery == -1):
done = 1
user.otherCountryPref(newFoodPref, newArtPref, newEntInput, newShopInput)
while i == 0:
print("Select categories:\n0: Restaurant\n1: Arts & Culture\n2: Entertainment\n3: Shopping\n")
userInput = int(input())
if (userInput == 0):
listCategory["Restaurant"] = 1
if (userInput == 1):
listCategory["Arts & Culture"] = 1
if (userInput == 2):
listCategory["Entertainment"] = 1
if (userInput == 3):
listCategory["Shopping"] = 1
print("Do you want to add additional categories\n0:No\n1:Yes")
print(listCategory)
userInput = int(input())
if (userInput == 0):
i = 1
inpute = ""
places = []
for c in listCategory.keys():
if listCategory.get(c) == 1:
if c == "Restaurant":
for f in user.food:
result = placesApi.pull_data(f, "43.662127, -79.387779")
if result is not None:
places.append(result)
break
elif c == "Arts & Culture":
for f in user.arts:
result = placesApi.pull_data(f, "43.662127, -79.387779")
if result is not None:
places.append(result)
break
elif c == "Entertainment":
for f in user.entertainment:
result = placesApi.pull_data(f, "43.662127, -79.387779")
if result is not None:
places.append(result)
break
elif c == "Shopping":
for f in user.shopping:
result = placesApi.pull_data(f, "43.662127, -79.387779")
if result is not None:
places.append(result)
break
# print(inpute)
# places = placesApi.pull_data(inpute, "43.662127, -79.387779")
# print(places)
'''
for i in range(len(places)):
print("{0}: {1}".format(i, places[i]))
input_text = input("Would you like to remove any of these items?")
#if input_text != 0
try:
print(input_text)
places.pop(int(input_text), None)
except:
print("Please input a number")
if input_text == "":
break
'''
if len(places) != 0:
good = placesApi.find_route([place['place_id'] for place in places])
lst_loc = []
raw = good['origin_addresses']
raw.reverse()
for elements in raw:
lst_loc.append(elements)
raw2 = good['destination_addresses']
for e2 in raw2:
lst_loc.append(e2)
if lst_loc == []:
print("Sorry, the algorithm did not return any results.")
print("Hint: Pack your day with more engaging activities by adding more preferences!")
else:
print("Here is your itinerary, a list of addresses in order.")
print("Simply use this guide to fill your day with very engaging activities!")
print(lst_loc)
print("The Algorithm has finished running. Enjoy your trip!")
print(placesApi.find_route([place['place_id'] for place in places]))
print("Done")
#Call api functions
#coordinates = "2.230225,48.817716"
#x = places.findPlaces(coordinates)
#printall(x)