Moved MPRIS to a new project
[stereo.git] / DAAPLib / src / util / command / ctrlint / PlaySpec.java
blob8fb363e66c50f35ee9c3113c53c7898ef7285c5c
1 package util.command.ctrlint;
3 import interfaces.DJInterface;
4 import interfaces.Track;
5 import interfaces.collection.Collection;
7 import java.math.BigInteger;
8 import java.util.Map;
10 import util.command.Command;
11 import util.queryparser.QueryParser;
12 import util.queryparser.Token;
13 import api.Response;
15 public class PlaySpec implements Command {
17 private String playlist;
19 public void init(Map<String, String> args) {
20 playlist = args.get("playlist-spec");
23 public Response run(DJInterface dj) {
25 Token t = (Token)QueryParser.parse(playlist);
27 long playlist = new BigInteger(t.value).longValue();
29 for (Collection<? extends Track> c: dj.library().collections()) {
30 if (c.persistentId() == playlist) {
31 System.out.println("playlist set: " + c.name());
32 dj.playbackControl().setSource(c.source());
36 return new Response(null, Response.NO_CONTENT);