当前位置: 首页>>代码示例>>C++>>正文


C++ SongList类代码示例

本文整理汇总了C++中SongList的典型用法代码示例。如果您正苦于以下问题:C++ SongList类的具体用法?C++ SongList怎么用?C++ SongList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SongList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CopyToDevice

void PodcastService::CopyToDevice(const QModelIndexList& episode_indexes,
                                  const QModelIndexList& podcast_indexes) {
  PodcastEpisode episode_tmp;
  SongList songs;
  PodcastEpisodeList episodes;
  Podcast podcast;
  for (const QModelIndex& index : episode_indexes) {
    episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
    if (episode_tmp.downloaded()) episodes << episode_tmp;
  }

  for (const QModelIndex& podcast : podcast_indexes) {
    for (int i = 0; i < podcast.model()->rowCount(podcast); ++i) {
      const QModelIndex& index = podcast.child(i, 0);
      episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
      if (episode_tmp.downloaded() && !episode_tmp.listened())
        episodes << episode_tmp;
    }
  }
  for (const PodcastEpisode& episode : episodes) {
    podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
    songs.append(episode.ToSong(podcast));
  }

  organise_dialog_->SetDestinationModel(
      app_->device_manager()->connected_devices_model(), true);
  organise_dialog_->SetCopy(true);
  if (organise_dialog_->SetSongs(songs)) organise_dialog_->show();
}
开发者ID:Gu1,项目名称:Clementine,代码行数:29,代码来源:podcastservice.cpp

示例2: qLog

void SpotifyResolver::SearchFinished(const spotify_pb::SearchResponse& response) {
  QString query_string = QString::fromUtf8(response.request().query().c_str());
  qLog(Debug) << query_string;
  QMap<QString, int>::iterator it = queries_.find(query_string);
  if (it == queries_.end()) {
    return;
  }

  int id = it.value();
  queries_.erase(it);

  SongList songs;
  for (int i = 0; i < response.result_size(); ++i) {
    const spotify_pb::Track& track = response.result(i);
    Song song;
    SpotifyService::SongFromProtobuf(track, &song);
    songs << song;
  }
  qLog(Debug) << "Resolved from spotify:" << songs.length();
  if (!songs.isEmpty()) {
    qLog(Debug) << songs[0].title() << songs[0].artist();
  }

  emit ResolveFinished(id, songs);
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:25,代码来源:spotifyresolver.cpp

示例3: PreloadFinished

void SongLoaderInserter::AsyncLoad() {

  // First, quick load raw songs.
  int async_progress = 0;
  int async_load_id = task_manager_->StartTask(tr("Loading tracks"));
  task_manager_->SetTaskProgress(async_load_id, async_progress,
                                 pending_.count());
  for (SongLoader* loader : pending_) {
    loader->LoadFilenamesBlocking();
    task_manager_->SetTaskProgress(async_load_id, ++async_progress);
    songs_ << loader->songs();
  }
  task_manager_->SetTaskFinished(async_load_id);
  emit PreloadFinished();

  // Songs are inserted in playlist, now load them completely.
  async_progress = 0;
  async_load_id = task_manager_->StartTask(tr("Loading tracks info"));
  task_manager_->SetTaskProgress(async_load_id, async_progress, songs_.count());
  SongList songs;
  for (SongLoader* loader : pending_) {
    loader->LoadMetadataBlocking();
    songs << loader->songs();
    task_manager_->SetTaskProgress(async_load_id, songs.count());
  }
  task_manager_->SetTaskFinished(async_load_id);

  // Replace the partially-loaded items by the new ones, fully loaded.
  emit EffectiveLoadFinished(songs);

  deleteLater();
}
开发者ID:RaoulChartreuse,项目名称:Clementine,代码行数:32,代码来源:songloaderinserter.cpp

示例4: QLatin1String

void PlaylistTest::testStatic2()
{
    DynamicPlaylist::PlaylistParams p;
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "tallest man on earth" ) ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "bon iver" ) ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "mumford and sons" ) ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Artist, QLatin1String( "Florence + The Machine" ) ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::ArtistMaxFamiliarity, 0.4 ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::MinDanceability, 0.7 ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistType ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::SongInformation, QVariant::fromValue( Echonest::SongInformation( Echonest::SongInformation::Hotttnesss | Echonest::SongInformation::ArtistHotttnesss | Echonest::SongInformation::ArtistFamiliarity ) ) ) );
    p.append( DynamicPlaylist::PlaylistParamData( DynamicPlaylist::Results, 4 ) );

    QNetworkReply* reply = DynamicPlaylist::staticPlaylist( p );

    qDebug() << reply->url().toEncoded();
    QCOMPARE( QLatin1String( reply->url().toEncoded() ), QLatin1String( "http://developer.echonest.com/api/v4/playlist/static?api_key=JGJCRKWLXLBZIFAZB&format=xml&artist=tallest+man+on+earth&artist=bon+iver&artist=mumford+and+sons&artist=Florence+%2B+The+Machine&artist_max_familiarity=0.4&min_danceability=0.7&type=artist&bucket=song_hotttnesss&bucket=artist_hotttnesss&bucket=artist_familiarity&results=4" ) );

    QEventLoop loop;
    loop.connect( reply, SIGNAL(finished()), SLOT(quit()) );
    loop.exec();
    SongList songs = DynamicPlaylist::parseStaticPlaylist( reply );

