def run(): coordinates = [InstagramConfig.photo_min_lat, InstagramConfig.photo_min_lng, InstagramConfig.photo_max_lat, InstagramConfig.photo_max_lng ] huge_region = Region(coordinates) alarm_region_size = 25 regions = huge_region.divideRegions(alarm_region_size,alarm_region_size) #filtered_regions = huge_region.filterRegions( regions, test=True) #regions = filtered_regions test_cnt = 0 print 'all regions',len(regions) pi = PhotoInterface('tmp_citybeat', 'photos'); for region in regions: #delete the last 7*24*3600 to set it back to Dec 1st start_of_time = 1364571565 - 7*24*3600 #+ 7*24*3600 end_of_time = 1364571565 #+ 7*24*3600 res = pi.rangeQuery(region, [str(start_of_time), str(end_of_time)]); for r in res: try: print r['location']['latitude'],',',r['location']['longitude'] except: continue
def run(): coordinates = [InstagramConfig.photo_min_lat, InstagramConfig.photo_min_lng, InstagramConfig.photo_max_lat, InstagramConfig.photo_max_lng ] pi = PhotoInterface()
def _getFiftenMiniutesPhotos(self): pi = PhotoInterface('citybeat', 'photos_no_duplicate') _fifteen_minutes_ago = 15 * 60 cursor = pi.rangeQuery( self.region, (str(self.cur_time - _fifteen_minutes_ago), str(self.cur_time))) _photos = [] for p in cursor: _photos.append(p) _photos = sorted(_photos, key=lambda k: k['created_time']) before = len(_photos) _photos = processAsPeopleCount(_photos) after = len(_photos) self.current_value = after self.photos = _photos
from utility.config import InstagramConfig from utility.photo_interface import PhotoInterface start = 1365644367 - 14 * 3600 * 24 end = 1365644367 region = { 'min_lat': 40.75419436, 'max_lng': -73.978088200000002, 'min_lng': -73.986094480000006, 'max_lat': 40.759499640000001 } pi = PhotoInterface() pi.setDB('citybeat_production') pi.setCollection('photos') cursor = pi.rangeQuery(region, (str(start), str(end))) cnt = 0 print 'here' for p in cursor: cnt += 1 print cnt