Пример #1
0
def caracterizar_reproducciones_R1(analyzer,feature,minF,maxF):
    omap = analyzer[feature]
    values = oms.values(omap,minF,maxF)
    
    artistas = lt.newList('ARRAY_LIST')
    events = lt.newList('ARRAY_LIST')
    for valor in lt.iterator(values):
        añadir_evento_artista_AY(valor,events,artistas)
         
    return (lt.size(events),lt.size(artistas))
Пример #2
0
def relacionar_features_AY(feature1,feature2,min1,max1,min2,max2):
    rank1= oms.values(feature1,min1,max1)
    rank2 = oms.values(feature2,min2,max2)

    lstR1 = obtener_valores_AY(rank1)
    lstR2 = obtener_valores_AY(rank2)
    
    omap = keyValuesNewOmap(lstR2,'track_id')

    tracksOmap = oms.keySet(omap)
    pistas = lt.newList('ARRAY_LIST')
    tracksU = lt.newList('ARRAY_LIST')

    for pista in lt.iterator(lstR1):
        if (pista['track_id'] in lt.iterator(tracksOmap))and(pista['track_id']  not in lt.iterator(tracksU)):
            lt.addLast(pistas,pista)
            lt.addLast(tracksU,pista['track_id'])
    
    fiveEvents = al_azar_AY(pistas)
    return (lt.size(tracksU),fiveEvents)
Пример #3
0
def values(map, keylo, keyhi):
    """
    Retorna todas los valores del arbol que se encuentren entre
    [keylo, keyhi]
    Args:
        map: La tabla de simbolos
        keylo: limite inferior
        keylohi: limite superiorr
    Returns:
        Las llaves en el rago especificado
    Raises:
        Exception
    """
    return om.values(map, keylo, keyhi)
Пример #4
0
def generos_tiempo(analyzer,minh,maxh):
    rankT = oms.values(analyzer['timestamp'],minh,maxh)
    lstT = obtener_valores_AY(rankT)
    omapT = keyValuesNewOmap(lstT,'user_id')
    
    reggae = oms.values(analyzer["tempo"],60,90)
    down_tempo = oms.values(analyzer["tempo"],70,100)
    chill_out = oms.values(analyzer["tempo"],90,120)
    hip_hop = oms.values(analyzer["tempo"],85,115)
    jazz_funk= oms.values(analyzer["tempo"],120,125)
    pop= oms.values(analyzer["tempo"],100,130)
    r_b= oms.values(analyzer["tempo"],60,80)
    rock =oms.values(analyzer["tempo"],110,140)
    metal = oms.values(analyzer["tempo"],140,160)

    mapReggae = obtener_valores_R5(analyzer,omapT,reggae,'reggae')
    mapDownT =  obtener_valores_R5(analyzer,omapT,down_tempo,'down-tempo')
    mapChill = obtener_valores_R5(analyzer,omapT,chill_out,'chill-out')
    mapHipH = obtener_valores_R5(analyzer,omapT,hip_hop,'hip-hop')
    mapJazzF = obtener_valores_R5(analyzer,omapT,jazz_funk,'jazz-funk')
    mapPop = obtener_valores_R5(analyzer,omapT,pop,'pop')
    mapRB = obtener_valores_R5(analyzer,omapT,r_b,'r&b')
    mapRock = obtener_valores_R5(analyzer,omapT,rock,'rock')
    mapMetal = obtener_valores_R5(analyzer,omapT,metal,'metal')
    lstGen = lt.newList('ARRAY_LIST',cmpfunction=cmpGenbyRep)
    lt.addLast(lstGen,mapReggae)
    lt.addLast(lstGen,mapDownT)
    lt.addLast(lstGen,mapChill)
    lt.addLast(lstGen,mapHipH)
    lt.addLast(lstGen,mapJazzF)
    lt.addLast(lstGen,mapPop)
    lt.addLast(lstGen,mapRB)
    lt.addLast(lstGen,mapRock)
    lt.addLast(lstGen,mapMetal)
    primero = lt.firstElement(lstGen)
    repT =lt.size(lstT)
    return (lstGen,primero,repT)
Пример #5
0
def generos_musicales(analyzer,generos,newGen,min1,max1):
    generos = generos.lower()
    generos = generos.split(',')

    lst_new_gen = None
    if newGen != None:
        lst_new_gen = oms.values(analyzer['tempo'],min1,max1)

    
    reggae = oms.values(analyzer["tempo"],60,90)
    down_tempo = oms.values(analyzer["tempo"],70,100)
    chill_out = oms.values(analyzer["tempo"],90,120)
    hip_hop = oms.values(analyzer["tempo"],85,115)
    jazz_funk= oms.values(analyzer["tempo"],120,125)
    pop= oms.values(analyzer["tempo"],100,130)
    r_b= oms.values(analyzer["tempo"],60,80)
    rock =oms.values(analyzer["tempo"],110,140)
    metal = oms.values(analyzer["tempo"],140,160)

    num_rep = 0
    lst_rep_gen = lt.newList('ARRAY_LIST')

    for genero in generos:
        if genero == "reggae":
            rango = '60 - 90'
            map1 = obtener_valores_R4_AY(genero,reggae,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma

        elif genero == "down-tempo":
            rango = '70 - 100'
            map1 = obtener_valores_R4_AY(genero,down_tempo,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "chill-out":
            rango = '90 - 120'
            map1 = obtener_valores_R4_AY(genero,chill_out,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "hip-hop":
            rango = '85 - 115'
            map1 = obtener_valores_R4_AY(genero,hip_hop,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "jazz and funk":
            rango = '120 - 125'
            map1 = obtener_valores_R4_AY(genero,jazz_funk,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "pop":
            rango = '100 - 130'
            map1 = obtener_valores_R4_AY(genero,pop,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "r&B":
            rango = '60 - 80'
            map1 = obtener_valores_R4_AY(genero,r_b,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "rock":
            rango = '110 - 140'
            map1 = obtener_valores_R4_AY(genero,rock,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        elif genero == "metal":
            rango = '100 - 160'
            map1 = obtener_valores_R4_AY(genero,metal,rango)
            suma = getValue(map1,'num_rep')
            lt.addLast(lst_rep_gen,map1)
            num_rep+=suma
        else:
            if newGen != None:
                rango = f'{min1} - {max1}'
                map1 = obtener_valores_R4_AY(newGen,lst_new_gen,rango)
                suma = getValue(map1,'num_rep')
                lt.addLast(lst_rep_gen,map1)
                num_rep+=suma
    return (num_rep,lst_rep_gen)