names = [] for p in pelis: names.append(clean_name(p.rstrip())) i = randint(0,300) i=212 peliculas = [] for i in range(len(names)): p = names[i] fname = pelis[i].lstrip().rstrip().split('.')[0]+'.json' fname = folder+'/'+fname if not os.path.isfile(fname): print 'Doing',fname ia = imdb.IMDb() s_result = ia.search_movie(p) if len(s_result) > 0: first_result = s_result[0] ia.update(first_result) data = first_result.data P = get_film(data,pelis[i].lstrip().rstrip()) peliculas.append(P) IO.json_write(P.__dict__,fname) else: print ' Error:',p else: pass #print 'Skipping:', fname if os.path.isfile('STOP'): exit()
def write(self): IO.json_write(self.__dict__,self.fil.split('.')[0]+'.json')