//     qDebug() << "Got songs;" << songs;
    QVERIFY( songs.size() > 1 );
    Q_FOREACH( const Song& song, songs ) {
        QVERIFY( !song.id().isEmpty() );
    }
开发者ID:xhochy,项目名称:libechonest,代码行数:28,代码来源:PlaylistTest.cpp

示例5: SongList

void SongList::AddDirectory(Directory Dir, bool VSRGActive, bool DotcurActive)
{
	SongList* NewList = new SongList(this);

	ListEntry NewEntry;

	NewEntry.EntryName = Dir.path().substr(Dir.path().find_last_of('/')+1);
	NewEntry.Kind = ListEntry::Directory;
	NewEntry.Data = NewList;

	std::vector<VSRG::Song*> Songs7K;
	std::vector<dotcur::Song*> SongsDC;
	std::vector<String> Listing;

	Dir.ListDirectory(Listing, Directory::FS_DIR);
	
	for (std::vector<String>::iterator i = Listing.begin();
		i != Listing.end();
		i++)
	{
		if (VSRGActive)
			LoadSong7KFromDir(Dir / *i, Songs7K);
		
		if (DotcurActive)
			LoadSongDCFromDir(Dir / *i, SongsDC);

		if (!SongsDC.size() && !Songs7K.size())
			NewList->AddDirectory(Dir / *i, VSRGActive, DotcurActive);

		if (Songs7K.size())
		{
			for (std::vector<VSRG::Song*>::iterator j = Songs7K.begin();
				j != Songs7K.end();
				j++)
			{
				NewList->AddSong(*j);
			}

			Songs7K.clear();
		}

		if (SongsDC.size())
		{
			for (std::vector<dotcur::Song*>::iterator j = SongsDC.begin();
				j != SongsDC.end();
				j++)
			{
				NewList->AddSong(*j);
			}

			SongsDC.clear();
		}
	}

	if (NewList->GetNumEntries())
		mChildren.push_back(NewEntry);
	else
		delete NewList;
}
开发者ID:NuclearFej,项目名称:raindrop,代码行数:59,代码来源:SongList.cpp

示例6: GetSongsInAlbums

SongMimeData* AlbumCoverManager::GetMimeDataForAlbums(
    const QModelIndexList& indexes) const {
  SongList songs = GetSongsInAlbums(indexes);
  if (songs.isEmpty()) return nullptr;

  SongMimeData* data = new SongMimeData;
  data->backend = library_backend_;
  data->songs = songs;
  return data;
}
开发者ID:Aceler,项目名称:Clementine,代码行数:10,代码来源:albumcovermanager.cpp

示例7: LoadSongList

