Package com.echonest.api.v4

Examples of com.echonest.api.v4.Term


        }

        System.out.println(" =========  videos ======== ");
        List<Video> videos = artist.getVideos();
        for (int i = 0; i < videos.size(); i++) {
            Video video = videos.get(i);
            video.dump();
        }
    }
View Full Code Here


                        }
                    }
                });

        for (Artist artist : artists) {
            YearsActive ya = artist.getYearsActive();
            Long earliest = ya.getRange()[0];
            System.out.println(earliest + " " + artist.getName());
        }

    }
View Full Code Here

            return;
        }

        checked.add(artist.getID());

        YearsActive ya = artist.getYearsActive();
        String msg = "";

        yaTries++;

        if (ya.size() > 0) {
            yaFound++;
            int start = ya.getRange(0)[0].intValue();
            int end = ya.getRange(ya.size() - 1)[1] == null ? 2011 : ya
                    .getRange(ya.size() - 1)[1].intValue();

            if (start < 1880L) {
                msg += " too early";
            }

            if (start > 2011L) {
                msg += " too late";
            }

            if (end > 2011) {
                msg += " end too late";
            }

            if (end - start > 70) {
                msg += " probably too long";
            }

            if (start > end) {
                msg += " memento artist";
            }

            if (ya.size() > 5) {
                msg += " many splits";
            }

            for (int i = 0; i < ya.size() - 1; i++) {
                int tstart = ya.getRange(i)[0].intValue();
                int tend = ya.getRange(i)[1] == null ? 2011 : ya.getRange(i)[1]
                        .intValue();
                int nstart = ya.getRange(i + 1)[0].intValue();

                if (tstart >= nstart) {
                    msg += " range overlap";
                }

                if (tend >= nstart) {
                    msg += " range overlap";
                }

                if (tend < start) {
                    msg += " bad single range";
                }
            }

        } else {
            msg += " missing years active";
        }

        if (msg.length() > 0) {
            System.out.printf(" %d %d %d %s %s\n", yaTries, yaFound, yaErrors,
                    artist.getName(), msg);
        }
        if (msg.length() > 0) {
            ya.dump();
        }
    }
View Full Code Here

  @Before
  public void setUp() throws EchoNestException {
    cmd = new Commander("test");
    cmd.setTraceSends(false);
    cmd.setTraceRecvs(false);
    sse = new SearchSongsExample();
    Params stdParams = new Params();
    stdParams.add("api_key", "FILDTEOIK2HBORODV");
    cmd.setStandardParams(stdParams);
  }
View Full Code Here

  private String prefix = "music://id.echonest.com/~/AR/";
  private SearchSongsExample sse;

  @Before
  public void setUp() throws EchoNestException {
    cmd = new Commander("test");
    cmd.setTraceSends(false);
    cmd.setTraceRecvs(false);
    sse = new SearchSongsExample();
    Params stdParams = new Params();
    stdParams.add("api_key", "FILDTEOIK2HBORODV");
View Full Code Here

    cmd.sendCommand("artist/similar", params);
  }

  @Test
  public void testBadApiKey() throws EchoNestException {
    Commander lcmd = new Commander("test");
    Params stdParams = new Params();
    stdParams.add("api_key", "CRAPPYKEY");
    lcmd.setStandardParams(stdParams);

    Params params = new Params();
    params.add("id", radiohead);
    try {
      lcmd.sendCommand("artist/similar", params, false);
      fail();
    } catch (EchoNestException e) {
        System.out.println("code " + e.getCode());
      assertTrue(e.getCode() == EchoNestException.ERR_MISSING_OR_INVALID_API_KEY);
    }
View Full Code Here

    private static String[] artists = { "weezer", "muse", "the+beatles", "modest+mouse", "bjork", "bonerama",
                    "lady+gaga","bj%C3%B6rk", "led+zeppelin", "taylor+swift"};
   
    @BeforeClass
    public static void setUpClass()  {
        cmd = new Commander("test");
        cmd.setTraceSends(false);
        cmd.setTraceRecvs(false);
       
    }
View Full Code Here

 
  @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

TOP

Related Classes of com.echonest.api.v4.Term

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.