Fixet indentation
This commit is contained in:
@ -5,35 +5,35 @@ import logging
|
|||||||
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
||||||
|
|
||||||
def movieFunc():
|
def movieFunc():
|
||||||
try:
|
try:
|
||||||
print("Creating IMDb object")
|
print("Creating IMDb object")
|
||||||
logging.info("Creating IMDb object")
|
logging.info("Creating IMDb object")
|
||||||
ia = imdb.IMDb()
|
ia = imdb.IMDb()
|
||||||
|
|
||||||
print("Picking a movie")
|
print("Picking a movie")
|
||||||
logging.info("Picking a movie")
|
logging.info("Picking a movie")
|
||||||
movs = open("resources/movies.txt", "r")
|
movs = open("resources/movies.txt", "r")
|
||||||
movlist = movs.read().split("\n")
|
movlist = movs.read().split("\n")
|
||||||
mov = random.choice(movlist)
|
mov = random.choice(movlist)
|
||||||
movs.close()
|
movs.close()
|
||||||
|
|
||||||
print("Searching for "+mov)
|
print("Searching for "+mov)
|
||||||
logging.info("Searching for "+mov)
|
logging.info("Searching for "+mov)
|
||||||
s_result = ia.search_movie(mov)
|
s_result = ia.search_movie(mov)
|
||||||
|
|
||||||
print("Getting the data")
|
print("Getting the data")
|
||||||
logging.info("Getting the data")
|
logging.info("Getting the data")
|
||||||
movie = s_result[0]
|
movie = s_result[0]
|
||||||
ia.update(movie)
|
ia.update(movie)
|
||||||
cast = movie['cast']
|
cast = movie['cast']
|
||||||
pcast = ""
|
pcast = ""
|
||||||
for x in range(3):
|
for x in range(3):
|
||||||
if cast[x]:
|
if cast[x]:
|
||||||
pcast += cast[x]['name']+", "
|
pcast += cast[x]['name']+", "
|
||||||
print("Successfully ran !movie")
|
print("Successfully ran !movie")
|
||||||
logging.info("Successfully ran !movie")
|
logging.info("Successfully ran !movie")
|
||||||
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
||||||
except:
|
except:
|
||||||
print("Something bad happened...")
|
print("Something bad happened...")
|
||||||
logging.info("Something bad happened...")
|
logging.info("Something bad happened...")
|
||||||
return("error","","","")
|
return("error","","","")
|
||||||
|
Reference in New Issue
Block a user