size_t LoadSongList( SongList &songs )
{
    size_t count = 0;

    FILE *fp = fopen( "musicdb.txt", "rt" );

    if (!fp) return 0;

    string artist;
    string fullpath;
    string title;
    char line[6144], *ch;

    while (!feof(fp))
    {
        fgets( line, 6144, fp );
        cleanString( line );

        ch = strtok( line, "\t" );
        if (ch) artist = ch;
        else continue;

        ch = strtok( NULL, "\t" );
        if (ch) title = ch;
        else continue;

        ch = strtok( NULL, "\t" );
        if (ch) fullpath = ch;
        else continue;

        printf ("Artist: %s\nTitle: %s\nFullPath: %s\n",
                artist.c_str(),
                title.c_str(),
                fullpath.c_str() + 60 );
        count++;

        SongList::iterator sli;
        sli = songs.find( artist );
        if (sli == songs.end())
        {
            songs[artist] = std::vector<Song>();
            sli = songs.find( artist );

            assert( sli != songs.end() );
        }

        Song s;
        s.filename = fullpath;
        s.title = title;
        (*sli).second.push_back( s );
    }
    fclose(fp);

    return count;
}
开发者ID:mikicompany,项目名称:ld48jovoc,代码行数:55,代码来源:musicdb.cpp

示例8: SendAlbum

void SongSender::SendAlbum(const Song& song) {
  // No streams!
  if (song.url().scheme() != "file") return;

  SongList album = app_->library_backend()->GetSongsByAlbum(song.album());

  for (Song s : album) {
    DownloadItem item(s, album.indexOf(s) + 1, album.size());
    download_queue_.append(item);
  }
}
开发者ID:Korvox,项目名称:Clementine,代码行数:11,代码来源:songsender.cpp

示例9: TEST_F

TEST_F(AsxIniParserTest, ParsesBasicTrackList) {
  QFile file(":/testdata/test.asxini");
  file.open(QIODevice::ReadOnly);

  SongList songs = parser_.Load(&file, "", QDir());
  ASSERT_EQ(2, songs.length());
  EXPECT_EQ(QUrl("http://195.245.168.21/antena3?MSWMExt=.asf"), songs[0].url());
  EXPECT_EQ(QUrl("http://195.245.168.21:80/antena3?MSWMExt=.asf"), songs[1].url());
  EXPECT_TRUE(songs[0].is_valid());
  EXPECT_TRUE(songs[1].is_valid());
}
开发者ID:GitAnt,项目名称:Clementine,代码行数:11,代码来源:asxiniparser_test.cpp

示例10: FilterCurrentWMASong

