void OpmlDirectoryInfoParser::getInfo( TrackPtr track ) { DEBUG_BLOCK showLoading( i18n( "Loading Podcast Info..." ) ); OpmlDirectoryFeed * feed = dynamic_cast<OpmlDirectoryFeed *>( track.data() ); if ( !feed ) return; debug() << "OpmlDirectoryInfoParser: getInfo about feed: " << feed->uidUrl(); m_rssDownloadJob = KIO::storedGet( feed->uidUrl(), KIO::Reload, KIO::HideProgressInfo ); The::statusBar()->newProgressOperation( m_rssDownloadJob, i18n( "Fetching Podcast Info" ) ); connect( m_rssDownloadJob, SIGNAL(result(KJob *)), SLOT( rssDownloadComplete( KJob*) ) ); }
void JamendoInfoParser::getInfo(TrackPtr track) { DEBUG_BLOCK JamendoTrack * jamendoTrack = dynamic_cast<JamendoTrack *> ( track.data() ); if ( jamendoTrack == 0) return; QString infoHtml = "<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" " "CONTENT=\"text/html; charset=utf-8\"></HEAD><BODY>"; infoHtml += "<div align=\"center\">"; infoHtml += i18n( "Track" ) + "<br><br>"; infoHtml += "<strong>"; infoHtml += jamendoTrack->prettyName(); infoHtml += "</strong><br><br><em>"; infoHtml += "<br><br>" + i18n( "From Jamendo.com" ) + "</div>"; infoHtml += "</BODY></HTML>"; emit( info( infoHtml ) ); }
TrackPtr ServiceSqlRegistry::getTrack( const QStringList &rowData ) { //test if rowData is the correct length int correctLength = m_metaFactory->getTrackSqlRowCount() + m_metaFactory->getAlbumSqlRowCount() + m_metaFactory->getArtistSqlRowCount() + m_metaFactory->getGenreSqlRowCount(); if ( rowData.size() != correctLength ) return Meta::TrackPtr(); int id = rowData[0].toInt(); QMutexLocker locker( &m_trackMutex ); if( m_trackMap.contains( id ) ) { return m_trackMap.value( id ); } else { int index = 0; TrackPtr trackPtr = m_metaFactory->createTrack( rowData.mid(index, m_metaFactory->getTrackSqlRowCount() ) ); index += m_metaFactory->getTrackSqlRowCount(); ServiceTrack * track = static_cast<ServiceTrack *> ( trackPtr.data() ); AlbumPtr albumPtr; if ( m_albumMap.contains( track->albumId() ) ) albumPtr = m_albumMap.value( track->albumId() ); else albumPtr = getAlbum( rowData.mid( index, rowData.count() -1 ) ); index += m_metaFactory->getAlbumSqlRowCount(); ServiceAlbum * album = static_cast<ServiceAlbum *> ( albumPtr.data() ); album->addTrack( trackPtr ); track->setAlbumPtr( albumPtr ); m_albumMap.insert( track->albumId(), albumPtr ); ArtistPtr artistPtr; if ( m_artistMap.contains( track->artistId() ) ) artistPtr = m_artistMap.value( track->artistId() ); else { QStringList subRows = rowData.mid(index, m_metaFactory->getArtistSqlRowCount() ); artistPtr = m_metaFactory->createArtist( subRows ); } index += m_metaFactory->getArtistSqlRowCount(); ServiceArtist * artist = static_cast<ServiceArtist *> ( artistPtr.data() ); artist->addTrack( trackPtr ); track->setArtist( artistPtr ); m_artistMap.insert( track->artistId(), artistPtr ); GenrePtr genrePtr; int genreId = rowData[index].toInt(); if( m_genreMap.contains( genreId ) ) genrePtr = m_genreMap.value( genreId ); else genrePtr = m_metaFactory->createGenre( rowData.mid(index, m_metaFactory->getGenreSqlRowCount() ) ); ServiceGenre * genre = dynamic_cast<ServiceGenre *> ( genrePtr.data() ); Q_ASSERT( genre ); if( genre ) genre->addTrack( trackPtr ); track->setGenre( genrePtr ); m_genreMap.insert( genreId, genrePtr ); m_trackMap.insert( id, trackPtr ); return trackPtr; } }
void ScriptableServiceInfoParser::getInfo(TrackPtr track) { DEBUG_BLOCK ScriptableServiceTrack * serviceTrack = dynamic_cast< ScriptableServiceTrack * >( track.data() ); if (serviceTrack == 0) return; emit( info( serviceTrack->description() ) ); if ( serviceTrack->description().isEmpty() ) { showLoading( i18n( "Loading info..." ) ); ScriptManager::instance()->ServiceScriptRequestInfo( m_serviceName, serviceTrack->level(), serviceTrack->callbackString() ); } }