Example #1
0
    def onSelectPrograma(self, event):

        self.stProgramaCodi.SetLabel(unicode(self.cbPrograma.GetValue()))
        hora = [x["PGHORA"] for x in self.listaProgramas if
                x["PGNOMB"].decode('unicode-escape') == self.cbPrograma.GetValue()]
        minuto = [x["PGMINT"] for x in self.listaProgramas if
                  x["PGNOMB"].decode('unicode-escape') == self.cbPrograma.GetValue()]
        horaEmision = datetime.time(hour=int(hora[0]), minute=int(minuto[0]))
        self.stProgramaHMS.SetLabel(unicode(horaEmision))
        codigoPrograma = [x["PGCODI"] for x in self.listaProgramas if
                          x["PGNOMB"].decode('unicode-escape') == self.cbPrograma.GetValue()]
        print "codigoPrograma"
        pf(codigoPrograma)
        self.codigoPrograma = codigoPrograma[0]
def cargar_programa_anuncio(inicio_anuncio, onda, cadena, emisora, cursor):
    """
    Retrieves the code ID of the program in which the ad occurs
    :param inicio_anuncio: begginig of the ad (datetime)
    :param emisora: radio station's name
    :param cursor: cursor to DB
    :return: code ID
    """
    from datetime import time
    dias_semana = {0: "D",
                   1: "L",
                   2: "M",
                   3: "X",
                   4: "J",
                   5: "V",
                   6: "S",
                   7: "D"}

    query = (u"SELECT codigo "
             u"FROM captor.programas "
             u"WHERE dia_semana = '{}' "
             u"AND onda = '{}' "
             u"AND cadena = '{}' "
             u"AND emisora = '{}' "
             u"AND hora_emision < '{}' "
             u"ORDER BY hora_emision DESC LIMIT 1;").format(dias_semana[inicio_anuncio.isoweekday()],
                                                            onda, cadena, emisora, inicio_anuncio.time())

    pf(query)
    cursor.execute(query)
    codigoPrograma = cursor.fetchone()

    if len(codigoPrograma) == 0:
        query = (u"SELECT codigo "
                 u"FROM captor.programas "
                 u"WHERE dia_semana = '{}' "
                 u"AND onda = '{}' "
                 u"AND cadena = '{}' "
                 u"AND emisora = '{}' "
                 u"AND hora_emision < '{}' "
                 u"ORDER BY hora_emision DESC LIMIT 1;").format(dias_semana[inicio_anuncio.isoweekday() - 1],
                                                                onda, cadena, emisora,
                                                                time(hour=23, minute=59, second=59))

        pf(query)
        cursor.execute(query)
        codigoPrograma = cursor.fetchone()

    return codigoPrograma["codigo"]
Example #3
0
def guardar_wav(buffer, nombre, fs, numc):
    nombre_wav = os.path.basename(nombre)
    output = wave.open(nombre, 'w')
    output.setparams((numc, 2, fs, 1, 'NONE', 'not compressed'))
    output.writeframes(buffer)
    output.close()
    with cnx_mysql:
        query = (u"INSERT INTO cintas "
                 u"(nombre_cinta, emisora_cinta, estado_cinta, vector_cinta, targets_cinta, usuario_cinta) "
                 u"VALUES ('{}', '{}', '{}', '{}', '{}', '{}')").format(nombre_wav, NOMBRE_EMISORA, u"A",
                                                                        RUTA_RED + u"\\\\" + nombre_archivo + u".npy",
                                                                        RUTA_RED + u"\\\\" + nombre_archivo + u".txt",
                                                                        1)
        pf(query)
        cursor_mysql.execute(query)
Example #4
0
    # print "len(infmedios) {}".format(len(infmedios))
    #
    # infsoport = cargar_infsoport("RD  ")
    lista = []
    # cursor.execute("SELECT * FROM INFOCDM.CDMPPO00N WHERE RACADN = 'INTE'")
    # cursor.execute("select elcodi, eldesc from infocdm.cdmpel00 where incodi=10")
    # query = "SELECT PGCODI FROM INFOCDM.cdmppo00n WHERE DIASEM = 'V' AND RAEMIS = 'INTE' AND (PGHORA * 3600) + PGMINT * 60 < (11 * 3600) + 30 * 60 ORDER BY PGHORA DESC, PGMINT DESC FETCH FIRST 1 ROW ONLY"
    query = "SELECT * FROM INFOCDM.cdmppo00n"
    cursor.execute(query)

    columnas = [columna[0] for columna in cursor.description]
    for resultado in cursor.fetchall():
        lista.append(dict(zip(columnas, resultado)))

    for l in lista[:5]:
        pf(l)

    print len(lista)

    # print type(lista[-1]['DIASEM'])
    # print "len(infsoport) {}".format(len(infsoport))
    #
    # inffranun = cargar_inffranun()
    # print "len(inffranun) {}".format(len(inffranun))
    #
    # infmkdire = cargar_infmkdire()
    # print "len(infmkdire) {}".format(len(infmkdire))
    #
    # inftpprog = cargar_inftpprog()
    # print "len(inftpprog) {}".format(len(inftpprog))
    #
