本文整理汇总了C++中CMusicInfoTag::SetReleaseDate方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::SetReleaseDate方法的具体用法?C++ CMusicInfoTag::SetReleaseDate怎么用?C++ CMusicInfoTag::SetReleaseDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::SetReleaseDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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 );
//.........这里部分代码省略.........
示例6: Load
bool CMusicInfoTagLoaderCDDA::Load(const std::string& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
#ifdef HAS_DVD_DRIVE
try
{
tag.SetURL(strFileName);
bool bResult = false;
// Get information for the inserted disc
CCdInfo* pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo == NULL)
return bResult;
// Prepare cddb
Xcddb cddb;
cddb.setCacheDir(CProfilesManager::GetInstance().GetCDDBFolder());
int iTrack = atoi(strFileName.substr(13, strFileName.size() - 13 - 5).c_str());
// duration is always available
tag.SetDuration( ( pCdInfo->GetTrackInformation(iTrack).nMins * 60 )
+ pCdInfo->GetTrackInformation(iTrack).nSecs );
// Only load cached cddb info in this tag loader, the internet database query is made in CCDDADirectory
if (pCdInfo->HasCDDBInfo() && cddb.isCDCached(pCdInfo))
{
// get cddb information
if (cddb.queryCDinfo(pCdInfo))
{
// Fill the fileitems music tag with cddb information, if available
std::string strTitle = cddb.getTrackTitle(iTrack);
if (!strTitle.empty())
{
// Tracknumber
tag.SetTrackNumber(iTrack);
// Title
tag.SetTitle(strTitle);
// Artist: Use track artist or disc artist
std::string strArtist = cddb.getTrackArtist(iTrack);
if (strArtist.empty())
cddb.getDiskArtist(strArtist);
tag.SetArtist(strArtist);
// Album
std::string strAlbum;
cddb.getDiskTitle( strAlbum );
tag.SetAlbum(strAlbum);
// Album Artist
std::string strAlbumArtist;
cddb.getDiskArtist(strAlbumArtist);
tag.SetAlbumArtist(strAlbumArtist);
// Year
SYSTEMTIME dateTime;
dateTime.wYear = atoi(cddb.getYear().c_str());
tag.SetReleaseDate( dateTime );
// Genre
tag.SetGenre( cddb.getGenre() );
tag.SetLoaded(true);
bResult = true;
}
}
}
else
{
// No cddb info, maybe we have CD-Text
trackinfo ti = pCdInfo->GetTrackInformation(iTrack);
// Fill the fileitems music tag with CD-Text information, if available
std::string strTitle = ti.cdtext[CDTEXT_TITLE];
if (!strTitle.empty())
{
// Tracknumber
tag.SetTrackNumber(iTrack);
// Title
tag.SetTitle(strTitle);
// Get info for track zero, as we may have and need CD-Text Album info
xbmc_cdtext_t discCDText = pCdInfo->GetDiscCDTextInformation();
// Artist: Use track artist or disc artist
std::string strArtist = ti.cdtext[CDTEXT_PERFORMER];
if (strArtist.empty())
strArtist = discCDText[CDTEXT_PERFORMER];
tag.SetArtist(strArtist);
// Album
std::string strAlbum;
strAlbum = discCDText[CDTEXT_TITLE];
tag.SetAlbum(strAlbum);
// Genre: use track or disc genre
std::string strGenre = ti.cdtext[CDTEXT_GENRE];
if (strGenre.empty())
//.........这里部分代码省略.........
示例7: SetTagValueString
void CMusicInfoTagLoaderWMA::SetTagValueString(const CStdString& strFrameName, const CStdString& strValue, CMusicInfoTag& tag)
{
if (strFrameName == "WM/AlbumTitle")
{
tag.SetAlbum(strValue);
}
else if (strFrameName == "WM/AlbumArtist")
{
if (tag.GetAlbumArtist().IsEmpty()) tag.SetAlbumArtist(strValue);
}
else if (strFrameName == "Author")
{
// Multiple artists are stored in multiple "Author" tags we have get them
// separatly and merge them to our system
if (tag.GetArtist().IsEmpty())
tag.SetArtist(strValue);
else
tag.SetArtist(tag.GetArtist() + g_advancedSettings.m_musicItemSeparator + strValue);
}
else if (strFrameName == "WM/TrackNumber")
{
if (tag.GetTrackNumber() <= 0) tag.SetTrackNumber(atoi(strValue.c_str()));
}
else if (strFrameName == "WM/PartOfSet")
{
tag.SetPartOfSet(atoi(strValue.c_str()));
}
//else if (strFrameName=="WM/Track") // Old Tracknumber, should not be used anymore
else if (strFrameName == "WM/Year")
{
SYSTEMTIME dateTime;
dateTime.wYear = atoi(strValue.c_str());
tag.SetReleaseDate(dateTime);
}
else if (strFrameName == "WM/Genre")
{
// Multiple genres are stared in multiple "WM/Genre" tags we have to get them
// separatly and merge them to our system
if (tag.GetGenre().IsEmpty())
tag.SetGenre(strValue);
else
tag.SetGenre(tag.GetGenre() + g_advancedSettings.m_musicItemSeparator + strValue);
}
else if (strFrameName == "WM/Lyrics")
{
tag.SetLyrics(strValue);
}
//else if (strFrameName=="WM/DRM")
//{
// // File is DRM protected
// pwszValue;
//}
//else if (strFrameName=="WM/Codec")
//{
// pwszValue;
//}
//else if (strFrameName=="WM/BeatsPerMinute")
//{
// pwszValue;
//}
//else if (strFrameName=="WM/Mood")
//{
// pwszValue;
//}
//else if (strFrameName=="WM/RadioStationName")
//{
// pwszValue;
//}
//else if (strFrameName=="WM/RadioStationOwner")
//{
// pwszValue;
//}
}
示例8: Load
//.........这里部分代码省略.........
{
char* szTitle = reg.GetReplaceString("\\1");
char* szArtist = reg.GetReplaceString("\\2");
char* szMins = NULL;
char* szSecs = NULL;
CRegExp reg2;
reg2.RegComp("(.*) \\(([0-9]*):([0-9]*)\\)");
if (reg2.RegFind(szTitle) > -1)
{
szMins = reg2.GetReplaceString("\\2");
szSecs = reg2.GetReplaceString("\\3");
char* szTemp = reg2.GetReplaceString("\\1");
free(szTitle);
szTitle = szTemp;
}
tag.SetLoaded(true);
tag.SetURL(strFileToLoad);
tag.SetTrackNumber(iTrack);
if (szMins && szSecs)
tag.SetDuration(atoi(szMins)*60+atoi(szSecs));
tag.SetTitle(szTitle);
tag.SetArtist(szArtist);
if( szTitle )
free(szTitle);
if( szArtist )
free(szArtist);
if( szMins )
free(szMins);
if( szSecs )
free(szSecs);
}
}
sprintf(temp,"%s\\%s",g_settings.GetDatabaseFolder().c_str(),"sidlist.csv"); // changeme?
std::ifstream f2(temp);
if( !f2.good() ) {
CLog::Log(LOGINFO,"MusicInfoTagLoaderSid::Load(..) unable to locate sidlist.csv");
tag.SetLoaded(false);
return( false );
}
while( !f2.eof() ) {
f2.getline(temp,8191);
CStdString strTemp(temp);
strTemp.MakeLower();
unsigned int iFind = strTemp.find(strHVSCpath);
if (iFind == string::npos)
continue;
char temp2[1024];
char temp3[1024];
strncpy(temp3,temp+iFind,strlen(strHVSCpath));
temp3[strlen(strHVSCpath)] = '\0';
sprintf(temp2,"\"%s\",\"[^\"]*\",\"[^\"]*\",\"([^\"]*)\",\"([^\"]*)\",\"([0-9]*)[^\"]*\",\"[0-9]*\",\"[0-9]*\",\"",temp3);
for (int i=0;i<iTrack-1;++i)
strcat(temp2,"[0-9]*:[0-9]* ");
strcat(temp2,"([0-9]*):([0-9]*)");
if( !reg.RegComp(temp2) )
{
CLog::Log(LOGINFO,"MusicInfoTagLoaderSid::Load(..): failed to compile regular expression");
tag.SetLoaded(false);
return( false );
}
if( reg.RegFind(temp) >= 0 ) {
char* szTitle = reg.GetReplaceString("\\1");
char* szArtist = reg.GetReplaceString("\\2");
char* szYear = reg.GetReplaceString("\\3");
char* szMins = reg.GetReplaceString("\\4");
char* szSecs = reg.GetReplaceString("\\5");
tag.SetLoaded(true);
tag.SetTrackNumber(iTrack);
if (tag.GetDuration() == 0)
tag.SetDuration(atoi(szMins)*60+atoi(szSecs));
if (tag.GetTitle() == "")
tag.SetTitle(szTitle);
if (tag.GetArtist() == "")
tag.SetArtist(szArtist);
SYSTEMTIME dateTime;
dateTime.wYear = atoi(szYear);
tag.SetReleaseDate(dateTime);
if( szTitle )
free(szTitle);
if( szArtist )
free(szArtist);
if( szYear )
free(szYear);
if( szMins )
free(szMins);
if( szSecs )
free(szSecs);
f2.close();
return( true );
}
}
f2.close();
tag.SetLoaded(false);
return( false );
}
示例9: 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 );
//.........这里部分代码省略.........