Package com.echonest.api.v4.examples

Examples of com.echonest.api.v4.examples.TasteProfileExample


 
  @SuppressWarnings("unchecked")
  Segment(Map map) {
    super(map);
   
    MQuery mq = new MQuery(map);
    loudnessStart = mq.getDouble("loudness_start");
    loudnessMaxTime = mq.getDouble("loudness_max_time");
    loudnessMax = mq.getDouble("loudness_max");
    List lpitches = (List) mq.getObject("pitches");
   
    pitches = new double[lpitches.size()];
    for (int i = 0; i < lpitches.size(); i++) {
      Double p = (Double) lpitches.get(i);
      pitches[i] = p;
    }
   
    List ltimbre = (List) mq.getObject("timbre");
    timbre = new double[ltimbre.size()];
    for (int i = 0; i < ltimbre.size(); i++) {
      Double p = (Double) ltimbre.get(i);
      timbre[i] = p;
    }
View Full Code Here


        Map results = cmd.sendCommand("artist/top_terms", p);
        Map response = (Map) results.get("response");
        List termList = (List) response.get("terms");
        for (int i = 0; i < termList.size(); i++) {
            Map tmap = (Map) termList.get(i);
            MQuery mq = new MQuery(tmap);
            String tname = mq.getString("name");
            double frequency = mq.getDouble("frequency");
            // there's no separate weight for top terms
            Term term = new Term(tname, frequency, frequency);
            terms.add(term);
        }
        return terms;
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    protected PagedListInfo getPagedDocuments(String path, Map response)
            throws EchoNestException {
        MQuery mq = new MQuery(response);
        Integer start = mq.getInteger("start", 0);
        Integer total = mq.getInteger("total");
        if (total == null) {
            throw new EchoNestException(
                    EchoNestException.CLIENT_SERVER_INCONSISTENCY,
                    "Missing total in doc return");
        }
        List list = (List) mq.getObject(path);
        return new PagedListInfo(start, total, list);
    }
View Full Code Here

    private double start;
    private double duration;
    private double confidence;

    TimedEvent(Map map) {
        MQuery mq = new MQuery(map);
        start = mq.getDouble("start");
        duration = mq.getDouble("duration");
        confidence = mq.getDouble("confidence");
    }
View Full Code Here

            return (Double) value;
        }
    }

    protected Object getObject(String path) {
        MQuery mq = new MQuery(map);
        return mq.getObject(path);
    }
View Full Code Here

    private MQuery mq;

    @SuppressWarnings("unchecked")
    TrackAnalysis(Map map) {
        this.map = map;
        this.mq = new MQuery(map);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private List<Term> listToTerms(List docs) {
        List<Term> terms = new ArrayList<Term>();
        for (int i = 0; i < docs.size(); i++) {
            Map map = (Map) docs.get(i);
            MQuery mq = new MQuery(map);
            String tname = mq.getString("name");
            double frequency = mq.getDouble("frequency");
            double weight = mq.getDouble("weight");
            Term term = new Term(tname, weight, frequency);
            terms.add(term);
        }
        return terms;
    }
View Full Code Here

    public String getString(String path) {
        return (String) getObject(path);
    }

    public Object getObject(String path) {
        MQuery mq = new MQuery(data);
        return mq.getObject(path);
    }
View Full Code Here

            p.add("bucket", bucket);
        }

        Map results = en.getCmd().sendCommand(type + "/profile", p);
        Map response = (Map) results.get("response");
        MQuery mq = new MQuery(response);
        return (Map) mq.getObject(path);
    }
View Full Code Here

            p.add("bucket", buckets);
        }

        Map results = en.getCmd().sendCommand(type + "/profile", p);
        Map response = (Map) results.get("response");
        MQuery mq = new MQuery(response);
        return (Map) mq.getObject(path);
    }
View Full Code Here

TOP

Related Classes of com.echonest.api.v4.examples.TasteProfileExample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.