当前位置: 首页>>代码示例>>C++>>正文


C++ CMusicInfoTag类代码示例

本文整理汇总了C++中CMusicInfoTag的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag类的具体用法?C++ CMusicInfoTag怎么用?C++ CMusicInfoTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CMusicInfoTag类的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();
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: SetGenre

void CTagLoaderTagLib::SetGenre(CMusicInfoTag &tag, const vector<string> &values)
{
  if (values.size() == 1)
    tag.SetGenre(values[0]);
  else
    tag.SetGenre(values);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: AddArtistRole

void CTagLoaderTagLib::AddArtistRole(CMusicInfoTag &tag, const std::string& strRole, const std::vector<std::string> &values)
{
  if (values.size() == 1)
    tag.AddArtistRole(strRole, values[0]);
  else
    tag.AddArtistRole(strRole, values);
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:7,代码来源:TagLoaderTagLib.cpp

示例4: path

bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem)
{
  if (!pItem || pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsNFO() || pItem->IsInternetStream())
    return false;

  if (pItem->GetPropertyBOOL("hasfullmusictag"))
    return false; // already have the information

  CStdString path(pItem->m_strPath);
  if (pItem->IsMusicDb())
    path = pItem->GetMusicInfoTag()->GetURL();

  CLog::Log(LOGDEBUG, "Loading additional tag info for file %s", path.c_str());

  // we load up the actual tag for this file
  CMusicInfoTag tag;
  auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(path));
  if (NULL != pLoader.get())
  {
    pLoader->Load(path, tag);
    // then we set the fields from the file tags to the item
    pItem->SetProperty("lyrics", tag.GetLyrics());
    pItem->SetProperty("hasfullmusictag", true);
    return true;
  }
  return false;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:27,代码来源:MusicInfoLoader.cpp

示例5: 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;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:26,代码来源:TagLoaderTagLib.cpp

示例6: SetAlbumArtistHints

void CTagLoaderTagLib::SetAlbumArtistHints(CMusicInfoTag &tag, const std::vector<std::string> &values)
{
  if (values.size() == 1)
    tag.SetMusicBrainzAlbumArtistHints(StringUtils::Split(values[0], g_advancedSettings.m_musicItemSeparator));
  else
    tag.SetMusicBrainzAlbumArtistHints(values);
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:7,代码来源:TagLoaderTagLib.cpp

示例7: Unban

bool CLastFmManager::Unban(const CMusicInfoTag& musicinfotag, bool askConfirmation /*= true*/)
{
  if (!IsLastFmEnabled())
  {
    CLog::Log(LOGERROR, "LastFmManager Unban, lasfm is not enabled");
    return false;
  }

  CStdString strTitle = musicinfotag.GetTitle();
  CStdString strArtist = musicinfotag.GetArtist();

  if (strArtist.IsEmpty())
  {
    CLog::Log(LOGERROR, "Last.fm Unban no artistname provided.");
    return false;
  }
  if (strTitle.IsEmpty())
  {
    CLog::Log(LOGERROR, "Last.fm Unban no tracktitle provided.");
    return false;
  }

  CStdString strInfo;
  strInfo.Format("%s - %s", strArtist, strTitle);
  if (!askConfirmation || CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(15200), g_localizeStrings.Get(15298), strInfo, ""))
  {
    return CallXmlRpc("unBanTrack", strArtist, strTitle);
  }
  return false;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例8: 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;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:25,代码来源:MusicInfoTagLoaderShn.cpp

示例9: SetTagValueUnsigned

void CMusicInfoTagLoaderWMA::SetTagValueUnsigned(const CStdString& strFrameName, uint32_t value, CMusicInfoTag& tag)
{
  if (strFrameName == "WM/TrackNumber")
  {
    if (tag.GetTrackNumber() <= 0)
      tag.SetTrackNumber(value);
  }
}
开发者ID:AaronDnz,项目名称:xbmc,代码行数:8,代码来源:MusicInfoTagLoaderWMA.cpp

示例10: pLoader

int CMusicInfoScanner::GetSongDuration(const CStdString& strFullFileName) {
    CMusicInfoTag tag;
    auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(strFullFileName));
    if (pLoader.get() == NULL) return 0;

    pLoader->Load(strFullFileName, tag);
    return tag.GetDuration();
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例11: SetAlbumArtist

void CTagLoaderTagLib::SetAlbumArtist(CMusicInfoTag &tag, const std::vector<std::string> &values)
{
  if (values.size() == 1)
    tag.SetAlbumArtist(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.SetAlbumArtist(values, true);
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:9,代码来源:TagLoaderTagLib.cpp

示例12: Unlove

bool CLastFmManager::Unlove(const CMusicInfoTag& musicinfotag, bool askConfirmation /*= true*/)
{
  if (!IsLastFmEnabled())
  {
    CLog::Log(LOGERROR, "LastFmManager Unlove, lasfm is not enabled");
    return false;
  }

  CStdString strTitle = musicinfotag.GetTitle();
  CStdString strArtist = StringUtils::Join(musicinfotag.GetArtist(), g_advancedSettings.m_musicItemSeparator);

  if (strArtist.IsEmpty())
  {
    CLog::Log(LOGERROR, "Last.fm Unlove no artistname provided.");
    return false;
  }
  if (strTitle.IsEmpty())
  {
    CLog::Log(LOGERROR, "Last.fm Unlove no tracktitle provided.");
    return false;
  }

  CStdString strInfo;
  strInfo.Format("%s - %s", strArtist, strTitle);
  if (!askConfirmation || CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(15200), g_localizeStrings.Get(15297), strInfo, ""))
  {
    if (CallXmlRpc("unLoveTrack", strArtist, strTitle))
    {
      //update our local rating, now this is tricky because we only have an artist and title
      //and don't know if it was a local or radio song.
      //So we're going to try to get it from the database and check if the rating is 5,
      //if it is we can assume this was the song we loved before.
      CMusicDatabase musicdatabase;
      if (musicdatabase.Open())
      {
        long songid = musicdatabase.GetSongByArtistAndAlbumAndTitle(strArtist, "%", strTitle);
        if (songid > 0)
        {
          CSong song;
          musicdatabase.GetSongById(songid, song);
          if (song.rating == '5')
          {
            //reset the rating
            musicdatabase.SetSongRating(song.strFileName, '0');
          }
        }
        musicdatabase.Close();
      }

      return true;
    }
  }
  return false;
}
开发者ID:SunSeosahai,项目名称:xbmc,代码行数:54,代码来源:LastFmManager.cpp

示例13: 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();
}
开发者ID:AWilco,项目名称:xbmc,代码行数:33,代码来源:MusicInfoTagLoaderNSF.cpp

示例14: GetDefaultMusicShareText

bool CGUIDialogBoxeeShare::GetDefaultMusicShareText(CStdString& defaultMusicShareText)
{
  CMusicInfoTag* musicInfoTag = m_item.GetMusicInfoTag();

  if (!musicInfoTag || musicInfoTag->GetAlbum().IsEmpty() || musicInfoTag->GetArtist().IsEmpty())
  {
    return false;
  }

  defaultMusicShareText += musicInfoTag->GetAlbum();
  defaultMusicShareText += " by ";
  defaultMusicShareText += musicInfoTag->GetArtist();

  return true;
}
开发者ID:marksuman,项目名称:boxee,代码行数:15,代码来源:GUIDialogBoxeeShare.cpp

示例15: 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();
}
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:53,代码来源:MusicInfoTagLoaderMod.cpp


注:本文中的CMusicInfoTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。