1 package org.rpi.player;
2
3 import org.apache.log4j.Logger;
4
5
6
7
8
9
10
11
12
13
14
15 public class CommandTracker {
16
17 private Logger log = Logger.getLogger(this.getClass());
18
19 private long last_time = 0;
20 private String last_command = "";
21
22 public boolean setRequest(String s) {
23 boolean res = true;
24 long now = System.currentTimeMillis();
25 if (last_command.toUpperCase().startsWith("SEEK")) {
26 if (s.equalsIgnoreCase("PLAY")) {
27 long time_span = now - last_time;
28 if (time_span < 1000) {
29 log.debug("Ignore this request: " + s + " Time since Seek: " + time_span );
30 res = false;
31 }
32 }
33 }
34 last_time = now;
35 last_command=s;
36 return res;
37 }
38
39 }