本文整理汇总了C++中CMusicInfoTag::SetURL方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::SetURL方法的具体用法?C++ CMusicInfoTag::SetURL怎么用?C++ CMusicInfoTag::SetURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::SetURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例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: Load
bool CMusicInfoTagLoaderSHN::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
try
{
// SHN has no tag information other than the duration.
// Load our codec class
SHNCodec codec;
if (codec.Init(strFileName, 4096))
{
tag.SetURL(strFileName);
tag.SetDuration((int)((codec.m_TotalTime + 500)/ 1000));
tag.SetLoaded(false);
codec.DeInit();
return true;
}
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader ape: exception in file %s", strFileName.c_str());
}
tag.SetLoaded(false);
return false;
}
示例4: 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();
}
示例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: 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;
}
示例7: Load
bool CMusicInfoTagLoaderSHN::Load(const std::string& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
try
{
tag.SetURL(strFileName);
tag.SetDuration((long)0); //! @todo Use libavformat to calculate duration.
tag.SetLoaded(false);
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader shn: exception in file %s", strFileName.c_str());
}
tag.SetLoaded(false);
return false;
}
示例8: ParseAtom
bool CMusicInfoTagLoaderMP4::Load(const CStdString& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
try
{
// Initially we say that we've not loaded any tag information
tag.SetLoaded(false);
// Attempt to open the file..
if ( !m_file.Open( strFileName ) )
{
CLog::Log(LOGDEBUG, "Tag loader mp4: failed to open file %s", strFileName.c_str() );
return false;
}
// We've opened it, so associate the tag with the filename.
tag.SetURL(strFileName);
// Now go parse our atom data
m_isCompilation = false;
ParseAtom( 0, m_file.GetLength(), tag, art );
if (m_isCompilation)
{ // iTunes compilation flag is set - this could be a various artists file
if (tag.GetAlbumArtist().empty())
tag.SetAlbumArtist(g_localizeStrings.Get(340)); // Various Artists
}
// Close the file..
m_file.Close();
// Return to caller
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader mp4: exception in file %s", strFileName.c_str());
}
// Something must have gone wrong for us to get here, so let's report our failure to the boss..
tag.SetLoaded(false);
return false;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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();
}
示例12: 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();
}
示例13: Load
bool CMusicInfoTagLoaderWAV::Load(const CStdString& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
try
{
// WAV has no tag information other than the duration.
// Load our codec class
WAVCodec codec;
if (codec.Init(strFileName, 4096))
{
tag.SetURL(strFileName);
tag.SetDuration((int)(codec.m_TotalTime/1000));
tag.SetLoaded(false);
codec.DeInit();
return true;
}
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader wav: exception in file %s", strFileName.c_str());
}
return false;
}
示例14: 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;
}
示例15: ParseAtom
bool CMusicInfoTagLoaderMP4::Load(const CStdString& strFileName, CMusicInfoTag& tag)
{
try
{
// Initially we say that we've not loaded any tag information
tag.SetLoaded(false);
// Attempt to open the file..
if ( !m_file.Open( strFileName ) )
{
CLog::Log(LOGDEBUG, "Tag loader mp4: failed to open file %s", strFileName.c_str() );
return false;
}
// We've opened it, so associate the tag with the filename.
tag.SetURL(strFileName);
// Now go parse our atom data
m_thumbSize = false;
m_thumbData = NULL;
m_isCompilation = false;
ParseAtom( 0, m_file.GetLength(), tag );
if (m_thumbData)
{ // cache the thumb
// if we don't have an album tag, cache with the full file path so that
// other non-tagged files don't get this album image
CStdString strCoverArt;
if (!tag.GetAlbum().IsEmpty() && (!tag.GetAlbumArtist().IsEmpty() || !tag.GetArtist().IsEmpty()))
strCoverArt = CThumbnailCache::GetAlbumThumb(&tag);
else
strCoverArt = CThumbnailCache::GetMusicThumb(tag.GetURL());
if (!CUtil::ThumbExists(strCoverArt))
{
if (CPicture::CreateThumbnailFromMemory( m_thumbData, m_thumbSize, "", strCoverArt ) )
{
CUtil::ThumbCacheAdd( strCoverArt, true );
}
else
{
CLog::Log(LOGDEBUG, "%s unable to cache thumb as %s", __FUNCTION__, strCoverArt.c_str());
CUtil::ThumbCacheAdd( strCoverArt, false );
}
}
delete[] m_thumbData;
}
if (m_isCompilation)
{ // iTunes compilation flag is set - this could be a various artists file
if (tag.GetAlbumArtist().IsEmpty())
tag.SetAlbumArtist(g_localizeStrings.Get(340)); // Various Artists
}
// Close the file..
m_file.Close();
// Return to caller
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "Tag loader mp4: exception in file %s", strFileName.c_str());
}
// Something must have gone wrong for us to get here, so let's report our failure to the boss..
tag.SetLoaded(false);
return false;
}