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