def multi_page(self): print_colored_red = lambda x: colored(x, 'red') site = self.config.wallhaven_URL() while site: print_colored_red("Looking at page: %s" % site) self.site_queue.put(site) site = self.config.wallhaven_URL() start = time.time() self.runThreads() end = time.time() - start self.printResults(end)
def printResults(self, time): print_colored_magenta = lambda x: colored(x, 'magenta') print_colored_cyan = lambda x: colored(x, 'cyan') print("You have downloaded:", print_colored_magenta(self.added_imgs), "new images to your directory and skipped:", print_colored_magenta(self.skipped_imgs), "images") print_colored_cyan('It took:'), print_colored_magenta(time), print_colored_cyan('seconds')
sampleId = 753692 camasId = 2373510 # # Example flickr = flickrapi.FlickrAPI(apikey, secret) request = flickr.places.getChildrenWithPhotosPublic(woe_id=sampleId) list = request[0].getchildren() print("length: %s" % len(list)) x = [] y = [] z = [] for item in list: if item.attrib['place_type_id'] == '22': print("latitude: %s, longitude: %s \n\t-> %s" % (colored(item.attrib['latitude'], "green"), colored(item.attrib['longitude'], "green"), colored(item.text, "blue"))) x.append(float(item.attrib['latitude'])) y.append(float(item.attrib['longitude'])) z.append(int(item.attrib['photo_count'])) #df = pd.DataFrame({'latitude':x, 'longitude':y, 'photo_count':z}) #xmin = df['latitude'].min() #xmax = df['latitude'].max() #ymin = df['longitude'].min() #ymax = df['longitude'].max() xmin = min(x) xmax = max(x) ymin = min(y) ymax = max(y)