Package com.jitcaforwin.extended.impl.collections

Examples of com.jitcaforwin.extended.impl.collections.TrackCollectionImpl


   * {@inheritDoc}
   */
  public TrackCollection getTracks(String name) {
    try {
      IITTrackCollection searchResult = this.itLibrary.search(name, ITPlaylistSearchField.SongNames());
      return new TrackCollectionImpl(this, searchResult);
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(this);
    }

  }
View Full Code Here


  private boolean loadedFromITunes;
 
  public GenreImpl(String name, Source source){
    this.source = source;
    this.name = name;
    tracks = new TrackCollectionImpl(this.source, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    this.loadedFromITunes = false; // All tracks of a genre are loaded from iTunes, when they are needed.
  }
View Full Code Here

   */
  public TrackCollectionImpl lastPlayed(int num) {
    try {
      PlayedTracksList playedTracks = new PlayedTracksList(this.library, this.iTunes.getLibraryPlaylist()
          .getTracks());
      TrackCollectionImpl tracks = new TrackCollectionImpl(this.library, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);

      for (int i = playedTracks.size() - 1; i >= playedTracks.size() - num; i--) {
        tracks.add(playedTracks.get(i).getTrack());
      }
      return tracks;
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(null);
    }
View Full Code Here

   */
  public TrackCollectionImpl lastPlayed(JitcaDate since) {
    try {
      PlayedTracksList playedTracks = new PlayedTracksList(this.library, this.iTunes.getLibraryPlaylist()
          .getTracks(), since);
      TrackCollectionImpl tracks = new TrackCollectionImpl(this.library, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);

      for (PlayedTracksListElement playedTrack : playedTracks) {
        tracks.add(playedTrack.getTrack());
      }
      return tracks;
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(null);
    }
View Full Code Here

  protected ArtistImpl(String name, Source source) {
    super(source.isLazy());
    this.source = source;
    this.name = name;
    this.tracks = new TrackCollectionImpl(this.source, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    this.tracksAsComposer = new TrackCollectionImpl(this.source, TrackCollectionImpl.DUPLICATES_NOT_ALLOWED);
    if (!this.lazy) {
      this.loadAllTracks();
    }
  }
View Full Code Here

   *
   * @throws JitcaException
   */
  protected void loadTracks() {
    try {
      this.tracks = new TrackCollectionImpl(this.source, this.itPlaylist.getTracks());
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(this);
    }
  }
View Full Code Here

   * @throws JitcaException
   *             if an error occurs.
   */
  public TrackCollectionImpl getTracksOfGenre(String genre){
    try{JLogger.debug(SearchService.class, "loadTracksOfGenre() for \"" + genre + "\"");
    TrackCollectionImpl tracks = this.createTrackCollection(this.itPlaylist.search(genre, ITPlaylistSearchField.All()));
    TrackCollectionImpl tracksCleaned = new TrackCollectionImpl(this.source);
    for (Track track : tracks) {
      if (track.getGenre().equals(genre)) {
        tracksCleaned.add(track);
      }
    }
    return tracksCleaned;
  } catch (PlaylistDeletedException e) {
    throw new ITObjectDeletedError(this.source);
View Full Code Here

      throw new ITObjectDeletedError(this.source);
    }
  }

  private TrackCollectionImpl createTrackCollection(IITTrackCollection tracks) {
    return new TrackCollectionImpl(this.source, tracks);
  }
View Full Code Here

   */
  public Track addFile(File file) throws JitcaException {
    try {
      IITOperationStatus addOperationStatus = this.itLibrary.addFile(file);
      addOperationStatus.waitForCompletion();
      TrackCollectionImpl tracks = new TrackCollectionImpl(this, addOperationStatus.getTracks());
      Track newTrack = tracks.getFirst();
      this.addTrack(newTrack);
      return newTrack;
    } catch (PlaylistDeletedException e) {
      throw new ITObjectDeletedError(this);
    } catch (PlaylistReadOnlyException e) {
View Full Code Here

   */
  public TrackCollection addFiles(File files[]) throws JitcaException {
    try {
      IITOperationStatus addOperationStatus = this.itLibrary.addFiles(files);
      addOperationStatus.waitForCompletion();
      TrackCollectionImpl newTracks = new TrackCollectionImpl(this, addOperationStatus.getTracks());
      this.addTracks(newTracks);
      return newTracks;
    } catch (PlaylistReadOnlyException e) {
      throw new UserLibraryReadOnly(this);
    } catch (PlaylistDeletedException e) {
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.impl.collections.TrackCollectionImpl

Copyright © 2018 www.massapicom. 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.