Package com.echonest.api.v4.util

Examples of com.echonest.api.v4.util.Shell


                    System.out.println("Energy: " + track.getEnergy());
                    System.out.println("Loudness: " + track.getLoudness());
                    System.out.println();
                    System.out.println("Beat start times:");
                   
                    TrackAnalysis analysis = track.getAnalysis();
                    for (TimedEvent beat : analysis.getBeats()) {
                        System.out.println("beat " + beat.getStart());
                    }
                } else {
                    System.err.println("Trouble analysing track " + track.getStatus());
                }
View Full Code Here


            }
        });

        shell.add("trackBeats", new ShellCommand() {
            public String execute(Shell ci, String[] args) throws Exception {
                TrackAnalysis a = currentTrack.getAnalysis();
                List<TimedEvent> beats = a.getBeats();
                for (TimedEvent beat : beats) {
                    System.out.printf("%.6f, %.6f\n", beat.getStart(), beat
                            .getDuration());
                }
                return "";
View Full Code Here

            System.out.println(" ---- track ----");
            System.out.println("id      : " + track.getID());
            System.out.println("status  : " + track.getStatus());
            System.out.println("analysis: " + track.getAnalysisURL());

            TrackAnalysis analysis = track.getAnalysis();
            if (full && analysis != null) {
                analysis.dump();
            }
        }
    }
View Full Code Here

        }

        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

TOP

Related Classes of com.echonest.api.v4.util.Shell

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.