本文整理汇总了C++中CMusicInfoTag::SetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::SetTitle方法的具体用法?C++ CMusicInfoTag::SetTitle怎么用?C++ CMusicInfoTag::SetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::SetTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例3: 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;
}
示例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: 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;
}
示例6: 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;
}
示例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: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: InitCurrentItem
bool CMusicGUIInfo::InitCurrentItem(CFileItem *item)
{
if (item && (item->IsAudio() || (item->IsInternetStream() && g_application.GetAppPlayer().IsPlayingAudio())))
{
CLog::Log(LOGDEBUG,"CMusicGUIInfo::InitCurrentItem(%s)", item->GetPath().c_str());
item->LoadMusicTag();
CMusicInfoTag* tag = item->GetMusicInfoTag(); // creates item if not yet set, so no nullptr checks needed
if (tag->GetTitle().empty())
{
// No title in tag, show filename only
tag->SetTitle(CUtil::GetTitleFromPath(item->GetPath()));
}
tag->SetLoaded(true);
// find a thumb for this file.
if (item->IsInternetStream())
{
if (!g_application.m_strPlayListFile.empty())
{
CLog::Log(LOGDEBUG,"Streaming media detected... using %s to find a thumb", g_application.m_strPlayListFile.c_str());
CFileItem streamingItem(g_application.m_strPlayListFile,false);
CMusicThumbLoader loader;
loader.FillThumb(streamingItem);
if (streamingItem.HasArt("thumb"))
item->SetArt("thumb", streamingItem.GetArt("thumb"));
}
}
else
{
CMusicThumbLoader loader;
loader.LoadItem(item);
}
CMusicInfoLoader::LoadAdditionalTagInfo(item);
return true;
}
return false;
}
示例14: 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;
}
示例15: 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();
}