本文整理汇总了C++中Metadata::Genre方法的典型用法代码示例。如果您正苦于以下问题:C++ Metadata::Genre方法的具体用法?C++ Metadata::Genre怎么用?C++ Metadata::Genre使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metadata
的用法示例。
在下文中一共展示了Metadata::Genre方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveDefaults
void ImportMusicDialog::saveDefaults(void)
{
Metadata *data = m_tracks->at(m_currentTrack)->metadata;
m_defaultCompilation = data->Compilation();
m_defaultCompArtist = data->CompilationArtist();
m_defaultArtist = data->Artist();
m_defaultAlbum = data->Album();
m_defaultGenre = data->Genre();
m_defaultYear = data->Year();
m_defaultRating = data->Rating();
m_haveDefaults = true;
}
示例2: fillWidgets
void ImportMusicDialog::fillWidgets()
{
if (m_tracks->size() > 0)
{
// update current
m_currentText->SetText(QString("%1 of %2")
.arg(m_currentTrack + 1).arg(m_tracks->size()));
Metadata *meta = m_tracks->at(m_currentTrack)->metadata;
m_filenameText->SetText(meta->Filename());
m_compilationCheck->SetCheckState(meta->Compilation());
m_compartistText->SetText(meta->CompilationArtist());
m_artistText->SetText(meta->Artist());
m_albumText->SetText(meta->Album());
m_titleText->SetText(meta->Title());
m_genreText->SetText(meta->Genre());
m_yearText->SetText(QString::number(meta->Year()));
m_trackText->SetText(QString::number(meta->Track()));
if (m_tracks->at(m_currentTrack)->isNewTune)
{
m_coverartButton->SetVisible(false);
m_statusText->SetText(tr("New File"));
}
else
{
m_coverartButton->SetVisible(true);
m_statusText->SetText(tr("Already in Database"));
}
}
else
{
// update current
m_currentText->SetText(tr("Not found"));
m_filenameText->Reset();
m_compilationCheck->SetCheckState(false);
m_compartistText->Reset();
m_artistText->Reset();
m_albumText->Reset();
m_titleText->Reset();
m_genreText->Reset();
m_yearText->Reset();
m_trackText->Reset();
m_statusText->Reset();
m_coverartButton->SetVisible(false);
}
}
示例3: updateStreams
void SearchStream::updateStreams(void)
{
m_streamList->Reset();
QString station = m_stationList->GetValue();
QString genre = m_genreList->GetValue();
QString channel = m_channelEdit->GetText();
bool searchStation = (station != tr("<All Stations>"));
bool searchGenre = (genre != tr("<All Genres>"));
bool searchChannel = !channel.isEmpty();
QMap<QString, Metadata>::iterator it;
for (it = m_streams.begin(); it != m_streams.end(); ++it)
{
Metadata *mdata = &(*it);
if (searchStation && station != mdata->Station())
continue;
if (searchGenre && !mdata->Genre().contains(genre, Qt::CaseInsensitive))
continue;
if (searchChannel && !mdata->Channel().contains(channel, Qt::CaseInsensitive))
continue;
// if we got here we must have a match so add it to the list
MythUIButtonListItem *item = new MythUIButtonListItem(m_streamList,
"", qVariantFromValue(mdata));
MetadataMap metadataMap;
mdata->toMap(metadataMap);
item->SetTextFromMap(metadataMap);
item->SetText(" ", "dummy");
}
m_matchesText->SetText(QString("%1").arg(m_streamList->GetCount()));
}
示例4: entered
void DatabaseBox::entered(UIListTreeType *treetype, UIListGenericTree *item)
{
if (!item || !treetype)
return;
// Determin if this is a CD entry
bool cd = false;
if (dynamic_cast<CDCheckItem*>(item))
cd = true;
TreeCheckItem *item_ptr = dynamic_cast<TreeCheckItem*>(item);
if (item_ptr
&& item->childCount() == 0
&& item_ptr->getLevel() == "title")
{
int id = item_ptr->getID();
Metadata *mdata;
if (!cd)
{
mdata = gMusicData->all_music->getMetadata(id);
if (!mdata)
return;
}
else
{
// Need to allocate storage for CD Metadata
mdata = new Metadata;
if (!gMusicData->all_music->getCDMetadata(id, mdata))
{
delete mdata;
return;
}
}
unsigned int line = 0;
QString tmpstr;
if (mdata->Compilation())
{
tmpstr = tr("Compilation Artist:\t") + mdata->CompilationArtist();
if (m_lines.at(line))
m_lines.at(line++)->SetText(tmpstr);
}
tmpstr = tr("Artist:\t") + mdata->Artist();
if (m_lines.at(line))
m_lines.at(line++)->SetText(tmpstr);
tmpstr = tr("Album:\t") + mdata->Album();
if (m_lines.at(line))
m_lines.at(line++)->SetText(tmpstr);
tmpstr = tr("Title:\t") + mdata->Title();
if (m_lines.at(line))
m_lines.at(line++)->SetText(tmpstr);
if (m_lines.at(line))
{
int maxTime = mdata->Length() / 1000;
int maxh = maxTime / 3600;
int maxm = (maxTime / 60) % 60;
int maxs = maxTime % 60;
QString timeStr;
if (maxh > 0)
timeStr.sprintf("%02d:%02d:%02d", maxh, maxm, maxs);
else
timeStr.sprintf("%02d:%02d", maxm, maxs);
tmpstr = tr("Length:\t") + timeStr;
m_lines.at(line++)->SetText(tmpstr);
}
tmpstr = tr("Genre: ") + mdata->Genre();
if (m_lines.at(line))
{
m_lines.at(line)->SetText(tmpstr);
}
else
{
QString prevvalue = m_lines.at(line-1)->GetText();
tmpstr = prevvalue + " " + tmpstr;
m_lines.at(line-1)->SetText(tmpstr);
}
// Pre increment as not incremented from previous use.
while (++line < (unsigned) m_lines.size())
m_lines.at(line)->SetText("");
// Don't forget to delete the mdata storage if we allocated it.
if (cd)
delete mdata;
return;
}
//.........这里部分代码省略.........
示例5: loadStreams
void SearchStream::loadStreams(void)
{
m_streams.clear();
m_stations.clear();
m_genres.clear();
m_stations.append(tr("<All Stations>"));
m_genres.append(tr("<All Genres>"));
QString filename = QString("%1%2").arg(GetShareDir()).arg("mythmusic/streams.xml");
QFile xmlFile(filename);
if (!xmlFile.exists() || !xmlFile.open(QIODevice::ReadOnly))
{
LOG(VB_GENERAL, LOG_ERR, "SearchStream: Cannot open streams.xml");
return;
}
QString errorMsg;
int errorLine = 0;
int errorColumn = 0;
QDomDocument domDoc;
if (!domDoc.setContent(&xmlFile, false, &errorMsg,
&errorLine, &errorColumn))
{
LOG(VB_GENERAL, LOG_ERR,
"SearchStream: Could not read content of streams.xml" +
QString("\n\t\t\tError parsing %1").arg(filename) +
QString("\n\t\t\tat line: %1 column: %2 msg: %3")
.arg(errorLine).arg(errorColumn).arg(errorMsg));
return;
}
QDomNodeList itemList = domDoc.elementsByTagName("item");
QDomNode itemNode;
for (int i = 0; i < itemList.count(); i++)
{
itemNode = itemList.item(i);
Metadata mdata;
mdata.setStation(itemNode.namedItem(QString("station")).toElement().text());
mdata.setChannel(itemNode.namedItem(QString("channel")).toElement().text());
mdata.setUrl(itemNode.namedItem(QString("url")).toElement().text());
mdata.setLogoUrl(itemNode.namedItem(QString("logourl")).toElement().text());
mdata.setGenre(itemNode.namedItem(QString("genre")).toElement().text());
mdata.setMetadataFormat(itemNode.namedItem(QString("metadataformat")).toElement().text());
m_streams.insert(mdata.Station() + '-' + mdata.Channel(), mdata);
if (!m_stations.contains(mdata.Station()))
m_stations.append(mdata.Station());
QStringList genreList = mdata.Genre().split(',');
for (int x = 0; x < genreList.count(); x++)
{
if (!m_genres.contains(genreList[x].trimmed()))
m_genres.append(genreList[x].trimmed());
}
}
xmlFile.close();
m_stations.sort();
m_genres.sort();
}
示例6: AddFileToDB
/*!
* \brief Insert file details into database.
* If it is an audio file, read the metadata and insert
* that information at the same time.
*
* If it is an image file, just insert the filename and
* type.
*
* \param filename Full path to file.
*
* \returns Nothing.
*/
void FileScanner::AddFileToDB(const QString &filename)
{
QString extension = filename.section( '.', -1 ) ;
QString directory = filename;
directory.remove(0, m_startdir.length());
directory = directory.section( '/', 0, -2);
QString nameFilter = gCoreContext->GetSetting("AlbumArtFilter",
"*.png;*.jpg;*.jpeg;*.gif;*.bmp");
// If this file is an image, insert the details into the music_albumart table
if (nameFilter.indexOf(extension.toLower()) > -1)
{
QString name = filename.section( '/', -1);
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("INSERT INTO music_albumart SET filename = :FILE, "
"directory_id = :DIRID, imagetype = :TYPE;");
query.bindValue(":FILE", name);
query.bindValue(":DIRID", m_directoryid[directory]);
query.bindValue(":TYPE", AlbumArtImages::guessImageType(name));
if (!query.exec() || query.numRowsAffected() <= 0)
{
MythDB::DBError("music insert artwork", query);
}
return;
}
Decoder *decoder = Decoder::create(filename, NULL, NULL, true);
if (decoder)
{
LOG(VB_FILE, LOG_INFO,
QString("Reading metadata from %1").arg(filename));
Metadata *data = decoder->readMetadata();
if (data)
{
QString album_cache_string;
// Set values from cache
int did = m_directoryid[directory];
if (did > 0)
data->setDirectoryId(did);
int aid = m_artistid[data->Artist().toLower()];
if (aid > 0)
{
data->setArtistId(aid);
// The album cache depends on the artist id
album_cache_string = data->getArtistId() + "#"
+ data->Album().toLower();
if (m_albumid[album_cache_string] > 0)
data->setAlbumId(m_albumid[album_cache_string]);
}
int gid = m_genreid[data->Genre().toLower()];
if (gid > 0)
data->setGenreId(gid);
// Commit track info to database
data->dumpToDatabase();
// Update the cache
m_artistid[data->Artist().toLower()] =
data->getArtistId();
m_genreid[data->Genre().toLower()] =
data->getGenreId();
album_cache_string = data->getArtistId() + "#"
+ data->Album().toLower();
m_albumid[album_cache_string] = data->getAlbumId();
// read any embedded images from the tag
MetaIO *tagger = data->getTagger();
if (tagger && tagger->supportsEmbeddedImages())
{
AlbumArtList artList = tagger->getAlbumArtList(data->Filename());
data->setEmbeddedAlbumArt(artList);
data->getAlbumArtImages()->dumpToDatabase();
}
delete data;
}
//.........这里部分代码省略.........
示例7: ScanFinished
void Ripper::ScanFinished()
{
delete m_scanThread;
m_scanThread = NULL;
m_tracks->clear();
bool isCompilation = false;
bool newTune = true;
if (m_decoder)
{
QString label;
Metadata *metadata;
m_artistName.clear();
m_albumName.clear();
m_genreName.clear();
m_year.clear();
bool yesToAll = false;
bool noToAll = false;
for (int trackno = 0; trackno < m_decoder->getNumTracks(); trackno++)
{
RipTrack *ripTrack = new RipTrack;
metadata = m_decoder->getMetadata(trackno + 1);
if (metadata)
{
ripTrack->metadata = metadata;
ripTrack->length = metadata->Length();
ripTrack->active = true;
if (metadata->Compilation())
{
isCompilation = true;
m_artistName = metadata->CompilationArtist();
}
else if (m_artistName.isEmpty())
{
m_artistName = metadata->Artist();
}
if (m_albumName.isEmpty())
m_albumName = metadata->Album();
if (m_genreName.isEmpty() && !metadata->Genre().isEmpty())
m_genreName = metadata->Genre();
if (m_year.isEmpty() && metadata->Year() > 0)
m_year = QString::number(metadata->Year());
QString title = metadata->Title();
newTune = Ripper::isNewTune(m_artistName, m_albumName, title);
if (newTune)
{
m_tracks->push_back(ripTrack);
}
else
{
if (yesToAll)
{
deleteTrack(m_artistName, m_albumName, title);
m_tracks->push_back(ripTrack);
}
else if (noToAll)
{
delete ripTrack;
delete metadata;
continue;
}
else
{
DialogBox *dlg = new DialogBox(
GetMythMainWindow(),
tr("Artist: %1\n"
"Album: %2\n"
"Track: %3\n\n"
"This track is already in the database. \n"
"Do you want to remove the existing track?")
.arg(m_artistName).arg(m_albumName).arg(title));
dlg->AddButton("No");
dlg->AddButton("No To All");
dlg->AddButton("Yes");
dlg->AddButton("Yes To All");
DialogCode res = dlg->exec();
dlg->deleteLater();
dlg = NULL;
if (kDialogCodeButton0 == res)
{
delete ripTrack;
delete metadata;
}
else if (kDialogCodeButton1 == res)
{
noToAll = true;
delete ripTrack;
delete metadata;
//.........这里部分代码省略.........
示例8: ScanFinished
void Ripper::ScanFinished()
{
delete m_scanThread;
m_scanThread = NULL;
m_tracks->clear();
bool isCompilation = false;
if (m_decoder)
{
QString label;
Metadata *metadata;
m_artistName.clear();
m_albumName.clear();
m_genreName.clear();
m_year.clear();
for (int trackno = 0; trackno < m_decoder->getNumTracks(); trackno++)
{
RipTrack *ripTrack = new RipTrack;
metadata = m_decoder->getMetadata(trackno + 1);
if (metadata)
{
ripTrack->metadata = metadata;
ripTrack->length = metadata->Length();
if (metadata->Compilation())
{
isCompilation = true;
m_artistName = metadata->CompilationArtist();
}
else if (m_artistName.isEmpty())
{
m_artistName = metadata->Artist();
}
if (m_albumName.isEmpty())
m_albumName = metadata->Album();
if (m_genreName.isEmpty() && !metadata->Genre().isEmpty())
m_genreName = metadata->Genre();
if (m_year.isEmpty() && metadata->Year() > 0)
m_year = QString::number(metadata->Year());
QString title = metadata->Title();
ripTrack->isNew = isNewTune(m_artistName, m_albumName, title);
ripTrack->active = ripTrack->isNew;
m_tracks->push_back(ripTrack);
}
else
delete ripTrack;
}
m_artistEdit->SetText(m_artistName);
m_albumEdit->SetText(m_albumName);
m_genreEdit->SetText(m_genreName);
m_yearEdit->SetText(m_year);
m_compilationCheck->SetCheckState(isCompilation);
if (!isCompilation)
m_switchTitleArtist->SetVisible(false);
else
m_switchTitleArtist->SetVisible(true);
}
BuildFocusList();
updateTrackList();
CloseBusyPopup();
}