Example1 - listtrackstest.cpp

listing of tests/listtrackstest.cpp
/***************************************************************************
 *   Copyright (C) 2006 by Michael Schulze   *
 *   mike.s@genion.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "listtrackstest.h"
#include "ipod.h"

using namespace itunesdb;

int ListTracksTest::run( QStringList arguments ) {
    IPod * ipod = findFirstIPod();
    if ( !ipod ) {
        return -1;
    }

    ITunesDB & itunesdb = ipod->getITunesDB();
    TrackPtrList allTracks;
    itunesdb.getAllTracks( allTracks );
    allTracks.setComparator( TrackComparators::BY_ARTIST );
    allTracks.sort();

    // TrackPtrList::Iterator iter = allTracks.iterator();
    ITunesDB::TrackConstIterator iter = itunesdb.getAllTracks();
    while( iter.hasNext() ) {
        ITunesDBTrack * track = iter.next();
        printf( "%s\t%s\t%s\t%s\n", track->getArtist().ascii(), track->getAlbum().ascii(), track->getTitle().ascii(), itunesdb.getFileForPathInfo( track->getPathInfo() ).ascii() );
    }

    printf("closing ipod instance\n");
    ipod->close();
    delete ipod;

    return 0;
}


QString ListTracksTest::getName() {
    return "listtracks";
}


Generated on Wed Nov 28 02:27:44 2007 for libqtpod by  doxygen 1.5.0