1
/***************************************************************************
2
* Copyright (C) 2005 - 2007 by *
3
* Christian Muehlhaeuser, Last.fm Ltd <chris@last.fm> *
4
* Erik Jaelevik, Last.fm Ltd <erik@last.fm> *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA. *
20
***************************************************************************/
22
#include "gpoddevice.h"
23
#include <containerutils.h>
27
GPodDevice::GPodDevice()
30
gLogger.Init( savePath( "gpod.log" ), false );
31
gLogger.SetLevel( 4 );
33
LOGL( 3, "Initialising GPod" );
37
LOGL( 3, "Could not find iPod" );
39
itdb_set_mountpoint( m_itdb, QFile::encodeName( "/home/muesli/last.fm/client/Audioscrobbler/ipodData.new" ) );
40
Itdb_Playlist *mpl = itdb_playlist_new( "iPod", false );
41
itdb_playlist_set_mpl( mpl );
44
m_itdb = itdb_parse( QFile::encodeName( "/home/muesli/last.fm/client/Audioscrobbler/ipodData.new" ), &err );
66
for ( cur = m_itdb->tracks; cur; cur = cur->next )
68
Itdb_Track *track = (Itdb_Track *)cur->data;
72
dt.setTime_t( itdb_time_mac_to_host( track->time_played ) );
75
t.setArtist( track->artist );
76
t.setAlbum( track->album );
77
t.setTrack( track->title );
78
t.setPath( track->ipod_path );
79
t.setTimeStamp( dt.toString( "yyyy-MM-dd hh:mm:ss" ) );
80
t.setDuration( track->tracklen / 1000 );
81
t.setPlayCount( track->playcount );
83
if ( dt.toString() != "Thu Jan 1 01:00:00 1970" )
90
Q_EXPORT_PLUGIN2( mediadevice, GPodDevice )