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


C++ Album::setName方法代码示例

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


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

示例1: getAlbumFromFile

Album ParserAlbum::getAlbumFromFile(const QString &_name)
{
    m_pFile->close();
    if(!m_pFile->open(QIODevice::ReadOnly))
    {
        qDebug() << "Can`t open file : " << m_pFile->fileName();
    }
    Album newAlbum;
    newAlbum.setName(_name);
    QDomElement element = m_pDoc->documentElement();
    QDomNode node = element.firstChild();
    while(!node.isNull())
    {
        if(node.isElement())
        {
            QDomElement domElement = node.toElement();
            if(domElement.nodeName() == "images")
            {
                if(domElement.hasChildNodes())
                {
                    getImages(newAlbum,domElement.childNodes());
                }
            }
            if(domElement.nodeName() == "current")
            {
                newAlbum.setCurrentIndex(domElement.text().toInt());
            }
            node = node.nextSibling().toElement();
        }
    } 
    m_pFile->close();
    return newAlbum;
}
开发者ID:KyryloBR,项目名称:PictureSubmarine,代码行数:33,代码来源:parseralbum.cpp

示例2: AlbumItem

void TestAlbum::album_76101()
      {
      Album album;
      album.setName("test");
      album.append(new AlbumItem(root + "/" + DIR + "album_76101-01.mscx"));
      album.append(new AlbumItem(root + "/" + DIR + "album_76101-02.mscx"));
      album.createScore("album_76101.mscx");
      QVERIFY(compareFiles("album_76101.mscx", DIR + "album_76101-ref.mscx"));
      }
开发者ID:19joho66,项目名称:MuseScore,代码行数:9,代码来源:tst_album.cpp

示例3: tmp

vector<string> MusicVideoService::downloadAudio(const string& url) {
  LOG(INFO) << "downloadYouTubeAudio with url " << url;
  vector<string> filepaths;

  boost::filesystem::path tmpPath(SoulSifterSettings::getInstance().get<string>("dir.tmp"));  // todo: use os.tmpdir()
  if (!boost::filesystem::exists(tmpPath)) {
    if (!boost::filesystem::create_directories(tmpPath)) {
      LOG(WARNING) << "Unable to create temporary directory " << tmpPath;
      return filepaths;
    }
  } else if (!boost::filesystem::is_directory(tmpPath)) {
    LOG(WARNING) << "Temporary directory is not a directory " << tmpPath;
    return filepaths;
  }

  FILE *fpipe;
  stringstream command;
  command << "cd " << tmpPath << "; youtube-dl --print-json --write-all-thumbnails --restrict-filenames --extract-audio --audio-format mp3 --audio-quality 0 --quiet " << url;
  if (!(fpipe = (FILE*)popen(command.str().c_str(), "r"))) {
    LOG(WARNING) << "Problem with youtube-dl pipe.";
    return filepaths;
  }

  char buffer[1024];
  stringstream ss;
  LOG(INFO) << "Running command '" << command.str() << "'";
  while (fgets(buffer, sizeof buffer, fpipe)) {
    ss << buffer;
  }

  pclose(fpipe);

  // read output
  string json;
  while (std::getline(ss, json, '\n')) {
    if (json.at(0) == '{') {
      boost::property_tree::ptree ptree;
      std::stringstream tmp(json);
      read_json(tmp, ptree);

      Song* song = new Song();
      Album* album = new Album();
      song->setAlbum(album);

      string baseFileName = ptree.get<string>("_filename").substr(0, ptree.get<string>("_filename").size() - ptree.get<string>("ext").size());
      song->setFilepath(SoulSifterSettings::getInstance().get<string>("dir.tmp") + '/' + baseFileName + "mp3");
      album->setCoverFilepath(SoulSifterSettings::getInstance().get<string>("dir.tmp") + '/' + baseFileName + "jpg");
      string title = ptree.get<string>("title");
      if (!MusicManager::getInstance().splitArtistAndTitle(title, song)) {
        song->setArtist(ptree.get<string>("uploader"));
        song->setTitle(title);
      }
      MusicManager::getInstance().moveFeaturing(song);
      MusicManager::getInstance().copyRemixer(song);
      song->setLowQuality(true);
      song->setCurator(ptree.get<string>("uploader"));
      string date = ptree.get<string>("upload_date", "00000000");
      if (!date.empty() && !!date.compare("null")) {
        album->setReleaseDateYear(std::stoi(date.substr(0, 4)));
        album->setReleaseDateMonth(std::stoi(date.substr(4, 2)));
        album->setReleaseDateDay(std::stoi(date.substr(6, 4)));
      }
      album->setArtist(song->getArtist());
      album->setName(song->getTitle());

      TagService::writeId3v2Tag(song);
      filepaths.push_back(song->getFilepath());
      filepaths.push_back(album->getCoverFilepath());
      delete song;
      return filepaths;
    }
  }
  return filepaths;
}
开发者ID:broken,项目名称:soulsifter,代码行数:74,代码来源:MusicVideoService.cpp


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