Example #5
0
def reconocer_huella(in_data, djv, inicio_huella, datos_emisora):
    audio = np.fromstring(in_data, np.int16)
    print u"inicio_huella: {}".format(inicio_huella)

    # comparamos con al BBDD de fingerprints cual es el que más se parece
    anuncio_encontrado = djv.recognize(AudioRecognizer, audio)
    print u"song.recongnize: {}".format(anuncio_encontrado)

    # si el audio supera el umbral de coincidencia con un anuncio guardado
    if anuncio_encontrado is None:
        print u"song None"
        return None
    else:
        if anuncio_encontrado["confidence"] > UMBRAL_FINGERPRINT:

            # extraemos la información del anuncio original
            query = (u"SELECT * "
                     u"FROM songs "
                     u"WHERE song_id = '{}'".format(anuncio_encontrado["song_id"]))
            cursor_mysql.execute(query)
            anuncio_original = cursor_mysql.fetchone()
            print u"anuncio_original {}".format(anuncio_original)

            # calculamos el inicio del anuncio
            inicio_anuncio = comienzo + inicio_huella - datetime.timedelta(seconds=LONG_HUELLA) - datetime.timedelta(
                microseconds=(VENTANA * 1000000) / 2) - datetime.timedelta(seconds=anuncio_encontrado['offset_seconds'])
            print u"inicio_anuncio: {} {}".format(inicio_anuncio, type(inicio_anuncio))

            # extraemos el código del programa al que pertenece el anuncio
            codigo_programa = cargar_programa_anuncio(inicio_anuncio, datos_emisora["onda"], datos_emisora["cadena"],
                                                      datos_emisora["emisora"], cursor_mysql)

            # si existe alguna ocurrencia con un inicio similar extraemos su confidence para compararlo despues
            with cnx_mysql:
                query = (u"SELECT * "
                         u"FROM ocurrencias "
                         u"WHERE nombre_cinta = '{}' "
                         u"AND emisora_anuncio = '{}' "
                         u"AND fecha_ocurrencia BETWEEN '{}' AND '{}'").format(nombre_archivo, NOMBRE_EMISORA,
                                                                               inicio_anuncio - datetime.timedelta(
                                                                                   seconds=10),
                                                                               inicio_anuncio + datetime.timedelta(
                                                                                   seconds=anuncio_original["len"]))
                pf(query)
                cursor_mysql.execute(query)
                coincidendias = cursor_mysql.fetchall()
                print u"coincidendias {} {}".format(len(coincidendias), coincidendias)

                if len(coincidendias) == 0:
                    query = (u"INSERT INTO ocurrencias "
                             u"(fecha_encontrado, fecha_ocurrencia, id_anuncio, emisora_anuncio, duracion_anuncio, "
                             u"nombre_cinta, confidence, codigo_medio, codigo_marca_modelo, nombre_marca, "
                             u"nombre_modelo, compartido, forma_publicidad, total_inserciones_bloque, "
                             u"numero_insercion_dentro_bloque, codigo_programa, codigo_marketing_directo, "
                             u"codigo_operador, descripcion) "
                             u"VALUES ('{}', '{}', '{}', '{}', '{}', "
                             u"'{}', '{}', '{}', '{}', '{}', "
                             u"'{}', '{}', '{}', '{}', "
                             u"'{}', '{}', '{}', "
                             u"'{}', '{}')").format(datetime.datetime.now(), inicio_anuncio,
                                                    anuncio_original["song_id"], NOMBRE_EMISORA,
                                                    anuncio_original["len"], nombre_archivo,
                                                    anuncio_encontrado["confidence"], CODIGO_MEDIO,
                                                    anuncio_original["codigo_marca_modelo"],
                                                    anuncio_original["nombre_marca"],
                                                    anuncio_original["nombre_modelo"],
                                                    anuncio_original["compartido"], "", "", "", codigo_programa, "",
                                                    "", anuncio_original["texto_mencion"])
                    pf(query)
                    cursor_mysql.execute(query)
                    print u"insert sin coincidencias"
                else:
                    borrados = 0
                    for coincidencia in coincidendias:
                        if int(anuncio_encontrado["song_id"]) == int(coincidencia["id_anuncio"]):
                            borrados += 1
                            print u"mismo id"
                            if int(anuncio_encontrado["confidence"]) > int(coincidencia["confidence"]):
                                query = (u"DELETE FROM ocurrencias "
                                         u"WHERE id_anuncio='{}' "
                                         u"AND fecha_ocurrencia='{}' "
                                         u"AND nombre_cinta='{}' "
                                         u"AND emisora_anuncio='{}'").format(coincidencia["id_anuncio"],
                                                                             coincidencia["fecha_ocurrencia"],
                                                                             nombre_archivo, NOMBRE_EMISORA)
                                pf(query)
                                cursor_mysql.execute(query)
                                borrados -= 1
                                print u"borrado coincidencia"
                            else:
                                print u"no borrado"
                        else:
                            borrados += 1
                            print u"diferente id"
                            if coincidencia["fecha_ocurrencia"] + datetime.timedelta(
                                    seconds=int(coincidencia["duracion_anuncio"])) > inicio_anuncio:
                                print u"coinciden en el tiempo"
                                if int(anuncio_encontrado["confidence"]) > int(coincidencia["confidence"]):
                                    query = (u"DELETE FROM ocurrencias "
                                             u"WHERE id_anuncio='{}' "
                                             u"AND fecha_ocurrencia='{}' "
                                             u"AND nombre_cinta='{}' "
                                             u"AND emisora_anuncio='{}'").format(coincidencia["id_anuncio"],
                                                                                 coincidencia["fecha_ocurrencia"],
                                                                                 nombre_archivo, NOMBRE_EMISORA)
                                pf(query)
                                cursor_mysql.execute(query)
                                borrados -= 1
                                print u"borrado coincidencia diferente id"
                            else:
                                print u"no borrado"
                    if borrados == 0:
                        query = (u"INSERT INTO ocurrencias "
                                 u"(fecha_encontrado, fecha_ocurrencia, id_anuncio, emisora_anuncio, duracion_anuncio, "
                                 u"nombre_cinta, confidence, codigo_medio, codigo_marca_modelo, nombre_marca, "
                                 u"nombre_modelo, compartido, forma_publicidad, total_inserciones_bloque, "
                                 u"numero_insercion_dentro_bloque, codigo_programa, codigo_marketing_directo, "
                                 u"codigo_operador, descripcion) "
                                 u"VALUES ('{}', '{}', '{}', '{}', '{}', "
                                 u"'{}', '{}', '{}', '{}', '{}', "
                                 u"'{}', '{}', '{}', '{}', "
                                 u"'{}', '{}', '{}', "
                                 u"'{}', '{}')").format(datetime.datetime.now(), inicio_anuncio,
                                                        anuncio_original["song_id"], NOMBRE_EMISORA,
                                                        anuncio_original["len"], nombre_archivo,
                                                        anuncio_encontrado["confidence"], CODIGO_MEDIO,
                                                        anuncio_original["codigo_marca_modelo"],
                                                        anuncio_original["nombre_marca"],
                                                        anuncio_original["nombre_modelo"],
                                                        anuncio_original["compartido"], "", "", "", codigo_programa, "",
                                                        "", anuncio_original["texto_mencion"])
                        pf(query)
                        cursor_mysql.execute(query)
                        print u"actualizado coincidencias"
        return anuncio_encontrado
