Package com.jitcaforwin.basic.api

Examples of com.jitcaforwin.basic.api.IITTrackCollection


   * @return All tracks in the library of the specified artist.
   * @throws JitcaException
   *             if an error occurs.
   */
  public TrackCollectionImpl getTracksOfArtist(String artist) {
    IITTrackCollection itTracks = this.tracksArtist.get(artist);
    if (itTracks == null) {
      itTracks = this.loadTracksOfArtist(artist);
      this.tracksArtist.put(artist, itTracks);
    }
    return this.createTrackCollection(itTracks);
View Full Code Here


   * @return All tracks in the library of the specified composer.
   * @throws JitcaException
   *             if an error occurs.
   */
  public TrackCollectionImpl getTracksOfComposer(String composer) {
    IITTrackCollection itTracks = this.tracksComposer.get(composer);
    if (itTracks == null) {
      itTracks = this.loadTracksOfComposer(composer);
      this.tracksComposer.put(composer, itTracks);
    }
    return this.createTrackCollection(itTracks);
View Full Code Here

   * @return All tracks of the specified album.
   * @throws JitcaException
   *             if an error occurs.
   */
  public TrackCollectionImpl getTracksOfAlbum(String album) {
    IITTrackCollection itTracks = this.tracksAlbum.get(album);
    if (itTracks == null) {
      itTracks = this.loadTracksOfAlbum(album);
      this.tracksAlbum.put(album, itTracks);
    }
    return this.createTrackCollection(itTracks);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public Track getTrack(String name) throws LibrarySearchException {
    try {
      IITTrackCollection searchResult = this.itLibrary.search(name, ITPlaylistSearchField.SongNames());
      if (searchResult.getCount() > 1) {
        throw new LibrarySearchException("There are multiple tracks with the specified name \"" + name + "\"");
      } else if (searchResult.getCount() == 0) {
        return null; // no track found
      }
      return new TrackCollectionImpl(this, searchResult).getFirst();
    } catch (ObjectDeletedException e) {
      throw new ITObjectDeletedError(this);
View Full Code Here

  /**
   * {@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

  public static void main(String args[]) {
    try {
      IiTunes iTunes = new iTunesApp();

      IITTrackCollection selectedTracks = iTunes.getSelectedTracks();

      if (selectedTracks == null) {
        System.out.println("No tracks selected!");
      } else {
        IITUserPlaylist newPlaylist = iTunes.createPlaylist(
            "SelectedTracks").getUserPlaylist();

        boolean hasNext = true;
        int i = 1;

        while (hasNext) {
          IITTrack track = selectedTracks.item(i);
          if (track == null) {
            hasNext = false;
          } else {
            System.out.println(track.getName() + " by "
                + track.getArtist() + " added to playlist.");
View Full Code Here

    UserLibraryImpl libraryMock = EasyMock.createMock(UserLibraryImpl.class);
    TrackFactory trackFactoryMock = EasyMock.createMock(TrackFactory.class);
    IITTrack itThrillerMock = EasyMock.createMock(IITTrack.class);
    IITTrack itBeatItMock = EasyMock.createMock(IITTrack.class);
    IITTrack itBillyJeanMock = EasyMock.createMock(IITTrack.class);
    IITTrackCollection itTrackCollectionMock = EasyMock.createMock(IITTrackCollection.class);
    TrackImpl thrillerMock = EasyMock.createMock(TrackImpl.class);
    TrackImpl beatItMock = EasyMock.createMock(TrackImpl.class);
    TrackImpl billyJeanMock = EasyMock.createMock(TrackImpl.class);
   
    EasyMock.expect(libraryMock.isLazy()).andReturn(false).anyTimes();
    EasyMock.expect(libraryMock.getTrackFactory()).andReturn(trackFactoryMock);
   
    EasyMock.expect(trackFactoryMock.getTrack(itThrillerMock)).andReturn(thrillerMock);
    EasyMock.expect(trackFactoryMock.getTrack(itBeatItMock)).andReturn(beatItMock);
    EasyMock.expect(trackFactoryMock.getTrack(itBillyJeanMock)).andReturn(billyJeanMock);
   
    EasyMock.expect(itTrackCollectionMock.itemByPlayOrder(1)).andReturn(itThrillerMock);
    EasyMock.expect(itTrackCollectionMock.itemByPlayOrder(2)).andReturn(itBeatItMock);
    EasyMock.expect(itTrackCollectionMock.itemByPlayOrder(3)).andReturn(itBillyJeanMock);
    EasyMock.expect(itTrackCollectionMock.getCount()).andReturn(3l).times(4);
   
    EasyMock.replay(libraryMock);
    EasyMock.replay(trackFactoryMock);
    EasyMock.replay(itThrillerMock);
    EasyMock.replay(itBeatItMock);
View Full Code Here

TOP

Related Classes of com.jitcaforwin.basic.api.IITTrackCollection

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.