2018-10-06 19:09:44 +02:00
|
|
|
from core.mysql_wrapper import get_anunciosdb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CapturasInterface():
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
|
|
|
|
|
self.anunciosdb = get_anunciosdb()
|
|
|
|
|
|
|
|
|
|
def insert_captura(self, ad_data):
|
|
|
|
|
|
|
|
|
|
columns = ', '.join(ad_data.keys())
|
2018-10-13 17:45:42 +02:00
|
|
|
placeholders_string = ', '.join(['%s'] * len(ad_data))
|
2018-10-06 19:09:44 +02:00
|
|
|
|
|
|
|
|
query_statement = """ INSERT INTO capturas
|
2018-10-13 17:45:42 +02:00
|
|
|
( fecha_captura, {} )
|
|
|
|
|
VALUES( NOW(), {} )""".format(columns, placeholders_string)
|
2018-10-06 19:09:44 +02:00
|
|
|
|
2018-10-13 17:45:42 +02:00
|
|
|
query_parameters = tuple([v for v in ad_data.values()])
|
2018-10-06 19:09:44 +02:00
|
|
|
|
|
|
|
|
self.anunciosdb.query(query_statement, query_parameters)
|
|
|
|
|
|
2018-10-14 19:24:17 +02:00
|
|
|
def old_ads_exist(self):
|
|
|
|
|
#TODO Mira si hay algun anuncio que este viejete y necesite refresco
|
|
|
|
|
|
|
|
|
|
def get_old_ad(self):
|
|
|
|
|
#TODO Recuperar anuncio que este viejete y que necesite refresco
|
|
|
|
|
|
|
|
|
|
def mark_dead_ad(self, referencia):
|
|
|
|
|
#TODO Marca un anuncio como muerto
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-10-06 19:09:44 +02:00
|
|
|
|
|
|
|
|
capturas_interface = CapturasInterface()
|
|
|
|
|
|
|
|
|
|
|