SongList Library::FilterCurrentWMASong(SongList songs, Song* queued) {
  for (SongList::iterator it = songs.begin(); it != songs.end();) {
    if (it->url() == current_wma_song_url_) {
      *queued = *it;
      it = songs.erase(it);
    } else {
      ++it;
    }
  }
  return songs;
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:11,代码来源:library.cpp

示例11: TEST_F

TEST_F(ASXParserTest, ParsesSomaFM) {
  QFile somafm(":/testdata/secretagent.asx");
  somafm.open(QIODevice::ReadOnly);

  ASXParser parser(NULL);
  SongList songs = parser.Load(&somafm);

  ASSERT_EQ(4, songs.count());
  EXPECT_EQ("SomaFM: Secret Agent", songs[0].title());
  EXPECT_EQ("Keep us on the air! Click Support SomaFM above!", songs[0].artist());
  EXPECT_EQ(QUrl("http://streamer-ntc-aa03.somafm.com:80/stream/1021"), songs[0].url());
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:12,代码来源:asxparser_test.cpp

示例12: disconnect

void JamendoService::ParseDirectory(QIODevice* device) const {
  int total_count = 0;

  // Bit of a hack: don't update the model while we're parsing the xml
  disconnect(library_backend_, SIGNAL(SongsDiscovered(SongList)),
             library_model_, SLOT(SongsDiscovered(SongList)));
  disconnect(library_backend_, SIGNAL(TotalSongCountUpdated(int)), this,
             SLOT(UpdateTotalSongCount(int)));

  // Delete the database and recreate it.  This is faster than dropping tables
  // or removing rows.
  library_backend_->db()->RecreateAttachedDb("jamendo");

  TrackIdList track_ids;
  SongList songs;
  QXmlStreamReader reader(device);
  while (!reader.atEnd()) {
    reader.readNext();
    if (reader.tokenType() == QXmlStreamReader::StartElement &&
        reader.name() == "artist") {
      songs << ReadArtist(&reader, &track_ids);
    }

    if (songs.count() >= kBatchSize) {
      // Add the songs to the database in batches
      library_backend_->AddOrUpdateSongs(songs);
      InsertTrackIds(track_ids);

      total_count += songs.count();
      songs.clear();
      track_ids.clear();

      // Update progress info
      app_->task_manager()->SetTaskProgress(load_database_task_id_, total_count,
                                            kApproxDatabaseSize);
    }
  }

  library_backend_->AddOrUpdateSongs(songs);
  InsertTrackIds(track_ids);

  connect(library_backend_, SIGNAL(SongsDiscovered(SongList)), library_model_,
          SLOT(SongsDiscovered(SongList)));
  connect(library_backend_, SIGNAL(TotalSongCountUpdated(int)),
          SLOT(UpdateTotalSongCount(int)));

  library_backend_->UpdateTotalSongCount();
}
开发者ID:Gu1,项目名称:Clementine,代码行数:48,代码来源:jamendoservice.cpp

示例13: Save

void WplParser::Save(const SongList& songs, QIODevice* device, const QDir& dir,
                     Playlist::Path path_type) const {
  QXmlStreamWriter writer(device);
  writer.setAutoFormatting(true);
  writer.setAutoFormattingIndent(2);
  writer.writeProcessingInstruction("wpl", "version=\"1.0\"");

  StreamElement smil("smil", &writer);

  {
    StreamElement head("head", &writer);
    WriteMeta("Generator", "Clementine -- " CLEMENTINE_VERSION_DISPLAY,
              &writer);
    WriteMeta("ItemCount", QString::number(songs.count()), &writer);
  }

  {
    StreamElement body("body", &writer);
    {
      StreamElement seq("seq", &writer);
      for (const Song& song : songs) {
        writer.writeStartElement("media");
        writer.writeAttribute("src", URLOrFilename(song.url(), dir, path_type));
        writer.writeEndElement();
      }
    }
  }
}
开发者ID:Aceler,项目名称:Clementine,代码行数:28,代码来源:wplparser.cpp

示例14: WriteAllSongsStatisticsToFiles

void Library::WriteAllSongsStatisticsToFiles() {
  const SongList all_songs = backend_->GetAllSongs();

  const int task_id = app_->task_manager()->StartTask(
      tr("Saving songs statistics into songs files"));
  app_->task_manager()->SetTaskBlocksLibraryScans(task_id);

  const int nb_songs = all_songs.size();
  int i = 0;
  for (const Song& song : all_songs) {
    TagReaderClient::Instance()->UpdateSongStatisticsBlocking(song);
    TagReaderClient::Instance()->UpdateSongRatingBlocking(song);
    app_->task_manager()->SetTaskProgress(task_id, ++i, nb_songs);
  }
  app_->task_manager()->SetTaskFinished(task_id);
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:16,代码来源:library.cpp

示例15: Transcoder

Organise::Organise(TaskManager* task_manager,
                   boost::shared_ptr<MusicStorage> destination,
                   const OrganiseFormat &format, bool copy, bool overwrite,
                   const SongList& songs, bool eject_after)
                     : thread_(NULL),
                       task_manager_(task_manager),
                       transcoder_(new Transcoder(this)),
                       destination_(destination),
                       format_(format),
                       copy_(copy),
                       overwrite_(overwrite),
                       eject_after_(eject_after),
                       task_count_(songs.count()),
                       transcode_suffix_(1),
                       tasks_complete_(0),
                       started_(false),
                       task_id_(0),
                       current_copy_progress_(0)
{
  original_thread_ = thread();

  for (const Song& song : songs) {
    tasks_pending_ << Task(song);
  }
}
开发者ID:BrummbQ,项目名称:Clementine,代码行数:25,代码来源:organise.cpp


注:本文中的SongList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。