本文整理汇总了C++中CMusicInfoTag::SetComment方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::SetComment方法的具体用法?C++ CMusicInfoTag::SetComment怎么用?C++ CMusicInfoTag::SetComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::SetComment方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseTag
bool CTagLoaderTagLib::ParseTag(Tag *generic, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!generic)
return false;
PropertyMap properties = generic->properties();
for (PropertyMap::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
if (it->first == "ARTIST")
SetArtist(tag, StringListToVectorString(it->second));
else if (it->first == "ALBUM")
tag.SetAlbum(it->second.front().to8Bit(true));
else if (it->first == "TITLE")
tag.SetTitle(it->second.front().to8Bit(true));
else if (it->first == "TRACKNUMBER")
tag.SetTrackNumber(it->second.front().toInt());
else if (it->first == "YEAR")
tag.SetYear(it->second.front().toInt());
else if (it->first == "GENRE")
SetGenre(tag, StringListToVectorString(it->second));
else if (it->first == "COMMENT")
tag.SetComment(it->second.front().to8Bit(true));
}
return true;
}
示例2: ParseAPETag
bool CTagLoaderTagLib::ParseAPETag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!ape)
return false;
const APE::ItemListMap itemListMap = ape->itemListMap();
for (APE::ItemListMap::ConstIterator it = itemListMap.begin(); it != itemListMap.end(); ++it)
{
if (it->first == "ARTIST") SetArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ALBUM ARTIST") SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ALBUM") tag.SetAlbum(it->second.toString().to8Bit(true));
else if (it->first == "TITLE") tag.SetTitle(it->second.toString().to8Bit(true));
else if (it->first == "TRACKNUMBER") tag.SetTrackNumber(it->second.toString().toInt());
else if (it->first == "DISCNUMBER") tag.SetPartOfSet(it->second.toString().toInt());
else if (it->first == "YEAR") tag.SetYear(it->second.toString().toInt());
else if (it->first == "GENRE") SetGenre(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "COMMENT") tag.SetComment(it->second.toString().to8Bit(true));
else if (it->first == "ENCODEDBY") {}
else if (it->first == "COMPILATION") tag.SetCompilation(it->second.toString().toInt() == 1);
else if (it->first == "LYRICS") tag.SetLyrics(it->second.toString().to8Bit(true));
else if (it->first == "REPLAYGAIN_TRACK_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.toString().toCString(true)) * 100 + 0.5));
else if (it->first == "REPLAYGAIN_ALBUM_GAIN") tag.SetReplayGainAlbumGain((int)(atof(it->second.toString().toCString(true)) * 100 + 0.5));
else if (it->first == "REPLAYGAIN_TRACK_PEAK") tag.SetReplayGainTrackPeak((float)atof(it->second.toString().toCString(true)));
else if (it->first == "REPLAYGAIN_ALBUM_PEAK") tag.SetReplayGainAlbumPeak((float)atof(it->second.toString().toCString(true)));
else if (it->first == "MUSICBRAINZ_ARTISTID") tag.SetMusicBrainzArtistID(it->second.toString().to8Bit(true));
else if (it->first == "MUSICBRAINZ_ALBUMARTISTID") tag.SetMusicBrainzAlbumArtistID(it->second.toString().to8Bit(true));
else if (it->first == "MUSICBRAINZ_ALBUMID") tag.SetMusicBrainzAlbumID(it->second.toString().to8Bit(true));
else if (it->first == "MUSICBRAINZ_TRACKID") tag.SetMusicBrainzTrackID(it->second.toString().to8Bit(true));
else if (g_advancedSettings.m_logLevel == LOG_LEVEL_MAX)
CLog::Log(LOGDEBUG, "unrecognized APE tag: %s", it->first.toCString(true));
}
return true;
}
示例3: if
bool CTagLoaderTagLib::ParseMP4Tag(MP4::Tag *mp4, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!mp4)
return false;
MP4::ItemListMap& itemListMap = mp4->itemListMap();
for (MP4::ItemListMap::ConstIterator it = itemListMap.begin(); it != itemListMap.end(); ++it)
{
if (it->first == "\251nam") tag.SetTitle(it->second.toStringList().front().to8Bit(true));
else if (it->first == "\251ART") SetArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "\251alb") tag.SetAlbum(it->second.toStringList().front().to8Bit(true));
else if (it->first == "aART") SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "\251gen") SetGenre(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "\251cmt") tag.SetComment(it->second.toStringList().front().to8Bit(true));
else if (it->first == "cpil") tag.SetCompilation(it->second.toBool());
else if (it->first == "trkn") tag.SetTrackNumber(it->second.toIntPair().first);
else if (it->first == "disk") tag.SetPartOfSet(it->second.toIntPair().first);
else if (it->first == "\251day") tag.SetYear(it->second.toStringList().front().toInt());
else if (it->first == "----:com.apple.iTunes:MusicBrainz Artist Id")
tag.SetMusicBrainzArtistID(it->second.toStringList().front().to8Bit(true));
else if (it->first == "----:com.apple.iTunes:MusicBrainz Album Artist Id")
tag.SetMusicBrainzAlbumArtistID(it->second.toStringList().front().to8Bit(true));
else if (it->first == "----:com.apple.iTunes:MusicBrainz Album Id")
tag.SetMusicBrainzAlbumID(it->second.toStringList().front().to8Bit(true));
else if (it->first == "----:com.apple.iTunes:MusicBrainz Track Id")
tag.SetMusicBrainzTrackID(it->second.toStringList().front().to8Bit(true));
else if (it->first == "covr")
{
MP4::CoverArtList coverArtList = it->second.toCoverArtList();
for (MP4::CoverArtList::ConstIterator pt = coverArtList.begin(); pt != coverArtList.end(); ++pt)
{
string mime;
switch (pt->format())
{
case MP4::CoverArt::PNG:
mime = "image/png";
break;
case MP4::CoverArt::JPEG:
mime = "image/jpeg";
break;
default:
break;
}
if (mime.empty())
continue;
tag.SetCoverArtInfo(pt->data().size(), mime);
if (art)
art->set((const uint8_t *)pt->data().data(), pt->data().size(), mime);
break; // one is enough
}
}
}
return true;
}
示例4: ParseXiphComment
bool CTagLoaderTagLib::ParseXiphComment(Ogg::XiphComment *xiph, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!xiph)
return false;
const Ogg::FieldListMap& fieldListMap = xiph->fieldListMap();
for (Ogg::FieldListMap::ConstIterator it = fieldListMap.begin(); it != fieldListMap.end(); ++it)
{
if (it->first == "ARTIST") SetArtist(tag, StringListToVectorString(it->second));
else if (it->first == "ALBUMARTIST") SetAlbumArtist(tag, StringListToVectorString(it->second));
else if (it->first == "ALBUM ARTIST") SetAlbumArtist(tag, StringListToVectorString(it->second));
else if (it->first == "ALBUM") tag.SetAlbum(it->second.front().to8Bit(true));
else if (it->first == "TITLE") tag.SetTitle(it->second.front().to8Bit(true));
else if (it->first == "TRACKNUMBER") tag.SetTrackNumber(it->second.front().toInt());
else if (it->first == "DISCNUMBER") tag.SetPartOfSet(it->second.front().toInt());
else if (it->first == "YEAR") tag.SetYear(it->second.front().toInt());
else if (it->first == "DATE") tag.SetYear(it->second.front().toInt());
else if (it->first == "GENRE") SetGenre(tag, StringListToVectorString(it->second));
else if (it->first == "COMMENT") tag.SetComment(it->second.front().to8Bit(true));
else if (it->first == "ENCODEDBY") {}
else if (it->first == "ENSEMBLE") {}
else if (it->first == "COMPILATION") tag.SetCompilation(it->second.front().toInt() == 1);
else if (it->first == "LYRICS") tag.SetLyrics(it->second.front().to8Bit(true));
else if (it->first == "REPLAYGAIN_TRACK_GAIN") tag.SetReplayGainTrackGain((int)(atof(it->second.front().toCString(true)) * 100 + 0.5));
else if (it->first == "REPLAYGAIN_ALBUM_GAIN") tag.SetReplayGainAlbumGain((int)(atof(it->second.front().toCString(true)) * 100 + 0.5));
else if (it->first == "REPLAYGAIN_TRACK_PEAK") tag.SetReplayGainTrackPeak((float)atof(it->second.front().toCString(true)));
else if (it->first == "REPLAYGAIN_ALBUM_PEAK") tag.SetReplayGainAlbumPeak((float)atof(it->second.front().toCString(true)));
else if (it->first == "MUSICBRAINZ_ARTISTID") tag.SetMusicBrainzArtistID(it->second.front().to8Bit(true));
else if (it->first == "MUSICBRAINZ_ALBUMARTISTID") tag.SetMusicBrainzAlbumArtistID(it->second.front().to8Bit(true));
else if (it->first == "MUSICBRAINZ_ALBUMID") tag.SetMusicBrainzAlbumID(it->second.front().to8Bit(true));
else if (it->first == "MUSICBRAINZ_TRACKID") tag.SetMusicBrainzTrackID(it->second.front().to8Bit(true));
else if (it->first == "RATING")
{
// Vorbis ratings are a mess because the standard forgot to mention anything about them.
// If you want to see how emotive the issue is and the varying standards, check here:
// http://forums.winamp.com/showthread.php?t=324512
// The most common standard in that thread seems to be a 0-100 scale for 1-5 stars.
// So, that's what we'll support for now.
int iRating = it->second.front().toInt();
if (iRating > 0 && iRating <= 100)
tag.SetRating((iRating / 20) + '0');
}
else if (g_advancedSettings.m_logLevel == LOG_LEVEL_MAX)
CLog::Log(LOGDEBUG, "unrecognized XipComment name: %s", it->first.toCString(true));
}
return true;
}
示例5: Load
bool CMusicInfoTagLoaderApe::Load(const CStdString& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
try
{
// retrieve the APE Tag info from strFileName
// and put it in tag
tag.SetURL(strFileName);
DVDPlayerCodec codec;
if (codec.Init(strFileName, 4096))
{
tag.SetDuration((int)(codec.m_TotalTime/1000));
codec.DeInit();
}
CAPEv2Tag myTag;
if (myTag.ReadTag((char*)strFileName.c_str())) // true to check ID3 tag as well
{
tag.SetTitle(myTag.GetTitle());
tag.SetAlbum(myTag.GetAlbum());
tag.SetArtist(myTag.GetArtist());
tag.SetAlbumArtist(myTag.GetAlbumArtist());
tag.SetGenre(myTag.GetGenre());
tag.SetTrackNumber(myTag.GetTrackNum());
tag.SetPartOfSet(myTag.GetDiscNum());
tag.SetComment(myTag.GetComment());
tag.SetLyrics(myTag.GetLyrics());
tag.SetMusicBrainzAlbumArtistID(myTag.GetMusicBrainzAlbumArtistID());
tag.SetMusicBrainzAlbumID(myTag.GetMusicBrainzAlbumID());
tag.SetMusicBrainzArtistID(myTag.GetMusicBrainzArtistID());
tag.SetMusicBrainzTrackID(myTag.GetMusicBrainzTrackID());
tag.SetMusicBrainzTRMID(myTag.GetMusicBrainzTRMID());
SYSTEMTIME dateTime;
ZeroMemory(&dateTime, sizeof(SYSTEMTIME));
dateTime.wYear = atoi(myTag.GetYear());
tag.SetRating(myTag.GetRating());
tag.SetReleaseDate(dateTime);
tag.SetLoaded();
return true;
}
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader ape: exception in file %s", strFileName.c_str());
}
tag.SetLoaded(false);
return false;
}
示例6: GetChannels
int CPVRChannels::GetChannels(CFileItemList* results, int iGroupID /* = -1 */, bool bHidden /* = false */)
{
int iAmount = 0;
SortByChannelNumber();
for (unsigned int ptr = 0; ptr < size(); ptr++)
{
CPVRChannel *channel = at(ptr);
if (channel->IsHidden() != bHidden)
continue;
if (iGroupID != -1 && channel->GroupID() != iGroupID)
continue;
CFileItemPtr channelFile(new CFileItem(*channel));
if (channel->IsRadio())
{
CMusicInfoTag* musictag = channelFile->GetMusicInfoTag();
if (musictag)
{
const CPVREpgInfoTag *epgNow = channel->GetEPGNow();
musictag->SetURL(channel->Path());
musictag->SetTitle(epgNow->Title());
musictag->SetArtist(channel->ChannelName());
musictag->SetAlbumArtist(channel->ChannelName());
musictag->SetGenre(epgNow->Genre());
musictag->SetDuration(epgNow->GetDuration());
musictag->SetLoaded(true);
musictag->SetComment("");
musictag->SetLyrics("");
}
}
results->Add(channelFile);
iAmount++;
}
return iAmount;
}
示例7: Load
bool CMusicInfoTagLoaderApe::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
try
{
// retrieve the APE Tag info from strFileName
// and put it in tag
tag.SetURL(strFileName);
CAPEv2Tag myTag;
if (myTag.ReadTag((char*)strFileName.c_str())) // true to check ID3 tag as well
{
tag.SetTitle(myTag.GetTitle());
tag.SetAlbum(myTag.GetAlbum());
tag.SetArtist(myTag.GetArtist());
tag.SetAlbumArtist(myTag.GetAlbumArtist());
tag.SetGenre(myTag.GetGenre());
tag.SetTrackNumber(myTag.GetTrackNum());
tag.SetPartOfSet(myTag.GetDiscNum());
tag.SetComment(myTag.GetComment());
tag.SetLyrics(myTag.GetLyrics());
SYSTEMTIME dateTime;
ZeroMemory(&dateTime, sizeof(SYSTEMTIME));
dateTime.wYear = atoi(myTag.GetYear());
tag.SetRating(myTag.GetRating());
tag.SetReleaseDate(dateTime);
tag.SetLoaded();
return true;
}
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader ape: exception in file %s", strFileName.c_str());
}
tag.SetLoaded(false);
return false;
}
示例8: switch
void CMusicInfoTagLoaderMP4::ParseTag( unsigned int metaKey, const char* pMetaData, int metaSize, CMusicInfoTag& tag)
{
switch ( metaKey )
{
case g_TitleAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
// we use utf8 internally
tag.SetLoaded( true );
tag.SetTitle( dataWorkspace.get() );
break;
}
case g_ArtistAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetArtist( dataWorkspace.get() );
break;
}
case g_AlbumAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetAlbum( dataWorkspace.get() );
break;
}
case g_AlbumArtistAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetAlbumArtist( dataWorkspace.get() );
break;
}
case g_DayAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
SYSTEMTIME dateTime;
dateTime.wYear = atoi( dataWorkspace.get() );
tag.SetReleaseDate( dateTime );
break;
}
case g_GenreAtomName:
{
// When a genre number is specified, we need to translate to a string for display..
// Note that AAC/iTunes genre numbers are the same as ID3 numbers, but are offset by 1.
const char* pGenre = ID3_V1GENRE2DESCRIPTION( (unsigned char)pMetaData[ 1 ] - 1 );
if ( pGenre )
{
tag.SetGenre( pGenre );
}
break;
}
case g_CompilationAtomName:
{
if (metaSize == 1)
m_isCompilation = *pMetaData == 1;
break;
}
case g_CommentAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetComment( dataWorkspace.get() );
break;
}
case g_LyricsAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
//.........这里部分代码省略.........
示例9: UpdateItem
bool CPVRManager::UpdateItem(CFileItem& item)
{
/* Don't update if a recording is played */
if (item.IsPVRRecording())
return false;
if (!item.IsPVRChannel())
{
CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
return false;
}
CSingleLock lock(m_critSection);
if (!m_currentFile || *m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
return false;
g_application.CurrentFileItem() = *m_currentFile;
g_infoManager.SetCurrentItem(*m_currentFile);
CPVRChannel* channelTag = item.GetPVRChannelInfoTag();
CEpgInfoTag epgTagNow;
bool bHasTagNow = channelTag->GetEPGNow(epgTagNow);
if (channelTag->IsRadio())
{
CMusicInfoTag* musictag = item.GetMusicInfoTag();
if (musictag)
{
musictag->SetTitle(bHasTagNow ?
epgTagNow.Title() :
g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055)); // no information available
if (bHasTagNow)
musictag->SetGenre(epgTagNow.Genre());
musictag->SetDuration(bHasTagNow ? epgTagNow.GetDuration() : 3600);
musictag->SetURL(channelTag->Path());
musictag->SetArtist(channelTag->ChannelName());
musictag->SetAlbumArtist(channelTag->ChannelName());
musictag->SetLoaded(true);
musictag->SetComment(StringUtils::EmptyString);
musictag->SetLyrics(StringUtils::EmptyString);
}
}
else
{
CVideoInfoTag *videotag = item.GetVideoInfoTag();
if (videotag)
{
videotag->m_strTitle = bHasTagNow ?
epgTagNow.Title() :
g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
if (bHasTagNow)
videotag->m_genre = epgTagNow.Genre();
videotag->m_strPath = channelTag->Path();
videotag->m_strFileNameAndPath = channelTag->Path();
videotag->m_strPlot = bHasTagNow ? epgTagNow.Plot() : StringUtils::EmptyString;
videotag->m_strPlotOutline = bHasTagNow ? epgTagNow.PlotOutline() : StringUtils::EmptyString;
videotag->m_iEpisode = bHasTagNow ? epgTagNow.EpisodeNum() : 0;
}
}
return false;
}
示例10: ParseTag
bool CTagLoaderTagLib::ParseTag(APE::Tag *ape, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!ape)
return false;
ReplayGain replayGainInfo;
const APE::ItemListMap itemListMap = ape->itemListMap();
for (APE::ItemListMap::ConstIterator it = itemListMap.begin(); it != itemListMap.end(); ++it)
{
if (it->first == "ARTIST")
SetArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ARTISTS")
SetArtistHints(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ALBUMARTIST" || it->first == "ALBUM ARTIST")
SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ALBUMARTISTS" || it->first == "ALBUM ARTISTS")
SetAlbumArtistHints(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "ALBUM")
tag.SetAlbum(it->second.toString().to8Bit(true));
else if (it->first == "TITLE")
tag.SetTitle(it->second.toString().to8Bit(true));
else if (it->first == "TRACKNUMBER" || it->first == "TRACK")
tag.SetTrackNumber(it->second.toString().toInt());
else if (it->first == "DISCNUMBER" || it->first == "DISC")
tag.SetDiscNumber(it->second.toString().toInt());
else if (it->first == "YEAR")
tag.SetYear(it->second.toString().toInt());
else if (it->first == "GENRE")
SetGenre(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "MOOD")
tag.SetMood(it->second.toString().to8Bit(true));
else if (it->first == "COMMENT")
tag.SetComment(it->second.toString().to8Bit(true));
else if (it->first == "CUESHEET")
tag.SetCueSheet(it->second.toString().to8Bit(true));
else if (it->first == "ENCODEDBY")
{}
else if (it->first == "COMPOSER")
AddArtistRole(tag, "Composer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "CONDUCTOR")
AddArtistRole(tag, "Conductor", StringListToVectorString(it->second.toStringList()));
else if ((it->first == "BAND") || (it->first == "ENSEMBLE"))
AddArtistRole(tag, "Orchestra", StringListToVectorString(it->second.toStringList()));
else if (it->first == "LYRICIST")
AddArtistRole(tag, "Lyricist", StringListToVectorString(it->second.toStringList()));
else if (it->first == "MIXARTIST")
AddArtistRole(tag, "Remixer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "ARRANGER")
AddArtistRole(tag, "Arranger", StringListToVectorString(it->second.toStringList()));
else if (it->first == "ENGINEER")
AddArtistRole(tag, "Engineer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "PRODUCER")
AddArtistRole(tag, "Producer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "DJMIXER")
AddArtistRole(tag, "DJMixer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "MIXER")
AddArtistRole(tag, "Mixer", StringListToVectorString(it->second.toStringList()));
else if (it->first == "PERFORMER")
// Picard uses PERFORMER tag as musician credits list formatted "name (instrument)"
AddArtistInstrument(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "LABEL")
{} // Publisher. Known unsupported, supress warnings
else if (it->first == "COMPILATION")
tag.SetCompilation(it->second.toString().toInt() == 1);
else if (it->first == "LYRICS")
tag.SetLyrics(it->second.toString().to8Bit(true));
else if (it->first == "REPLAYGAIN_TRACK_GAIN")
replayGainInfo.ParseGain(ReplayGain::TRACK, it->second.toString().toCString(true));
else if (it->first == "REPLAYGAIN_ALBUM_GAIN")
replayGainInfo.ParseGain(ReplayGain::ALBUM, it->second.toString().toCString(true));
else if (it->first == "REPLAYGAIN_TRACK_PEAK")
replayGainInfo.ParsePeak(ReplayGain::TRACK, it->second.toString().toCString(true));
else if (it->first == "REPLAYGAIN_ALBUM_PEAK")
replayGainInfo.ParsePeak(ReplayGain::ALBUM, it->second.toString().toCString(true));
else if (it->first == "MUSICBRAINZ_ARTISTID")
tag.SetMusicBrainzArtistID(SplitMBID(StringListToVectorString(it->second.toStringList())));
else if (it->first == "MUSICBRAINZ_ALBUMARTISTID")
tag.SetMusicBrainzAlbumArtistID(SplitMBID(StringListToVectorString(it->second.toStringList())));
else if (it->first == "MUSICBRAINZ_ALBUMARTIST")
SetAlbumArtist(tag, StringListToVectorString(it->second.toStringList()));
else if (it->first == "MUSICBRAINZ_ALBUMID")
tag.SetMusicBrainzAlbumID(it->second.toString().to8Bit(true));
else if (it->first == "MUSICBRAINZ_TRACKID")
tag.SetMusicBrainzTrackID(it->second.toString().to8Bit(true));
else if (g_advancedSettings.m_logLevel == LOG_LEVEL_MAX)
CLog::Log(LOGDEBUG, "unrecognized APE tag: %s", it->first.toCString(true));
}
tag.SetReplayGain(replayGainInfo);
return true;
}
示例11: if
void CMusicInfoTagLoaderMP4::ParseTag( unsigned int metaKey, const char* pMetaData, int metaSize, CMusicInfoTag& tag, EmbeddedArt *art)
{
switch ( metaKey )
{
case g_TitleAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
// we use utf8 internally
tag.SetLoaded( true );
tag.SetTitle( dataWorkspace.get() );
break;
}
case g_ArtistAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetArtist( dataWorkspace.get() );
break;
}
case g_AlbumAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetAlbum( dataWorkspace.get() );
break;
}
case g_AlbumArtistAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetAlbumArtist( dataWorkspace.get() );
break;
}
case g_DayAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
SYSTEMTIME dateTime;
dateTime.wYear = atoi( dataWorkspace.get() );
tag.SetReleaseDate( dateTime );
break;
}
case g_GenreAtomName:
{
// When a genre number is specified, we need to translate to a string for display..
// Note that AAC/iTunes genre numbers are the same as ID3 numbers, but are offset by 1.
const char* pGenre = ID3_V1GENRE2DESCRIPTION( (unsigned char)pMetaData[ 1 ] - 1 );
if ( pGenre )
{
tag.SetGenre( pGenre );
}
break;
}
case g_CompilationAtomName:
{
if (metaSize == 1)
tag.SetCompilation(*pMetaData == 1);
break;
}
case g_CommentAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
dataWorkspace[ metaSize ] = '\0';
tag.SetComment( dataWorkspace.get() );
break;
}
case g_LyricsAtomName:
{
// We need to zero-terminate the string, which needs workspace..
auto_aptr<char> dataWorkspace( new char[ metaSize + 1 ] );
memcpy( dataWorkspace.get(), pMetaData, metaSize );
//.........这里部分代码省略.........
示例12: UpdateItem
bool CPVRManager::UpdateItem(CFileItem& item)
{
/* Don't update if a recording is played */
if (item.IsPVRRecording())
return false;
if (!item.IsPVRChannel())
{
CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
return false;
}
CSingleLock lock(m_critSection);
if (!m_currentFile || *m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
return false;
g_application.CurrentFileItem() = *m_currentFile;
g_infoManager.SetCurrentItem(*m_currentFile);
CPVRChannel* channelTag = item.GetPVRChannelInfoTag();
CEpgInfoTag epgTagNow;
bool bHasTagNow = channelTag->GetEPGNow(epgTagNow);
if (channelTag->IsRadio())
{
CMusicInfoTag* musictag = item.GetMusicInfoTag();
if (musictag)
{
musictag->SetTitle(bHasTagNow ? epgTagNow.Title() : g_localizeStrings.Get(19055));
if (bHasTagNow)
musictag->SetGenre(epgTagNow.Genre());
musictag->SetDuration(bHasTagNow ? epgTagNow.GetDuration() : 3600);
musictag->SetURL(channelTag->Path());
musictag->SetArtist(channelTag->ChannelName());
musictag->SetAlbumArtist(channelTag->ChannelName());
musictag->SetLoaded(true);
musictag->SetComment(StringUtils::EmptyString);
musictag->SetLyrics(StringUtils::EmptyString);
}
}
else
{
CVideoInfoTag *videotag = item.GetVideoInfoTag();
if (videotag)
{
videotag->m_strTitle = bHasTagNow ? epgTagNow.Title() : g_localizeStrings.Get(19055);
if (bHasTagNow)
videotag->m_genre = epgTagNow.Genre();
videotag->m_strPath = channelTag->Path();
videotag->m_strFileNameAndPath = channelTag->Path();
videotag->m_strPlot = bHasTagNow ? epgTagNow.Plot() : StringUtils::EmptyString;
videotag->m_strPlotOutline = bHasTagNow ? epgTagNow.PlotOutline() : StringUtils::EmptyString;
videotag->m_iEpisode = bHasTagNow ? epgTagNow.EpisodeNum() : 0;
}
}
CPVRChannel* tagPrev = item.GetPVRChannelInfoTag();
if (tagPrev && tagPrev->ChannelNumber() != m_LastChannel)
{
m_LastChannel = tagPrev->ChannelNumber();
m_LastChannelChanged = XbmcThreads::SystemClockMillis();
}
if (XbmcThreads::SystemClockMillis() - m_LastChannelChanged >= (unsigned int) g_guiSettings.GetInt("pvrplayback.channelentrytimeout") && m_LastChannel != m_PreviousChannel[m_PreviousChannelIndex])
m_PreviousChannel[m_PreviousChannelIndex ^= 1] = m_LastChannel;
else
m_LastChannelChanged = XbmcThreads::SystemClockMillis();
return false;
}
示例13: UpdateItem
bool CPVRManager::UpdateItem(CFileItem& item)
{
/* Don't update if a recording is played */
if (item.IsPVRRecording())
return false;
if (!item.IsPVRChannel())
{
CLog::Log(LOGERROR, "CPVRManager - %s - no channel tag provided", __FUNCTION__);
return false;
}
CSingleLock lock(m_critSection);
if (!m_currentFile || *m_currentFile->GetPVRChannelInfoTag() == *item.GetPVRChannelInfoTag())
return false;
g_application.SetCurrentFileItem(*m_currentFile);
CFileItemPtr itemptr(new CFileItem(*m_currentFile));
g_infoManager.SetCurrentItem(itemptr);
CPVRChannelPtr channelTag(item.GetPVRChannelInfoTag());
CEpgInfoTagPtr epgTagNow(channelTag->GetEPGNow());
if (channelTag->IsRadio())
{
CMusicInfoTag* musictag = item.GetMusicInfoTag();
if (musictag)
{
musictag->SetTitle(epgTagNow ?
epgTagNow->Title() :
CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
"" :
g_localizeStrings.Get(19055)); // no information available
if (epgTagNow)
musictag->SetGenre(epgTagNow->Genre());
musictag->SetDuration(epgTagNow ? epgTagNow->GetDuration() : 3600);
musictag->SetURL(channelTag->Path());
musictag->SetArtist(channelTag->ChannelName());
musictag->SetAlbumArtist(channelTag->ChannelName());
musictag->SetLoaded(true);
musictag->SetComment("");
musictag->SetLyrics("");
}
}
else
{
CVideoInfoTag *videotag = item.GetVideoInfoTag();
if (videotag)
{
videotag->m_strTitle = epgTagNow ?
epgTagNow->Title() :
CSettings::GetInstance().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
"" :
g_localizeStrings.Get(19055); // no information available
if (epgTagNow)
videotag->m_genre = epgTagNow->Genre();
videotag->m_strPath = channelTag->Path();
videotag->m_strFileNameAndPath = channelTag->Path();
videotag->m_strPlot = epgTagNow ? epgTagNow->Plot() : "";
videotag->m_strPlotOutline = epgTagNow ? epgTagNow->PlotOutline() : "";
videotag->m_iEpisode = epgTagNow ? epgTagNow->EpisodeNumber() : 0;
}
}
return false;
}