本文整理汇总了C++中MusicMetadata::setFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ MusicMetadata::setFilename方法的具体用法?C++ MusicMetadata::setFilename怎么用?C++ MusicMetadata::setFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MusicMetadata
的用法示例。
在下文中一共展示了MusicMetadata::setFilename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
//.........这里部分代码省略.........
m_parent,
new RipStatusEvent(RipStatusEvent::kTrackPercentEvent, 0));
// do we need to start a new file?
if (m_tracks->at(trackno)->active)
{
titleTrack = track;
titleTrack->setLength(m_tracks->at(trackno)->length);
if (m_quality < 3)
{
if (encodertype == "mp3")
{
outfile = QString("track%1.mp3").arg(trackno);
encoder.reset(new LameEncoder(saveDir + outfile, m_quality,
titleTrack, mp3usevbr));
}
else // ogg
{
outfile = QString("track%1.ogg").arg(trackno);
encoder.reset(new VorbisEncoder(saveDir + outfile, m_quality,
titleTrack));
}
}
else
{
outfile = QString("track%1.flac").arg(trackno);
encoder.reset(new FlacEncoder(saveDir + outfile, m_quality,
titleTrack));
}
if (!encoder->isValid())
{
QApplication::postEvent(
m_parent,
new RipStatusEvent(
RipStatusEvent::kEncoderErrorEvent,
"Encoder failed to open file for writing"));
LOG(VB_GENERAL, LOG_ERR, "MythMusic: Encoder failed"
" to open file for writing");
RunEpilog();
return;
}
}
if (!encoder.get())
{
// This should never happen.
QApplication::postEvent(
m_parent,
new RipStatusEvent(RipStatusEvent::kEncoderErrorEvent,
"Failed to create encoder"));
LOG(VB_GENERAL, LOG_ERR, "MythMusic: No encoder, failing");
RunEpilog();
return;
}
ripTrack(m_CDdevice, encoder.get(), trackno + 1);
if (isCancelled())
{
RunEpilog();
return;
}
if (m_tracks->at(trackno)->active)
{
QString ext = QFileInfo(outfile).suffix();
QString destFile = filenameFromMetadata(titleTrack) + '.' + ext;
QUrl url(m_musicStorageDir);
// save the metadata to the DB
titleTrack->setFilename(destFile);
titleTrack->setHostname(url.host());
titleTrack->setFileSize((quint64)QFileInfo(outfile).size());
titleTrack->dumpToDatabase();
// this will delete the encoder which will write the metadata in it's dtor
encoder.reset();
// copy track to the BE
destFile = gCoreContext->GenMythURL(url.host(), 0, destFile, "Music");
QApplication::postEvent(m_parent, new RipStatusEvent(RipStatusEvent::kCopyStartEvent, 0));
RemoteFile::CopyFile(saveDir + outfile, destFile, true);
QApplication::postEvent(m_parent, new RipStatusEvent(RipStatusEvent::kCopyEndEvent, 0));
}
}
}
QString PostRipCDScript = gCoreContext->GetSetting("PostCDRipScript");
if (!PostRipCDScript.isEmpty())
myth_system(PostRipCDScript);
QApplication::postEvent(
m_parent, new RipStatusEvent(RipStatusEvent::kFinishedEvent, ""));
RunEpilog();
}