-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtraFunctions.py
More file actions
31 lines (28 loc) · 1.06 KB
/
ExtraFunctions.py
File metadata and controls
31 lines (28 loc) · 1.06 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
29
30
31
import subprocess
class ExtraFunctions:
def __init__(self):
pass
# Constructing Object to pass to Main Page
def getMostPopular(self,mostPopular):
current=0
movieInfo={}
for movie in mostPopular:
current+=1
movieId='movie'+str(current)+'id'
movieName='movie'+str(current)+'name'
movieSrc='movie'+str(current)+'src'
movieVideo='movie'+str(current)+'video'
movieInfo[movieId]=movie['id']
movieInfo[movieName]=movie["original_title"],
movieInfo[movieSrc]=movie["poster_path"]
movieInfo[movieVideo]=movie["video"]
return movieInfo
# Server Specific, retrieval of current external IP address for population
def loadIp(self):
try:
result = subprocess.run(["hostname", "-I"], stdout=subprocess.PIPE)
value=str(result.stdout)
value=(value.replace('b\'',''))
return (value.split(' ')[1])
except:
return "Issue in IP Configuration please fix me"