# coding=UTF8

# Process all shapes inside a root
# Parameters:
#   - config profile;
#   - bulk load session name;
#   - filter.

import etl, config, sys
reload(etl)
reload(config)

roots = [
    "Catastro/CATASTRO_RUSTICO/2014-12-01/ALMERIA_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/CADIZ_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/CORDOBA_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/GRANADA_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/HUELVA_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/JAEN_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/MALAGA_RUS",
    "Catastro/CATASTRO_RUSTICO/2014-12-01/SEVILLA_RUS",
    "Catastro/CATASTRO_URBANO/2014-04-01/ALMERIA",
    "Catastro/CATASTRO_URBANO/2014-04-01/CADIZ",
    "Catastro/CATASTRO_URBANO/2014-04-01/CORDOBA",
    "Catastro/CATASTRO_URBANO/2014-04-01/GRANADA",
    "Catastro/CATASTRO_URBANO/2014-04-01/HUELVA",
    "Catastro/CATASTRO_URBANO/2014-04-01/JAEN",
    "Catastro/CATASTRO_URBANO/2014-04-01/MALAGA",
    "Catastro/CATASTRO_URBANO/2014-04-01/SEVILLA"
]

# Process al shapefile packages in each root
for r in roots:
    a = etl.CatastroShapeBatchProcess(r, config.config[sys.argv[1]], sys.argv[2], filter=sys.argv[3])
    a.process()

# TODO: add session name to log file name
