Like en dislike acties voor iTunes toegevoegd.
This commit is contained in:
@@ -173,4 +173,8 @@ public class ITPlaylist extends ITObject {
|
|||||||
public void toggleShuffle() {
|
public void toggleShuffle() {
|
||||||
setShuffle(!getShuffle());
|
setShuffle(!getShuffle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsTrack(ITTrack track) {
|
||||||
|
return getTracks().containsTrack(track);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,4 +88,12 @@ public class ITTrackCollection {
|
|||||||
return new ITTrack(item);
|
return new ITTrack(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsTrack(ITTrack track) {
|
||||||
|
String name = track.getName();
|
||||||
|
try {
|
||||||
|
return ItemByName(name).getName().equals(name);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,8 +499,36 @@ public class iTunes {
|
|||||||
Dispatch window = iTunes.getProperty("BrowserWindow").toDispatch();
|
Dispatch window = iTunes.getProperty("BrowserWindow").toDispatch();
|
||||||
return new ITBrowserWindow(window);
|
return new ITBrowserWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cycleSongRepeat() {
|
public void cycleSongRepeat() {
|
||||||
getCurrentPlaylist().cycleSongRepeat();
|
getCurrentPlaylist().cycleSongRepeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ITPlaylist getPlaylist(String name) {
|
||||||
|
ITPlaylistCollection playlistCollection = getLibrarySource().getPlaylists();
|
||||||
|
ITPlaylist playlist = playlistCollection.ItemByName(name);
|
||||||
|
try {
|
||||||
|
playlist.getName();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
playlist = createPlaylist(name);
|
||||||
|
}
|
||||||
|
return playlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITUserPlaylist getUserPlaylist(String name) {
|
||||||
|
ITPlaylist playlist = getPlaylist(name);
|
||||||
|
ITUserPlaylist userPlaylist = new ITUserPlaylist(playlist.fetchDispatch());
|
||||||
|
return userPlaylist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playlistAddTrack(String name, ITTrack track) {
|
||||||
|
ITUserPlaylist userPlaylist = getUserPlaylist(name);
|
||||||
|
if (!userPlaylist.containsTrack(track)) {
|
||||||
|
userPlaylist.addTrack(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playlistAddCurrentTrack(String name) {
|
||||||
|
playlistAddTrack(name, getCurrentTrack());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class Macro extends Sequence {
|
|||||||
}
|
}
|
||||||
if (!holdList.isEmpty()) {
|
if (!holdList.isEmpty()) {
|
||||||
throw new StateOrderException("One or more buttons are not released.");
|
throw new StateOrderException("One or more buttons are not released.");
|
||||||
}
|
}
|
||||||
eventArray = (State[]) eventList.toArray(new State[0]);
|
this.eventArray = (State[]) eventList.toArray(new State[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,8 +66,8 @@ public class Main extends EventListener {
|
|||||||
//add(new ExampleApplication());
|
//add(new ExampleApplication());
|
||||||
//add(new WMPApplication());
|
//add(new WMPApplication());
|
||||||
//add(new GomPlayerApplication());
|
//add(new GomPlayerApplication());
|
||||||
add(new WinampApplication());
|
//add(new WinampApplication());
|
||||||
//add(new iTunesApplication());
|
add(new iTunesApplication());
|
||||||
//add(new VLCApplication());
|
//add(new VLCApplication());
|
||||||
//add(new MPCApplication());
|
//add(new MPCApplication());
|
||||||
startApplications();
|
startApplications();
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import pm.exception.application.ApplicationExitException;
|
|||||||
import pm.value.Action;
|
import pm.value.Action;
|
||||||
|
|
||||||
import com.dt.iTunesController.ITCOMDisabledReason;
|
import com.dt.iTunesController.ITCOMDisabledReason;
|
||||||
import com.dt.iTunesController.ITPlaylistRepeatMode;
|
|
||||||
import com.dt.iTunesController.ITTrack;
|
import com.dt.iTunesController.ITTrack;
|
||||||
import com.dt.iTunesController.iTunes;
|
import com.dt.iTunesController.iTunes;
|
||||||
import com.dt.iTunesController.iTunesEventsInterface;
|
import com.dt.iTunesController.iTunesEventsInterface;
|
||||||
@@ -13,6 +12,8 @@ import com.dt.iTunesController.iTunesEventsInterface;
|
|||||||
public class iTunesApplication extends Application implements iTunesEventsInterface {
|
public class iTunesApplication extends Application implements iTunesEventsInterface {
|
||||||
protected static final int POSTION_CHANGE_RATE = 1;
|
protected static final int POSTION_CHANGE_RATE = 1;
|
||||||
protected static final int VOLUME_CHANGE_RATE = 5;
|
protected static final int VOLUME_CHANGE_RATE = 5;
|
||||||
|
protected static final String PLAYLIST_LIKE = "Like";
|
||||||
|
protected static final String PLAYLIST_DISLIKE = "Dislike";
|
||||||
|
|
||||||
protected iTunes iTunes;
|
protected iTunes iTunes;
|
||||||
|
|
||||||
@@ -71,6 +72,12 @@ public class iTunesApplication extends Application implements iTunesEventsInterf
|
|||||||
iTunes.cycleSongRepeat();
|
iTunes.cycleSongRepeat();
|
||||||
//iTunes.resume();
|
//iTunes.resume();
|
||||||
break;
|
break;
|
||||||
|
case LIKE:
|
||||||
|
iTunes.playlistAddCurrentTrack(PLAYLIST_LIKE);
|
||||||
|
break;
|
||||||
|
case DISLIKE:
|
||||||
|
iTunes.playlistAddCurrentTrack(PLAYLIST_DISLIKE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ public class JIntellitypeDevice extends Device implements HotkeyListener, Intell
|
|||||||
add(
|
add(
|
||||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
|
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
|
||||||
new Task(Action.EXIT, Target.MAIN));
|
new Task(Action.EXIT, Target.MAIN));
|
||||||
|
add(
|
||||||
|
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'n'),
|
||||||
|
new Task(Action.NEXT, Target.APPLICATION));
|
||||||
|
add(
|
||||||
|
new Hotkey(Modifier.CTRL | Modifier.SHIFT | Modifier.WIN, 'p'),
|
||||||
|
new Task(Action.PREVIOUS, Target.APPLICATION));
|
||||||
/*add(
|
/*add(
|
||||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 't'),
|
new Hotkey(Modifier.CTRL | Modifier.WIN, 't'),
|
||||||
new Task(Action.TEST, Target.MAIN));
|
new Task(Action.TEST, Target.MAIN));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.wiigee.util.Log;
|
|||||||
|
|
||||||
import pm.Button;
|
import pm.Button;
|
||||||
import pm.Device;
|
import pm.Device;
|
||||||
|
import pm.Macro;
|
||||||
import pm.device.wiimote.gesture.GestureDevice;
|
import pm.device.wiimote.gesture.GestureDevice;
|
||||||
import pm.event.Task;
|
import pm.event.Task;
|
||||||
import pm.event.task.Continuous;
|
import pm.event.task.Continuous;
|
||||||
@@ -13,6 +14,7 @@ import pm.event.task.Dynamic;
|
|||||||
import pm.exception.button.UnknownButtonException;
|
import pm.exception.button.UnknownButtonException;
|
||||||
import pm.exception.device.DeviceExitException;
|
import pm.exception.device.DeviceExitException;
|
||||||
import pm.exception.device.DeviceInitialiseException;
|
import pm.exception.device.DeviceInitialiseException;
|
||||||
|
import pm.exception.macro.StateOrderException;
|
||||||
import pm.macro.state.Hold;
|
import pm.macro.state.Hold;
|
||||||
import pm.macro.state.Press;
|
import pm.macro.state.Press;
|
||||||
import pm.macro.state.Release;
|
import pm.macro.state.Release;
|
||||||
@@ -96,6 +98,20 @@ public class WiimoteDevice extends Device implements GestureListener {
|
|||||||
add(
|
add(
|
||||||
new Press(WiimoteButton.HOME),
|
new Press(WiimoteButton.HOME),
|
||||||
new Task(Action.NEXT, Target.MAIN));
|
new Task(Action.NEXT, Target.MAIN));
|
||||||
|
try {
|
||||||
|
add(
|
||||||
|
new Macro(
|
||||||
|
new Hold(WiimoteButton.TWO),
|
||||||
|
new Press(WiimoteButton.PLUS),
|
||||||
|
new Release(WiimoteButton.TWO)),
|
||||||
|
new Task(Action.LIKE, Target.APPLICATION));
|
||||||
|
add(
|
||||||
|
new Macro(
|
||||||
|
new Hold(WiimoteButton.TWO),
|
||||||
|
new Press(WiimoteButton.MINUS),
|
||||||
|
new Release(WiimoteButton.TWO)),
|
||||||
|
new Task(Action.DISLIKE, Target.APPLICATION));
|
||||||
|
} catch (StateOrderException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exit() throws DeviceExitException {
|
public void exit() throws DeviceExitException {
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ public enum Action {
|
|||||||
VOLUME_DOWN,
|
VOLUME_DOWN,
|
||||||
VOLUME_UP,
|
VOLUME_UP,
|
||||||
FULLSCREEN,
|
FULLSCREEN,
|
||||||
TRAIN, STOP, SAVE, RECOGNIZE, LOAD, SHUFFLE, FADEOUT, QUIT, VISUALISER;
|
TRAIN, STOP, SAVE, RECOGNIZE, LOAD, SHUFFLE, FADEOUT, QUIT, VISUALISER, LIKE, DISLIKE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user