本文整理汇总了C++中CMusicInfoTag::SetArtist方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::SetArtist方法的具体用法?C++ CMusicInfoTag::SetArtist怎么用?C++ CMusicInfoTag::SetArtist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::SetArtist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetArtist
void CTagLoaderTagLib::SetArtist(CMusicInfoTag &tag, const std::vector<std::string> &values)
{
if (values.size() == 1)
tag.SetArtist(values[0]);
else
tag.SetArtist(values);
}
示例2: SetArtist
void CTagLoaderTagLib::SetArtist(CMusicInfoTag &tag, const std::vector<std::string> &values)
{
if (values.size() == 1)
tag.SetArtist(values[0]);
else
// Fill both artist vector and artist desc from tag value.
// Note desc may not be empty as it could have been set by previous parsing of ID3v2 before APE
tag.SetArtist(values, true);
}
示例3: Load
bool CMusicInfoTagLoaderNSF::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
tag.SetLoaded(false);
if (!m_dll.Load())
return false;
m_nsf = m_dll.LoadNSF(strFileName.c_str());
if (!m_nsf)
{
CLog::Log(LOGERROR,"MusicInfoTagLoaderNSF: failed to open NSF %s",strFileName.c_str());
return false;
}
tag.SetURL(strFileName);
tag.SetLoaded(false);
char* szTitle = (char*)m_dll.GetTitle(m_nsf); // no alloc
if( szTitle && strcmp(szTitle,"<?>") )
{
tag.SetTitle(szTitle);
tag.SetLoaded(true);
}
char* szArtist = (char*)m_dll.GetArtist(m_nsf); // no alloc
if( szArtist && strcmp(szArtist,"<?>") && tag.Loaded() )
tag.SetArtist(szArtist);
m_dll.FreeNSF(m_nsf);
m_nsf = 0;
return tag.Loaded();
}
示例4: Load
bool CMusicInfoTagLoaderSPC::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
tag.SetLoaded(false);
CFile file;
if (!file.Open(strFileName))
{
CLog::Log(LOGERROR,"MusicInfoTagLoaderSPC: failed to open SPC %s",strFileName.c_str());
return false;
}
tag.SetURL(strFileName);
tag.SetLoaded(false);
SPC_ID666* spc = SPC_get_id666FP(file);
if (!spc)
return false;
if( strcmp(spc->songname,"") )
{
tag.SetTitle(spc->songname);
tag.SetLoaded(true);
}
if( strcmp(spc->author,"") && tag.Loaded() )
tag.SetArtist(spc->author);
if (spc->playtime)
tag.SetDuration(spc->playtime);
else
tag.SetDuration(4*60); // 4 mins
free(spc);
return tag.Loaded();
}
示例5: ParseASF
bool CTagLoaderTagLib::ParseASF(ASF::Tag *asf, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!asf)
return false;
tag.SetTitle(asf->title().to8Bit(true));
const ASF::AttributeListMap& attributeListMap = asf->attributeListMap();
for (ASF::AttributeListMap::ConstIterator it = attributeListMap.begin(); it != attributeListMap.end(); ++it)
{
if (it->first == "Author") SetArtist(tag, GetASFStringList(it->second));
else if (it->first == "WM/AlbumArtist") SetAlbumArtist(tag, GetASFStringList(it->second));
else if (it->first == "WM/AlbumTitle") tag.SetAlbum(it->second.front().toString().to8Bit(true));
else if (it->first == "WM/TrackNumber" ||
it->first == "WM/Track")
{
if (it->second.front().type() == ASF::Attribute::DWordType)
tag.SetTrackNumber(it->second.front().toUInt());
else
tag.SetTrackNumber(atoi(it->second.front().toString().toCString(true)));
}
else if (it->first == "WM/PartOfSet") tag.SetPartOfSet(atoi(it->second.front().toString().toCString(true)));
else if (it->first == "WM/Genre") SetGenre(tag, GetASFStringList(it->second));
else if (it->first == "WM/AlbumArtistSortOrder") {} // Known unsupported, supress warnings
else if (it->first == "WM/ArtistSortOrder") {} // Known unsupported, supress warnings
else if (it->first == "WM/Script") {} // Known unsupported, supress warnings
else if (it->first == "WM/Year") tag.SetYear(atoi(it->second.front().toString().toCString(true)));
else if (it->first == "MusicBrainz/Artist Id") tag.SetMusicBrainzArtistID(GetASFStringList(it->second));
else if (it->first == "MusicBrainz/Album Id") tag.SetMusicBrainzAlbumID(it->second.front().toString().to8Bit(true));
else if (it->first == "MusicBrainz/Album Artist") SetAlbumArtist(tag, GetASFStringList(it->second));
else if (it->first == "MusicBrainz/Album Artist Id") tag.SetMusicBrainzAlbumArtistID(GetASFStringList(it->second));
else if (it->first == "MusicBrainz/Track Id") tag.SetMusicBrainzTrackID(it->second.front().toString().to8Bit(true));
else if (it->first == "MusicBrainz/Album Status") {}
else if (it->first == "MusicBrainz/Album Type") {}
else if (it->first == "MusicIP/PUID") {}
else if (it->first == "replaygain_track_gain") tag.SetReplayGainTrackGain((int)(atof(it->second.front().toString().toCString(true)) * 100 + 0.5));
else if (it->first == "replaygain_album_gain") tag.SetReplayGainAlbumGain((int)(atof(it->second.front().toString().toCString(true)) * 100 + 0.5));
else if (it->first == "replaygain_track_peak") tag.SetReplayGainTrackPeak((float)atof(it->second.front().toString().toCString(true)));
else if (it->first == "replaygain_album_peak") tag.SetReplayGainAlbumPeak((float)atof(it->second.front().toString().toCString(true)));
else if (it->first == "WM/Picture")
{ // picture
ASF::Picture pic = it->second.front().toPicture();
tag.SetCoverArtInfo(pic.picture().size(), pic.mimeType().toCString());
if (art)
art->set((const uint8_t *)pic.picture().data(), pic.picture().size(), pic.mimeType().toCString());
}
else if (g_advancedSettings.m_logLevel == LOG_LEVEL_MAX)
CLog::Log(LOGDEBUG, "unrecognized ASF tag name: %s", it->first.toCString(true));
}
// artist may be specified in the ContentDescription block rather than using the 'Author' attribute.
if (tag.GetArtist().empty())
tag.SetArtist(asf->artist().toCString(true));
tag.SetLoaded(true);
return true;
}
示例6: ParseTag
bool CTagLoaderTagLib::ParseTag(ID3v1::Tag *id3v1, EmbeddedArt *art, CMusicInfoTag& tag)
{
if (!id3v1) return false;
tag.SetTitle(id3v1->title().to8Bit(true));
tag.SetArtist(id3v1->artist().to8Bit(true));
tag.SetAlbum(id3v1->album().to8Bit(true));
tag.SetComment(id3v1->comment().to8Bit(true));
tag.SetGenre(id3v1->genre().to8Bit(true));
tag.SetYear(id3v1->year());
tag.SetTrackNumber(id3v1->track());
return true;
}
示例7: Load
bool CMusicInfoTagLoaderMod::Load(const CStdString& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
tag.SetURL(strFileName);
// first, does the module have a .mdz?
CStdString strMDZ(URIUtils::ReplaceExtension(strFileName,".mdz"));
if (CFile::Exists(strMDZ))
{
if (!getFile(strMDZ,strMDZ))
{
tag.SetLoaded(false);
return( false );
}
ifstream inMDZ(CSpecialProtocol::TranslatePath(strMDZ.c_str()));
char temp[8192];
char temp2[8192];
while (!inMDZ.eof())
{
inMDZ.getline(temp,8191);
if (strstr(temp,"COMPOSER"))
{
strcpy(temp2,temp+strlen("COMPOSER "));
tag.SetArtist(temp2);
}
else if (strstr(temp,"TITLE"))
{
strcpy(temp2,temp+strlen("TITLE "));
tag.SetTitle(temp2);
tag.SetLoaded(true);
}
else if (strstr(temp,"PLAYTIME"))
{
char* temp3 = strtok(temp+strlen("PLAYTIME "),":");
int iSecs = atoi(temp3)*60;
temp3 = strtok(NULL,":");
iSecs += atoi(temp3);
tag.SetDuration(iSecs);
}
else if (strstr(temp,"STYLE"))
{
strcpy(temp2,temp+strlen("STYLE "));
tag.SetGenre(temp2);
}
}
return( tag.Loaded() );
}
else
{
// TODO: no, then try to atleast fetch the title
}
return tag.Loaded();
}
示例8: Close
bool CEncoderLame::Close()
{
// may return one more mp3 frames
int iBytes = m_dll.lame_encode_flush(m_pGlobalFlags, m_buffer, sizeof(m_buffer));
if (iBytes < 0)
{
CLog::Log(LOGERROR, "Internal Lame error: %i", iBytes);
return false;
}
WriteStream(m_buffer, iBytes);
FlushStream();
FileClose();
// open again, but now the old way, lame only accepts FILE pointers
FILE* file = fopen_utf8(m_strFile.c_str(), "rb+");
if (!file)
{
CLog::Log(LOGERROR, "Error: Cannot open file for writing tags: %s", m_strFile.c_str());
return false;
}
m_dll.lame_mp3_tags_fid(m_pGlobalFlags, file); /* add VBR tags to mp3 file */
fclose(file);
m_dll.lame_close(m_pGlobalFlags);
// unload the lame dll
m_dll.Unload();
// Store a id3 tag in the ripped file
CID3Tag id3tag;
CMusicInfoTag tag;
tag.SetAlbum(m_strAlbum);
tag.SetAlbumArtist(m_strAlbumArtist);
tag.SetArtist(m_strArtist);
tag.SetGenre(m_strGenre);
tag.SetTitle(m_strTitle);
tag.SetTrackNumber(atoi(m_strTrack.c_str()));
SYSTEMTIME time;
time.wYear=atoi(m_strYear.c_str());
tag.SetReleaseDate(time);
id3tag.SetMusicInfoTag(tag);
id3tag.Write(m_strFile);
return true;
}
示例9: 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;
}
示例10: Load
bool CMusicInfoTagLoaderASAP::Load(const CStdString &strFile, CMusicInfoTag &tag, EmbeddedArt *art)
{
tag.SetLoaded(false);
if (!m_dll.Load())
return false;
CStdString strFileToLoad = strFile;
int song = -1;
CStdString strExtension;
URIUtils::GetExtension(strFile, strExtension);
strExtension.MakeLower();
if (strExtension == ".asapstream")
{
CStdString strFileName = URIUtils::GetFileName(strFile);
int iStart = strFileName.ReverseFind('-') + 1;
song = atoi(strFileName.substr(iStart, strFileName.size() - iStart - 11).c_str()) - 1;
CStdString strPath = strFile;
URIUtils::GetDirectory(strPath, strFileToLoad);
URIUtils::RemoveSlashAtEnd(strFileToLoad);
}
ASAP_SongInfo songInfo;
if (!m_dll.asapGetInfo(strFileToLoad.c_str(), song, &songInfo))
return false;
tag.SetURL(strFileToLoad);
if (songInfo.name[0] != '\0')
tag.SetTitle(songInfo.name);
if (songInfo.author[0] != '\0')
tag.SetArtist(songInfo.author);
if (song >= 0)
tag.SetTrackNumber(song + 1);
if (songInfo.duration >= 0)
tag.SetDuration(songInfo.duration / 1000);
if (songInfo.year > 0)
{
SYSTEMTIME dateTime = { (WORD)songInfo.year, (WORD)songInfo.month, 0,
(WORD)songInfo.day, 0, 0, 0, 0
};
tag.SetReleaseDate(dateTime);
}
tag.SetLoaded(true);
return true;
}
示例11: 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;
}
示例12: Load
// There is no reliable tag information in MIDI files. There is a 'title' field (@T), but it looks
// like everyone puts there song title, artist name, the name of the person who created the lyrics and
// greetings to their friends and family. Therefore we return the song title as file name, and the
// song artist as parent directory.
// A good intention of creating a pattern-based artist/song recognition engine failed greatly. Simple formats
// like %A-%T fail greatly with artists like A-HA and songs like "Ob-la-Di ob-la-Da.mid". So if anyone has
// a good idea which would include cases from above, I'd be happy to hear about it.
bool CMusicInfoTagLoaderMidi::Load(const CStdString & strFileName, CMusicInfoTag & tag, EmbeddedArt *art)
{
tag.SetURL(strFileName);
CStdString path, title;
URIUtils::Split( strFileName, path, title);
URIUtils::RemoveExtension( title );
tag.SetTitle( title );
URIUtils::RemoveSlashAtEnd(path );
if ( !path.IsEmpty() )
{
CStdString artist = URIUtils::GetFileName( path );
if ( !artist.IsEmpty() )
tag.SetArtist( artist );
}
tag.SetLoaded(true);
return true;
}
示例13: Load
bool CMusicInfoTagLoaderGYM::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
tag.SetLoaded(false);
if (!m_dll.Load())
return false;
m_dll.Init();
m_gym = m_dll.LoadGYM(strFileName.c_str());
if (!m_gym)
{
CLog::Log(LOGERROR,"MusicInfoTagLoaderGYM: failed to open GYM %s",strFileName.c_str());
return false;
}
tag.SetURL(strFileName);
tag.SetLoaded(false);
char* szTitle = (char*)m_dll.GetTitle(m_gym); // no alloc
if (szTitle)
if( strcmp(szTitle,"") )
{
tag.SetTitle(szTitle);
tag.SetLoaded(true);
}
char* szArtist = (char*)m_dll.GetArtist(m_gym); // no alloc
if (szArtist)
if( strcmp(szArtist,"") && tag.Loaded() )
tag.SetArtist(szArtist);
m_dll.FreeGYM(m_gym);
m_gym = 0;
return tag.Loaded();
}
示例14: Load
bool CMusicInfoTagLoaderAdplug::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
tag.SetLoaded(false);
if (!m_dll.Load())
return false;
m_adl = m_dll.LoadADL(strFileName.c_str());
if (!m_adl)
{
CLog::Log(LOGERROR,"MusicInfoTagLoaderAdplug: failed to open %s",strFileName.c_str());
return false;
}
tag.SetURL(strFileName);
tag.SetLoaded(false);
const char* szTitle = m_dll.GetTitle(m_adl); // no alloc
if (szTitle)
if( strcmp(szTitle,"") )
{
tag.SetTitle(szTitle);
tag.SetLoaded(true);
}
const char* szArtist = m_dll.GetArtist(m_adl); // no alloc
if( strcmp(szArtist,"") && tag.Loaded() )
tag.SetArtist(szArtist);
tag.SetDuration(m_dll.GetLength(m_adl)/1000);
m_dll.FreeADL(m_adl);
m_adl = 0;
return tag.Loaded();
}
示例15: 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;
}