|
|
debug() << "Parent id : " << parent_id << endl; | debug() << "Parent id : " << parent_id << endl; |
| |
m_critical_mutex.lock(); | m_critical_mutex.lock(); |
debug() << "Sending track... " << bundle.url().path().utf8() << endl; |
debug() << "Sending track... " << bundle.url().path().latin1() << endl; |
int ret = LIBMTP_Send_Track_From_File( | int ret = LIBMTP_Send_Track_From_File( |
m_device, bundle.url().path().utf8(), trackmeta, |
m_device, bundle.url().path().latin1(), trackmeta, |
#ifdef LIBMTP_CALLBACKS |
progressCallback, this, parent_id |
progressCallback, this, parent_id // callbacks only in libmtp >= 0.0.15 |
|
#else |
|
0, 0, parent_id |
|
#endif |
|
); | ); |
m_critical_mutex.unlock(); | m_critical_mutex.unlock(); |
| |
|
|
while( playlists != 0 ) | while( playlists != 0 ) |
{ | { |
MtpMediaItem *playlist = new MtpMediaItem( m_playlistItem, this ); | MtpMediaItem *playlist = new MtpMediaItem( m_playlistItem, this ); |
playlist->setText( 0, playlists->name ); |
playlist->setText( 0, QString::fromUtf8( playlists->name ) ); |
playlist->setType( MediaItem::PLAYLIST ); | playlist->setType( MediaItem::PLAYLIST ); |
playlist->setPlaylist( new MtpPlaylist() ); | playlist->setPlaylist( new MtpPlaylist() ); |
playlist->playlist()->setId( playlists->playlist_id ); | playlist->playlist()->setId( playlists->playlist_id ); |
|
|
MetaBundle *bundle = new MetaBundle(); | MetaBundle *bundle = new MetaBundle(); |
| |
if( track->genre != 0 ) | if( track->genre != 0 ) |
bundle->setGenre( AtomicString( qstrdup( track->genre ) ) ); |
bundle->setGenre( AtomicString( QString::fromUtf8( track->genre ) ) ); |
if( track->artist != 0 ) | if( track->artist != 0 ) |
bundle->setArtist( AtomicString( qstrdup( track->artist ) ) ); |
bundle->setArtist( AtomicString( QString::fromUtf8( track->artist ) ) ); |
if( track->album != 0 ) | if( track->album != 0 ) |
bundle->setAlbum( AtomicString( qstrdup( track->album ) ) ); |
bundle->setAlbum( AtomicString( QString::fromUtf8( track->album ) ) ); |
if( track->title != 0 ) | if( track->title != 0 ) |
bundle->setTitle( AtomicString( qstrdup( track->title ) ) ); |
bundle->setTitle( AtomicString( QString::fromUtf8( track->title ) ) ); |
if( track->filename != 0 ) | if( track->filename != 0 ) |
bundle->setPath( AtomicString( qstrdup( track->filename ) ) ); |
bundle->setPath( AtomicString( QString::fromUtf8( track->filename ) ) ); |
| |
// translate codecs to file types | // translate codecs to file types |
if( track->filetype == LIBMTP_FILETYPE_MP3 ) | if( track->filetype == LIBMTP_FILETYPE_MP3 ) |
|
|
bundle->setFileType( MetaBundle::other ); | bundle->setFileType( MetaBundle::other ); |
| |
if( track->date != 0 ) | if( track->date != 0 ) |
bundle->setYear( QString( qstrdup( track->date ) ).mid( 0, 4 ).toUInt() ); |
bundle->setYear( QString( QString::fromUtf8( track->date ) ).mid( 0, 4 ).toUInt() ); |
if( track->tracknumber > 0 ) | if( track->tracknumber > 0 ) |
bundle->setTrack( track->tracknumber ); | bundle->setTrack( track->tracknumber ); |
if( track->duration > 0 ) | if( track->duration > 0 ) |