public class TracksLastPlayedDemo {
public static void main(String args[]){
System.out.println("Note: The following operations could take a while for large libraries.");
IJitcaITunesController iTunes = new JitcaiTunesController(true);
TrackCollection tracksLastPlayed = iTunes.getTrackController().lastPlayed(10);
System.out.println("The following tracks were played recently:");
for (Track track : tracksLastPlayed){
System.out.println("\"" + track.getTitle() + "\" (" + track.getAlbum() + ")");
}
final long millisecondsOfDay = 24 * 60 * 60 * 1000;
TrackCollection tracksPlayedToday = iTunes.getTrackController().lastPlayed(new JitcaDate(new Date(System.currentTimeMillis()-millisecondsOfDay)));
System.out.println("The following tracks were played during the last 24 hours:");
for (Track track : tracksPlayedToday){
System.out.println("\"" + track.getTitle() + "\" (" + track.getAlbum() + ")");
}
iTunes.close();
}