# Path: skymorph/skymorph.py
# SEARCH_TARGET_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobssel.pl?target=%s&NEAT=on&OE_EPOCH=&OE_EC=&OE_QR=&OE_TP=&OE_OM=&OE_W=&OE_IN=&OE_H='
# SEARCH_EPHEM_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobssel.pl?target=&NEAT=on&OE_EPOCH=%s&OE_EC=%s&OE_QR=%s&OE_TP=%s&OE_OM=%s&OE_W=%s&OE_IN=%s&OE_H=%s'
# SEARCH_POS_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/obssel.pl?position=%s,%s&time=%s&time_delta=1'
# IMAGE_QUERY_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobsdisp.pl'
# NEAT_FIELDS_LARGE = ['obs_id', 'triplet', 'time', 'predicted_ra', 'predicted_dec', \
#     'center_ra', 'center_dec', 'mag', 'veloc_we', 'veloc_sn', 'offset', \
#     'pos_err_major', 'pos_err_minor', 'pos_err_ang', 'pixel_loc_x', \
#     'pixel_loc_y', 'key']
# NEAT_FIELDS_SMALL = ['obs_id', 'ra', 'dec', 'time', 'exposure', 'triplet', 'key']
# NUMERIC_NEAT_FIELDS = set(['mag', 'offset', 'veloc_we', 'veloc_sn', \
#     'pixel_loc_x', 'pixel_loc_y'])
# DMS_NEAT_FIELDS = set(['center_dec', 'predicted_dec'])
# HMS_NEAT_FIELDS = set(['center_ra', 'predicted_ra'])
# URL_BASE = 'http://skyview.gsfc.nasa.gov/'
# IMAGE_SIZE = 500   # pixels
# IMAGE_PARSING_REGEX = re.compile("img src='(.*?)'")
# REDIS_PREFIX = 'skymorph'
# def images_for(target, n=10):
# def search_target(target):
# def search_ephem(epoch, ecc, per, per_date, om, w, inc, h):
# def search_position(ra, dec, time):
# def parse_results_table(text, neat_fields):
# def hms_str_to_float(hmsfield):
# def dms_str_to_float(dmsfield):
# def get_fast_image(key):
# def get_image(key):
# def get_image_info(key):


import sys
import os
import random
import pymongo
import astrometry
from pymongo import Connection
from datetime import datetime
from threading import Thread
from skymorph import skymorph
#!/usr/bin/env python
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))

connection = Connection('localhost', 27017)
db = connection.asterank
asteroids = db.asteroids
stackblink = db.stackblink
stackblink.ensure_index('key')

def create_known_groups():
  # scrape top X objects for imagery
  # a "group" is defined as a series of images taken within 45 minutes of each other
  NUM_CRAWL = 40

  def process(asteroid):
    target = asteroid['prov_des']
    if target.strip() == '':
      target = asteroid['name']
      if target.strip() == '':

# Path: skymorph/skymorph.py
# SEARCH_TARGET_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobssel.pl?target=%s&NEAT=on&OE_EPOCH=&OE_EC=&OE_QR=&OE_TP=&OE_OM=&OE_W=&OE_IN=&OE_H='
# SEARCH_EPHEM_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobssel.pl?target=&NEAT=on&OE_EPOCH=%s&OE_EC=%s&OE_QR=%s&OE_TP=%s&OE_OM=%s&OE_W=%s&OE_IN=%s&OE_H=%s'
# SEARCH_POS_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/obssel.pl?position=%s,%s&time=%s&time_delta=1'
# IMAGE_QUERY_URL = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobsdisp.pl'
# NEAT_FIELDS_LARGE = ['obs_id', 'triplet', 'time', 'predicted_ra', 'predicted_dec', \
#     'center_ra', 'center_dec', 'mag', 'veloc_we', 'veloc_sn', 'offset', \
#     'pos_err_major', 'pos_err_minor', 'pos_err_ang', 'pixel_loc_x', \
#     'pixel_loc_y', 'key']
# NEAT_FIELDS_SMALL = ['obs_id', 'ra', 'dec', 'time', 'exposure', 'triplet', 'key']
# NUMERIC_NEAT_FIELDS = set(['mag', 'offset', 'veloc_we', 'veloc_sn', \
#     'pixel_loc_x', 'pixel_loc_y'])
# DMS_NEAT_FIELDS = set(['center_dec', 'predicted_dec'])
# HMS_NEAT_FIELDS = set(['center_ra', 'predicted_ra'])
# URL_BASE = 'http://skyview.gsfc.nasa.gov/'
# IMAGE_SIZE = 500   # pixels
# IMAGE_PARSING_REGEX = re.compile("img src='(.*?)'")
# REDIS_PREFIX = 'skymorph'
# def images_for(target, n=10):
# def search_target(target):
# def search_ephem(epoch, ecc, per, per_date, om, w, inc, h):
# def search_position(ra, dec, time):
# def parse_results_table(text, neat_fields):
# def hms_str_to_float(hmsfield):
# def dms_str_to_float(dmsfield):
# def get_fast_image(key):
# def get_image(key):
# def get_image_info(key):


# Path: stackblink/crawl.py
import sys
import os
import random
import pymongo
import astrometry
from pymongo import Connection
from datetime import datetime
from threading import Thread
from skymorph import skymorph

#!/usr/bin/env python
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))

connection = Connection('localhost', 27017)
db = connection.asterank
asteroids = db.asteroids
stackblink = db.stackblink
stackblink.ensure_index('key')

def create_known_groups():
  # scrape top X objects for imagery
  # a "group" is defined as a series of images taken within 45 minutes of each other
  NUM_CRAWL = 40

  def process(asteroid):
    target = asteroid['prov_des']
    if target.strip() == '':
      target = asteroid['name']
      if target.strip() == '':

        target = asteroid['full_name']