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


C++ CMusicInfoScanner::UpdateDatabaseAlbumInfo方法代码示例

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


在下文中一共展示了CMusicInfoScanner::UpdateDatabaseAlbumInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowAlbumInfo

bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
{
  CQueryParams params;
  CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);

  ADDON::ScraperPtr scraper;
  if (!m_musicdatabase.GetScraperForPath(pItem->GetPath(), scraper, ADDON::ADDON_SCRAPER_ALBUMS))
    return false;

  CAlbum album;
  if (!m_musicdatabase.GetAlbum(params.GetAlbumId(), album))
    return false;
  album.bScrapedMBID = m_musicdatabase.HasScrapedAlbumMBID(album.idAlbum);
  m_musicdatabase.GetAlbumPath(params.GetAlbumId(), album.strPath);
  bool refresh = false;
  while (1)
  {
    // Check if the entry should be refreshed (Only happens if a user pressed refresh)
    if (refresh)
    {
      if (!CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
      {
        //! @todo should display a dialog saying no permissions
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }

      if (g_application.IsMusicScanning())
      {
        CGUIDialogOK::ShowAndGetInput(CVariant{189}, CVariant{14057});
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }

      // show dialog box indicating we're searching the album
      if (m_dlgProgress && bShowInfo)
      {
        m_dlgProgress->SetHeading(CVariant{185});
        m_dlgProgress->SetLine(0, CVariant{pItem->GetMusicInfoTag()->GetAlbum()});
        m_dlgProgress->SetLine(1, CVariant{pItem->GetMusicInfoTag()->GetAlbumArtistString()});
        m_dlgProgress->SetLine(2, CVariant{""});
        m_dlgProgress->Open();
      }

      CMusicInfoScanner scanner;
      if (scanner.UpdateDatabaseAlbumInfo(album, scraper, bShowInfo, m_dlgProgress) != INFO_ADDED)
      {
        CGUIDialogOK::ShowAndGetInput(CVariant{185}, CVariant{500});
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }
    }

    if (m_dlgProgress)
      m_dlgProgress->Close();

    CGUIDialogMusicInfo *pDlgAlbumInfo = g_windowManager.GetWindow<CGUIDialogMusicInfo>(WINDOW_DIALOG_MUSIC_INFO);
    if (pDlgAlbumInfo)
    {
      pDlgAlbumInfo->SetAlbum(album, album.strPath);
      pDlgAlbumInfo->Open();

      if (pDlgAlbumInfo->NeedRefresh())
      {
        m_musicdatabase.ClearAlbumLastScrapedTime(params.GetAlbumId());
        refresh = true;
        continue;
      }
      else if (pDlgAlbumInfo->HasUpdatedThumb())
        UpdateThumb(album, album.strPath);
      else if (pDlgAlbumInfo->NeedsUpdate())
        Refresh(true); // update our file list

    }
    break;
  }
  if (m_dlgProgress)
    m_dlgProgress->Close();
  return true;
}
开发者ID:Razzeee,项目名称:xbmc,代码行数:83,代码来源:GUIWindowMusicBase.cpp

示例2: ShowAlbumInfo

bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
{
    CQueryParams params;
    CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);

    ADDON::ScraperPtr scraper;
    if (!m_musicdatabase.GetScraperForPath(pItem->GetPath(), scraper, ADDON::ADDON_SCRAPER_ALBUMS))
        return false;

    CAlbum album;
    if (!m_musicdatabase.GetAlbum(params.GetAlbumId(), album))
        return false;

    m_musicdatabase.GetAlbumPath(params.GetAlbumId(), album.strPath);
    while (1)
    {
        if (!m_musicdatabase.HasAlbumBeenScraped(params.GetAlbumId()))
        {
            if (!CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
            {
                // TODO: should display a dialog saying no permissions
                if (m_dlgProgress)
                    m_dlgProgress->Close();
                return false;
            }

            if (g_application.IsMusicScanning())
            {
                CGUIDialogOK::ShowAndGetInput(CVariant{189}, CVariant{14057});
                if (m_dlgProgress)
                    m_dlgProgress->Close();
                return false;
            }

            // show dialog box indicating we're searching the album
            if (m_dlgProgress && bShowInfo)
            {
                m_dlgProgress->SetHeading(CVariant{185});
                m_dlgProgress->SetLine(0, CVariant{pItem->GetMusicInfoTag()->GetAlbum()});
                m_dlgProgress->SetLine(1, CVariant{StringUtils::Join(pItem->GetMusicInfoTag()->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator)});
                m_dlgProgress->SetLine(2, CVariant{""});
                m_dlgProgress->Open();
            }

            CMusicInfoScanner scanner;
            if (scanner.UpdateDatabaseAlbumInfo(album, scraper, bShowInfo, m_dlgProgress) != INFO_ADDED)
            {
                CGUIDialogOK::ShowAndGetInput(CVariant{185}, CVariant{500});
                if (m_dlgProgress)
                    m_dlgProgress->Close();
                return false;
            }
        }

        if (m_dlgProgress)
            m_dlgProgress->Close();

        CGUIDialogMusicInfo *pDlgAlbumInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
        if (pDlgAlbumInfo)
        {
            pDlgAlbumInfo->SetAlbum(album, album.strPath);
            pDlgAlbumInfo->Open();

            if (pDlgAlbumInfo->NeedRefresh())
            {
                m_musicdatabase.ClearAlbumLastScrapedTime(params.GetAlbumId());
                continue;
            }
            else if (pDlgAlbumInfo->HasUpdatedThumb())
            {
                UpdateThumb(album, album.strPath);
            }
        }
        break;
    }
    if (m_dlgProgress)
        m_dlgProgress->Close();
    return true;
}
开发者ID:nihalsunthankar,项目名称:xbmc,代码行数:79,代码来源:GUIWindowMusicBase.cpp

示例3: ShowAlbumInfo

bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo /* = true */)
{
  CQueryParams params;
  CDirectoryNode::GetDatabaseInfo(pItem->GetPath(), params);
  CMusicAlbumInfo albumInfo;
  while (1)
  {
    if (!m_musicdatabase.HasAlbumInfo(params.GetAlbumId()) || 
        !m_musicdatabase.GetAlbumInfo(params.GetAlbumId(), albumInfo.GetAlbum(), &albumInfo.GetAlbum().songs))
    {
      if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser)
      {
        // TODO: should display a dialog saying no permissions
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }

      if (g_application.IsMusicScanning())
      {
        CGUIDialogOK::ShowAndGetInput(189, 14057, 0, 0);
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }

      // show dialog box indicating we're searching the album
      if (m_dlgProgress && bShowInfo)
      {
        m_dlgProgress->SetHeading(185);
        m_dlgProgress->SetLine(0, pItem->GetMusicInfoTag()->GetAlbum());
        m_dlgProgress->SetLine(1, StringUtils::Join(pItem->GetMusicInfoTag()->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator));
        m_dlgProgress->SetLine(2, "");
        m_dlgProgress->StartModal();
      }

      CMusicInfoScanner scanner;
      if (scanner.UpdateDatabaseAlbumInfo(pItem->GetPath(), albumInfo, bShowInfo) != INFO_ADDED || !albumInfo.Loaded())
      {
        CGUIDialogOK::ShowAndGetInput(185, 0, 500, 0);
        if (m_dlgProgress)
          m_dlgProgress->Close();
        return false;
      }
    }

    if (m_dlgProgress)
      m_dlgProgress->Close();

    CGUIDialogMusicInfo *pDlgAlbumInfo = (CGUIDialogMusicInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_INFO);
    if (pDlgAlbumInfo)
    {
      CStdString strPath;
      m_musicdatabase.GetAlbumPath(params.GetAlbumId(), strPath);
      pDlgAlbumInfo->SetAlbum(albumInfo.GetAlbum(), strPath);
      pDlgAlbumInfo->DoModal();

      if (pDlgAlbumInfo->NeedRefresh())
      {
        m_musicdatabase.DeleteAlbumInfo(params.GetAlbumId());
        continue;
      }
      else if (pDlgAlbumInfo->HasUpdatedThumb())
      {
        UpdateThumb(albumInfo.GetAlbum(), strPath);
      }
    }
    break;
  }
  if (m_dlgProgress)
    m_dlgProgress->Close();
  return true;
}
开发者ID:Inferno1977,项目名称:xbmc,代码行数:73,代码来源:GUIWindowMusicBase.cpp


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