}
});
shell.add("splaylist", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
PlaylistParams p = new PlaylistParams();
p.setType(PlaylistType.ARTIST_RADIO);
p.addArtist(Shell.mash(args, 1));
p.setResults(10);
p.setVariety(.5f);
Playlist playlist = en.createStaticPlaylist(p);
for (Song song : playlist.getSongs()) {
System.out.printf("%40.40s %s\n", song.getArtistName(),
song.getTitle());
}
return "";
}
public String getHelp() {
return "generates an artist radio playlist";
}
});
shell.add("bplaylist", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
BasicPlaylistParams p = new BasicPlaylistParams();
p.setType(BasicPlaylistParams.PlaylistType.ARTIST_RADIO);
p.addArtist(Shell.mash(args, 1));
p.setResults(10);
Playlist playlist = en.createBasicPlaylist(p);
for (Song song : playlist.getSongs()) {
System.out.printf("%40.40s %s\n", song.getArtistName(),
song.getTitle());
}
return "";
}
public String getHelp() {
return "generates a basic artist radio playlist";
}
});
shell.add("wiki_bio_cov", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
List<Artist> artists = en.topHotArtists(1000);
int count = 0;
int which = 0;
for (Artist artist : artists) {
which++;
List<Biography> bios = artist.getBiographies(0, 100,
"cc-by-sa");
if (bios.size() == 0) {
count++;
System.out.printf("%d %d %s\n", which, count, artist
.getName());
}
}
System.out.println("Missing coverage count " + count);
return "";
}
public String getHelp() {
return "shows artist wiki bio coverage";
}
});
shell.add("trace", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
if (args.length == 2) {
en.setTraceSends(args[1].equals("true"));
en.setTraceRecvs(args[1].equals("true"));
} else {
System.out.println("Usage: trace true|false");
}
return "";
}
public String getHelp() {
return "enables/disables trace";
}
});
shell.add("traceSends", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
if (args.length == 2) {
en.setTraceSends(args[1].equals("true"));
} else {
System.out.println("Usage: traceSends true|false");
}
return "";
}
public String getHelp() {
return "enables/disables trace sends";
}
});
shell.add("traceRecvs", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
if (args.length == 2) {
en.setTraceRecvs(args[1].equals("true"));
} else {
System.out.println("Usage: traceRecvs true|false");
}
return "";
}
public String getHelp() {
return "enables/disables trace recvs";
}
});
shell.add("ya_check", new ShellCommand() {
public String execute(Shell ci, String[] args) throws Exception {
int count = 10;
String artistName = "justin bieber";
if (args.length > 1) {
count = Integer.parseInt(args[1]);
}
if (args.length > 2) {
artistName = Shell.mash(args, 2);
}
Artist curSeed = getArtist(artistName);
List<Artist> queue = new ArrayList<Artist>();
Set<String> visited = new HashSet<String>();
queue.add(curSeed);
while (queue.size() > 0) {
Artist artist = queue.remove(0);
if (!visited.contains(artist.getID())) {
visited.add(artist.getID());
if (visited.size() > count) {
break;
}
ArtistParams p = new ArtistParams();
p.includeYearsActive();
p.setID(artist.getID());
for (Artist sim : en.getSimilarArtists(p)) {
yaCheck(sim);
queue.add(sim);
}
}