Package extended

Source Code of extended.TracksLastPlayedDemo

package extended;



import java.util.Date;

import com.jitcaforwin.extended.JitcaiTunesController;
import com.jitcaforwin.extended.api.IJitcaITunesController;
import com.jitcaforwin.extended.api.track.Track;
import com.jitcaforwin.extended.collections.TrackCollection;
import com.jitcaforwin.main.specialtypes.JitcaDate;


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();
  }
}
TOP

Related Classes of extended.TracksLastPlayedDemo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.