Example #6
0
                    pass
                hipotesis = ''
                decoder.start_utt()

    if texto:
        print 'resultados'
        print texto
        # devolvemos si ha habido reconocimiento
        return texto


if __name__ == '__main__':

    datos_emisora = extraer_datos_emisora(NOMBRE_EMISORA)

    pf(datos_emisora)
    pf(RUTA_RED)

    ###comando de lectura de ffmpeg, 2 buffers, 0 - 16 kHz, 1 - 44.1 kHz
    ffmpeg = [
        Popen([
            FFMPEG_EXE,
            "-f", "dshow",
            "-i", "audio=Mezcla est\xe9reo (Realtek High Definition Audio)",
            "-acodec", "pcm_s16le",
            "-ac", "1",
            "-ar", "16000", "-f", "s16le",
            "-"], shell=True, stdout=PIPE, stderr=open(os.devnull, "w")),
        Popen([
            FFMPEG_EXE,
            "-f", "dshow",
Example #7
0
    def __init__(self, archivo, t_muestreo, muestras, tam, fecha, comienzo, final, menuanuncios, bloques_ordenado,
                 datos_anuncio, emisora_cinta, confidence, segmento):
        """Constructor"""

        try:
            pf(archivo)
        except:
            pass
        try:
            pf(t_muestreo)
        except:
            pass
        try:
            pf(tam)
        except:
            pass
        try:
            pf(fecha)
        except:
            pass
        try:
            pf(comienzo)
        except:
            pass
        try:
            pf(final)
        except:
            pass
        try:
            pf(menuanuncios)
        except:
            pass
        try:
            pf(bloques_ordenado)
        except:
            pass
        try:
            pf(datos_anuncio)
        except:
            pass
        try:
            pf(emisora_cinta)
        except:
            pass
        try:
            pf(confidence)
        except:
            pass

        self.dias_semana = {1: "L",
                            2: "M",
                            3: "X",
                            4: "J",
                            5: "V",
                            6: "S",
                            7: "D"}

        if emisora_cinta == 2:
            self.grupo = "INTE"
            self.cadena = "INTE"
            self.emision = "INTE"
        elif emisora_cinta == 3:
            self.grupo = "ESRA"
            self.cadena = "ESRA"
            self.emision = "ESRM"

        wx.Dialog.__init__(self, None, title=u"Ingreso de anuncio", size=(970, 950))

        fuenteTitulo = wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        fuenteNormal = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL)

        print "INICIO ANUNCIODIALOG"

        self.db = MySQLdb.connect(host="192.168.2.170",
                                  user="******",
                                  passwd="nfoadex",
                                  db="captor",
                                  use_unicode=True,
                                  charset="utf8",
                                  init_command='SET NAMES UTF8')

        config = {
            "database": {
                "host": "192.168.2.170",
                "user": "******",
                "passwd": "infoadex",
                "db": "captor",
                "use_unicode": True,
                "charset": 'utf8',
                "init_command": 'SET NAMES UTF8'
            },
            "database_type": "mysql"
        }

        '''
        self.db = MySQLdb.connect(host="localhost",
                                  user="******",
                                  passwd="12345",
                                  db="captor",
                                  use_unicode=True,
                                  charset="utf8",
                                  init_command='SET NAMES UTF8')

        config = {
            "database": {
                "host": "localhost",
                "user": "******",
                "passwd": "12345",
                "db": "captor",
                "use_unicode": True,
                "charset": 'utf8',
                "init_command": 'SET NAMES UTF8'
            },
            "database_type": "mysql"
        }'''

        self.djv = Dejavu(config)

        self.cursorMySQL = self.db.cursor()

        self.archivo = archivo
        self.fs = t_muestreo
        self.audio = muestras
        self.segmento = segmento
        self.tam = tam
        self.comienzo = comienzo
        self.final = final
        self.m_a = menuanuncios
        self.fecha = fecha
        self.bloques_ordenados = bloques_ordenado
        self.datos_anuncios = datos_anuncio
        self.emisora = emisora_cinta
        self.nombre_cinta = os.path.splitext(os.path.basename(self.archivo))[0]
        self.confidence = confidence
        self.ruta = "C:/CaptorRadio-v2/anuncios"

        pf(self.comienzo)

        self.listaSectorSubsectorProducto = []
        self.listaResultado = []
        self.totalResultados = 0
        self.listaSoportes = []
        self.listaGrupo = []
        self.listaCadena = []
        self.listaEmision = []
        self.listaProgramas = []
        self.listaTipoAnuncios = []
        self.listaProgramas = []
        self.marcaSelec = ""
        self.modeloSelec = ""
        self.sectorSelec = ""
        self.subsectorSelec = ""
        self.productoSelec = ""
        self.codigoPrograma = ""

        # creamos el layout
        self.anunciomainSizer = wx.BoxSizer(wx.VERTICAL)

        # Sizer 1 contiene el título RADIO
        self.anuncio_sizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.stMedio = wx.StaticText(self, label=u"RADIO")
        self.stMedio.SetFont(fuenteTitulo)
        self.anuncio_sizer1.Add(self.stMedio, flag=wx.CENTER, border=10)
        self.anunciomainSizer.Add(self.anuncio_sizer1, 1, wx.LEFT | wx.CENTER, 0)
        # Fin Sizer 1
        # -------------------------------------------------------------------------------
        # Sizer 2 contine MARCA, MODELO, SECTOR, SUBSECTOR, PRODUCTO
        self.anuncio_sizer2 = wx.BoxSizer(wx.HORIZONTAL)

        self.stMarca = wx.StaticText(self, label=u"MARCA")
        self.stMarca.SetFont(fuenteNormal)
        self.anuncio_sizer2.Add(self.stMarca, flag=wx.LEFT, border=10)
        self.txMarca = wx.TextCtrl(self)
        self.anuncio_sizer2.Add(self.txMarca, flag=wx.LEFT, border=10)

        self.stModelo = wx.StaticText(self, label=u"MODELO")
        self.stModelo.SetFont(fuenteNormal)
        self.anuncio_sizer2.Add(self.stModelo, flag=wx.LEFT, border=10)
        self.txModelo = wx.TextCtrl(self)
        self.anuncio_sizer2.Add(self.txModelo, flag=wx.LEFT, border=10)

        self.stSector = wx.StaticText(self, label=u"SECTOR")
        self.stSector.SetFont(fuenteNormal)
        self.anuncio_sizer2.Add(self.stSector, flag=wx.LEFT, border=10)
        # self.txSector = wx.TextCtrl(self)
        # self.anuncio_sizer2.Add(self.txSector, flag=wx.LEFT, border=10)

        self.stSubsector = wx.StaticText(self, label=u"SUBSECTOR")
        self.stSubsector.SetFont(fuenteNormal)
        self.anuncio_sizer2.Add(self.stSubsector, flag=wx.LEFT, border=130)
        # self.txSubsector = wx.TextCtrl(self)
        # self.anuncio_sizer2.Add(self.txSubsector, flag=wx.LEFT, border=10)

        self.stProducto = wx.StaticText(self, label=u"PRODUCTO")
        self.stProducto.SetFont(fuenteNormal)
        self.anuncio_sizer2.Add(self.stProducto, flag=wx.LEFT, border=130)
        # self.txProducto = wx.TextCtrl(self)
        # self.anuncio_sizer2.Add(self.txProducto, flag=wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer2, 1, wx.LEFT, 0)
        # Fin Sizer 2
        # -------------------------------------------------------------------------------
        # Sizer 3 contiene los combobox asociados a MARCA, MODELO, SECTOR, SUBSECTOR y PRODUCTO
        self.anuncio_sizer3 = wx.BoxSizer(wx.HORIZONTAL)

        self.cbMarca = wx.ComboBox(self, size=(179, 25), choices=[],
                                   style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbMarca.Bind(wx.EVT_COMBOBOX, self.onSelectMarca)
        self.anuncio_sizer3.Add(self.cbMarca, flag=wx.LEFT, border=10)

        self.cbModelo = wx.ComboBox(self, size=(189, 25), choices=[],
                                    style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbModelo.Bind(wx.EVT_COMBOBOX, self.onSelectModelo)
        self.anuncio_sizer3.Add(self.cbModelo, flag=wx.LEFT, border=10)

        self.cbSector = wx.ComboBox(self, size=(185, 25), choices=[],
                                    style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbSector.Bind(wx.EVT_COMBOBOX, self.onSelectSector)
        self.anuncio_sizer3.Add(self.cbSector, flag=wx.LEFT, border=10)

        self.cbSubsector = wx.ComboBox(self, size=(220, 25), choices=[],
                                       style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbSubsector.Bind(wx.EVT_COMBOBOX, self.onSelectSubsector)
        self.anuncio_sizer3.Add(self.cbSubsector, flag=wx.LEFT, border=10)

        self.cbProducto = wx.ComboBox(self, size=(210, 25), choices=[],
                                      style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbProducto.Bind(wx.EVT_COMBOBOX, self.onSelectProducto)
        self.anuncio_sizer3.Add(self.cbProducto, flag=wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer3, 1, wx.LEFT, 0)
        # Fin Sizer 3
        # -------------------------------------------------------------------------------
        # Sizer 4 contiene un texto con las posibilidades
        self.anuncio_sizer4 = wx.BoxSizer(wx.HORIZONTAL)

        self.stResultados = wx.StaticText(self, label=u"Resultados posibles")
        self.stResultados.SetFont(fuenteNormal)
        self.anuncio_sizer4.Add(self.stResultados, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)
        self.stResultados2 = wx.StaticText(self)
        self.stResultados2.SetFont(fuenteNormal)
        self.anuncio_sizer4.Add(self.stResultados2, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)

        self.stAnunciante = wx.StaticText(self, label=u"Anunciante")
        self.stAnunciante.SetFont(fuenteNormal)
        self.anuncio_sizer4.Add(self.stAnunciante, flag=wx.ALIGN_LEFT | wx.LEFT, border=238)
        self.stAnunciante2 = wx.StaticText(self)
        self.stAnunciante2.SetFont(fuenteNormal)
        self.anuncio_sizer4.Add(self.stAnunciante2, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer4, 1, wx.ALIGN_LEFT | wx.LEFT, 0)
        # Fin Sizer 4
        # -------------------------------------------------------------------------------
        # Sizer 5 contiene los datos del programa
        self.anuncio_sizer5 = wx.BoxSizer(wx.HORIZONTAL)

        self.stGrupo = wx.StaticText(self, label=u"GRUPO")
        self.stGrupo.SetFont(fuenteNormal)
        self.anuncio_sizer5.Add(self.stGrupo, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)
        self.cbGrupo = wx.ComboBox(self, size=(150, 25), choices=self.listaGrupo,
                                   style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbGrupo.Bind(wx.EVT_COMBOBOX, self.onSelectGrupo)
        self.anuncio_sizer5.Add(self.cbGrupo, flag=wx.LEFT, border=10)
        self.stCadena = wx.StaticText(self, label=u"CADENA")
        self.stCadena.SetFont(fuenteNormal)
        self.anuncio_sizer5.Add(self.stCadena, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)
        self.cbCadena = wx.ComboBox(self, size=(150, 25), choices=self.listaCadena,
                                    style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)

        self.cbCadena.Bind(wx.EVT_COMBOBOX, self.onSelectCadena)
        self.anuncio_sizer5.Add(self.cbCadena, flag=wx.LEFT, border=10)
        self.stEmision = wx.StaticText(self, label=u"EMISIÓN")
        self.stEmision.SetFont(fuenteNormal)
        self.anuncio_sizer5.Add(self.stEmision, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)
        self.cbEmision = wx.ComboBox(self, size=(150, 25), choices=self.listaEmision,
                                     style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)

        self.cbEmision.Bind(wx.EVT_COMBOBOX, self.onSelectEmision)
        self.anuncio_sizer5.Add(self.cbEmision, flag=wx.LEFT, border=10)
        self.stSoporte = wx.StaticText(self)
        self.stSoporte.SetFont(fuenteNormal)
        self.anuncio_sizer5.Add(self.stSoporte, flag=wx.LEFT, border=20)

        self.anunciomainSizer.Add(self.anuncio_sizer5, 1, wx.LEFT, 0)
        # Fin Sizer 5
        # -------------------------------------------------------------------------------
        # Sizer 6 Contiene más datos del programa
        self.anuncio_sizer6 = wx.BoxSizer(wx.HORIZONTAL)

        self.stPrograma = wx.StaticText(self, label=u"PROGRAMA")
        self.stPrograma.SetFont(fuenteNormal)
        self.anuncio_sizer6.Add(self.stPrograma, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)

        self.cbPrograma = wx.ComboBox(self, size=(150, 25), choices=self.listaProgramas,
                                      style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.cbPrograma.Bind(wx.EVT_COMBOBOX, self.onSelectPrograma)
        self.anuncio_sizer6.Add(self.cbPrograma, flag=wx.LEFT, border=10)

        self.stProgramaCodi = wx.StaticText(self)
        self.stProgramaCodi.SetFont(fuenteNormal)
        self.anuncio_sizer6.Add(self.stProgramaCodi, flag=wx.ALIGN_LEFT | wx.LEFT, border=10)

        self.stProgramaH = wx.StaticText(self, label=u"HORA EMISIÓN")
        self.stProgramaH.SetFont(fuenteNormal)
        self.anuncio_sizer6.Add(self.stProgramaH, flag=wx.LEFT, border=448)

        self.stProgramaHMS = wx.StaticText(self)
        self.stProgramaHMS.SetFont(fuenteNormal)
        self.anuncio_sizer6.Add(self.stProgramaHMS, flag=wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer6, 1, wx.LEFT, 0)
        # Fin Sizer 6
        # -------------------------------------------------------------------------------
        # Sizer 7 Contiene información del anuncio
        self.anuncio_sizer7 = wx.BoxSizer(wx.HORIZONTAL)

        self.stFechaAnuncio = wx.StaticText(self, label=u"FECHA ANUNCIO")
        self.stFechaAnuncio.SetFont(fuenteNormal)
        self.anuncio_sizer7.Add(self.stFechaAnuncio, flag=wx.LEFT, border=10)

        self.stFechaAnuncio2 = wx.StaticText(self, label=unicode(self.comienzo))
        self.stFechaAnuncio2.SetFont(fuenteNormal)
        self.anuncio_sizer7.Add(self.stFechaAnuncio2, flag=wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer7, 1, wx.LEFT, 0)
        # Fin Sizer 7
        # -------------------------------------------------------------------------------
        # Sizer 8 Contiene información del anuncio
        self.anuncio_sizer8 = wx.BoxSizer(wx.HORIZONTAL)

        self.stTipoAnuncio = wx.StaticText(self, label=u"TIPO ANUNCIO")
        self.stTipoAnuncio.SetFont(fuenteNormal)
        self.anuncio_sizer8.Add(self.stTipoAnuncio, flag=wx.LEFT, border=10)

        self.cbTipoAnuncio = wx.ComboBox(self, size=(150, 25), choices=self.listaTipoAnuncios,
                                         style=wx.CB_SORT | wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        # self.cbTipoAnuncio.Bind(wx.EVT_COMBOBOX)
        self.anuncio_sizer8.Add(self.cbTipoAnuncio, flag=wx.LEFT, border=10)

        self.txTexto = wx.TextCtrl(self, size=(500, 25))
        self.anuncio_sizer8.Add(self.txTexto, flag=wx.LEFT, border=10)

        self.anunciomainSizer.Add(self.anuncio_sizer8, 1, wx.LEFT, 0)
        # Fin Sizer 8
        # -------------------------------------------------------------------------------
        # Sizer 9
        self.anuncio_sizer9 = wx.BoxSizer(wx.HORIZONTAL)
        self.anunciomainSizer.Add(self.anuncio_sizer9, 1, wx.LEFT, 0)

        # Sizer 10 contiene los botones de BUSCAR, RESET y GUARDAR
        self.anuncio_sizer10 = wx.BoxSizer(wx.HORIZONTAL)

        self.btBuscar = wx.Button(self, label=u"BUSCAR")
        self.btBuscar.Bind(wx.EVT_BUTTON, self.buscarAS400)
        self.anuncio_sizer10.Add(self.btBuscar, flag=wx.LEFT, border=10)

        self.btReset = wx.Button(self, label=u"RESET")
        self.btReset.Bind(wx.EVT_BUTTON, self.onReset)
        self.anuncio_sizer10.Add(self.btReset, flag=wx.LEFT, border=10)

        self.bguardar = wx.Button(self, label=u"GUARDAR")
        self.bguardar.Bind(wx.EVT_BUTTON, self.OnGuardar)
        self.anuncio_sizer10.Add(self.bguardar, 0, wx.LEFT, 10)

        self.anunciomainSizer.Add(self.anuncio_sizer10, 1, wx.LEFT | wx.CENTER, 0)

        self.iniciarDesplegables()

        # Grupo a capón
        self.cbGrupo.SetValue(self.grupo)
        cadenas = [x["IDSOPOR2"] for x in self.listaSoportes if x["IDSOPOR1"] == self.grupo]
        self.cbCadena.AppendItems(list(set(cadenas)))
        # Grupo a capón
        # Cadena a capón
        self.cbCadena.SetValue(self.cadena)
        # Cadena a capón
        # Emisión a capón
        emisiones = [x["IDSOPOR3"] for x in self.listaSoportes if
                     x["IDSOPOR1"] == self.cbGrupo.GetValue() and x["IDSOPOR2"] == self.cadena]
        self.cbEmision.AppendItems(list(set(emisiones)))
        # Emisión a capón

        self.SetSizerAndFit(self.anunciomainSizer)
        self.Layout()