ronantakizawa/codereview-bench huggingface dataset:
Repository: xbmc/xbmc
File: xbmc/application/ApplicationPlayer.cpp (C++)

Code before:
bool CApplicationPlayer::IsPlayingAudio() const
{
  return (IsPlaying() && !HasVideo() && HasAudio());
}

bool CApplicationPlayer::IsPlayingVideo() const
{
  return (IsPlaying() && HasVideo());
}

bool CApplicationPlayer::IsPlayingGame() const
{
  return (IsPlaying() && HasGame());
}

bool CApplicationPlayer::IsPlayingRDS() const
{
  return (IsPlaying() && HasRDS());
}

bool CApplicationPlayer::IsLiveStream() const
{
  std::shared_ptr<const IPlayer> player = GetInternal();
  const CVideoPlayer* vp = dynamic_cast<const CVideoPlayer*>(player.get());
  if (vp)
    return vp->IsLiveStream();

  return false;
}

void CApplicationPlayer::Pause()
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
  {
    player->Pause();
  }
}

void CApplicationPlayer::SetMute(bool bOnOff)
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
    player->SetMute(bOnOff);
}

void CApplicationPlayer::SetVolume(float volume)
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
    player->SetVolume(volume);

Review comment (suggestion):
As you already defined a new pure virtual function in class `IPlayer`, and have overridden it in `CVideoPlayer`, the cast is not necessary here. Could be as simple as with the other methods here.

```c++
const std::shared_ptr<const IPlayer> player = GetInternal();
if (player)
   return player->IsLiveStream();
```

Code after:
bool CApplicationPlayer::IsPlayingAudio() const
{
  return (IsPlaying() && !HasVideo() && HasAudio());
}

bool CApplicationPlayer::IsPlayingVideo() const
{
  return (IsPlaying() && HasVideo());
}

bool CApplicationPlayer::IsPlayingGame() const
{
  return (IsPlaying() && HasGame());
}

bool CApplicationPlayer::IsPlayingRDS() const
{
  return (IsPlaying() && HasRDS());
}

bool CApplicationPlayer::IsLiveStream() const
{
  std::shared_ptr<const IPlayer> player = GetInternal();
  if (player)
    return player->IsLiveStream();

  return false;
}

void CApplicationPlayer::Pause()
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
  {
    player->Pause();
  }
}

void CApplicationPlayer::SetMute(bool bOnOff)
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
    player->SetMute(bOnOff);
}

void CApplicationPlayer::SetVolume(float volume)
{
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player)
    player->SetVolume(volume);
}
Repository: xbmc/xbmc
File: xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp (C++)

Code before:

void CDialogGameVideoFilter::InitGetMoreButton()
{
  using namespace ADDON;

  CAddonMgr& addonManager = CServiceBroker::GetAddonMgr();

  // Show the "Get more" icon if add-on is disabled or missing
  bool showGetMore = false;

  if (addonManager.IsAddonInstalled(PRESETS_ADDON_NAME))
  {
    if (addonManager.IsAddonDisabled(PRESETS_ADDON_NAME))
      showGetMore = true;
  }
  else
  {
    // Check if the add-on is in a remote repo
    VECADDONS addons;
    if (addonManager.GetInstallableAddons(addons, AddonType::SHADERDLL) && !addons.empty())
      showGetMore = true;
  }

  if (showGetMore)
  {
    CFileItemPtr item = std::make_shared<CFileItem>(g_localizeStrings.Get(21452)); // "Get more..."
    item->SetArt("icon", ICON_GET_MORE);
    m_items.Add(std::move(item));
  }
}

void CDialogGameVideoFilter::GetItems(CFileItemList& items)
{
  for (const auto& item : m_items)
    items.Add(item);
}

void CDialogGameVideoFilter::OnItemFocus(unsigned int index)
{
  if (static_cast<int>(index) < m_items.Size())
  {
    m_focusedItemIndex = index;

    CFileItemPtr item = m_items[index];

    std::string videoFilter;
    GetProperties(*item, videoFilter);
    if (videoFilter.empty())
      return;

    ::CGameSettings& gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();

Review comment (suggestion):
I suggest to use `auto` here to avoid repetition of types.

Code after:
    item.SetLabel2(videoFilter.folder);
    item.SetProperty("game.videofilter", CVariant{videoFilter.path});
    item.SetArt("icon", ICON_VIDEO);

    m_items.Add(std::move(item));
  }
}

void CDialogGameVideoFilter::InitGetMoreButton()
{
  using namespace ADDON;

  CAddonMgr& addonManager = CServiceBroker::GetAddonMgr();

  // Show the "Get more" icon if add-on is disabled or missing
  bool showGetMore = false;

  if (addonManager.IsAddonInstalled(PRESETS_ADDON_NAME))
  {
    if (addonManager.IsAddonDisabled(PRESETS_ADDON_NAME))
      showGetMore = true;
  }
  else
  {
    // Check if the add-on is in a remote repo
    VECADDONS addons;
    if (addonManager.GetInstallableAddons(addons, AddonType::SHADERDLL) && !addons.empty())
      showGetMore = true;
  }

  if (showGetMore)
  {
    auto item = std::make_shared<CFileItem>(g_localizeStrings.Get(21452)); // "Get more..."
    item->SetArt("icon", ICON_GET_MORE);
    m_items.Add(std::move(item));
  }
}

void CDialogGameVideoFilter::GetItems(CFileItemList& items)
{
  for (const auto& item : m_items)
    items.Add(item);
}

void CDialogGameVideoFilter::OnItemFocus(unsigned int index)
{
  if (static_cast<int>(index) < m_items.Size())
  {
    m_focusedItemIndex = index;

    CFileItemPtr item = m_items[index];
Repository: xbmc/xbmc
File: xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp (C++)

Code before:
  ::CGameSettings& gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();

  for (int i = 0; i < m_items.Size(); i++)
  {
    std::string videoFilter;
    GetProperties(*m_items[i], videoFilter);

    if (videoFilter == gameSettings.VideoFilter())
    {
      return i;
    }
  }

  return 0;
}

void CDialogGameVideoFilter::PostExit()
{
  m_items.Clear();
}

bool CDialogGameVideoFilter::OnClickAction()
{
  if (static_cast<int>(m_focusedItemIndex) < m_items.Size())
  {
    const std::shared_ptr<CFileItem> focusedItem = m_items[m_focusedItemIndex];

    // "Get more..." button has an empty string for the video filter
    if (focusedItem && focusedItem->GetProperty("game.videofilter").empty())
    {
      OnGetMore();
      return true;
    }
  }

  Close();
  return true;
}

void CDialogGameVideoFilter::RefreshList()
{
  // Re-generate the items in case the shader preset add-on was installed
  if (m_regenerateList)
  {
    m_regenerateList = false;
    PreInit();
  }

  // Call ancestor
  CDialogGameVideoSelect::RefreshList();
}

Review comment (suggestion):
I think this could even be `const std::shared_ptr<const CFileItem>`.

Code after:
      gameSettings.NotifyObservers(ObservableMessageSettingsChanged);
    }
  }
}

unsigned int CDialogGameVideoFilter::GetFocusedItem() const
{
  ::CGameSettings& gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();

  for (int i = 0; i < m_items.Size(); i++)
  {
    std::string videoFilter;
    GetProperties(*m_items[i], videoFilter);

    if (videoFilter == gameSettings.VideoFilter())
    {
      return i;
    }
  }

  return 0;
}

void CDialogGameVideoFilter::PostExit()
{
  m_items.Clear();
}

bool CDialogGameVideoFilter::OnClickAction()
{
  if (static_cast<int>(m_focusedItemIndex) < m_items.Size())
  {
    const auto focusedItem = std::const_pointer_cast<const CFileItem>(m_items[m_focusedItemIndex]);

    // "Get more..." button has an empty string for the video filter
    if (focusedItem && focusedItem->GetProperty("game.videofilter").empty())
    {
      OnGetMore();
      return true;
    }
  }

  Close();
  return true;
}

void CDialogGameVideoFilter::RefreshList()
{
  // Re-generate the items in case the shader preset add-on was installed
  if (m_regenerateList)
  {
Repository: xbmc/xbmc
File: xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp (C++)

Code before:
        }
        else if (!addonManager.IsAddonInstalled(PRESETS_ADDON_NAME))
        {
          AddonPtr addon;
          success = CAddonInstaller::GetInstance().InstallModal(PRESETS_ADDON_NAME, addon,
                                                                InstallModalPrompt::CHOICE_NO);
        }

        if (success)
          OnGetMoreComplete();
      });
}

void CDialogGameVideoFilter::OnGetMoreComplete()
{
  CGUIComponent* gui = CServiceBroker::GetGUI();
  if (gui == nullptr)
    return;

  // Shader preset add-ons are loaded async, so wait until the new
  // add-on is fully loaded. Bail after a reasonable timeout to avoid
  // waiting indefinitely.
  XbmcThreads::EndTime<> timeout(5s);
  while (!CServiceBroker::GetGameServices().VideoShaders().HasAddons() && !timeout.IsTimePast())
  {
    // Should take on the order of 100-200ms
    KODI::TIME::Sleep(50ms);
  }

  if (timeout.IsTimePast())
    CLog::Log(LOGERROR, "Timed out waiting for shader presets to load");

  if (CServiceBroker::GetGameServices().VideoShaders().HasAddons())
  {
    // Indicate that the new presets should be loaded
    m_regenerateList = true;

    // Send the GUI message to reload the list
    CGUIMessage msg(GUI_MSG_REFRESH_LIST, GetID(), CONTROL_VIDEO_THUMBS);
    gui->GetWindowManager().SendThreadMessage(msg, GetID());
  }
}


Review comment (performance):
Reverse the terms to save some CPU cycles? `HasAddons` is  quite expensive, IIRC and no need to call if timed out.

Code after:
        {
          success = addonManager.EnableAddon(PRESETS_ADDON_NAME);
        }
        else if (!addonManager.IsAddonInstalled(PRESETS_ADDON_NAME))
        {
          AddonPtr addon;
          success = CAddonInstaller::GetInstance().InstallModal(PRESETS_ADDON_NAME, addon,
                                                                InstallModalPrompt::CHOICE_NO);
        }

        if (success)
          OnGetMoreComplete();
      });
}

void CDialogGameVideoFilter::OnGetMoreComplete()
{
  CGUIComponent* gui = CServiceBroker::GetGUI();
  if (gui == nullptr)
    return;

  // Shader preset add-ons are loaded async, so wait until the new
  // add-on is fully loaded. Bail after a reasonable timeout to avoid
  // waiting indefinitely.
  XbmcThreads::EndTime<> timeout(5s);
  while (!CServiceBroker::GetGameServices().VideoShaders().HasAddons() && !timeout.IsTimePast())
  {
    // Should take on the order of 100-200ms
    KODI::TIME::Sleep(50ms);
  }

  if (timeout.IsTimePast())
    CLog::Log(LOGERROR, "Timed out waiting for shader presets to load");

  if (CServiceBroker::GetGameServices().VideoShaders().HasAddons())
  {
    // Indicate that the new presets should be loaded
    m_regenerateList = true;

    // Send the GUI message to reload the list
    CGUIMessage msg(GUI_MSG_REFRESH_LIST, GetID(), CONTROL_VIDEO_THUMBS);
    gui->GetWindowManager().SendThreadMessage(msg, GetID());
  }
}
Repository: xbmc/xbmc
File: xbmc/filesystem/File.cpp (C++)

Code before:
          if (!pImp->Stat(newAuthUrl, buffer))
          {
            return 0;
          }
        }
      }
      else
      {
        if (pImp.get() && !pImp->Stat(authUrl, buffer))
        {
          return 0;
        }
      }
    }
  }
  catch (...) { CLog::Log(LOGERROR, "{} - Unhandled exception", __FUNCTION__); }
  CLog::Log(LOGERROR, "{} - Error statting {}", __FUNCTION__, file.GetRedacted());
  return -1;
}

bool CFile::FileExists(const std::string& path)
{
  struct __stat64 s;
  if (XFILE::CFile::Stat(path, &s) == 0)
  {
#ifdef TARGET_POSIX
    return !S_ISDIR(s.st_mode);
#else
    return !(s.st_mode & S_IFDIR);
#endif
  }
  return false;
}

ssize_t CFile::Read(void *lpBuf, size_t uiBufSize)
{
  if (!m_pFile)
    return -1;
  if (lpBuf == NULL && uiBufSize != 0)
    return -1;

  if (uiBufSize > SSIZE_MAX)
    uiBufSize = SSIZE_MAX;

  if (uiBufSize == 0)
  {
    // "test" read with zero size
    // some VFSs don't handle correctly null buffer pointer
    // provide valid buffer pointer for them
    char dummy;
    return m_pFile->Read(&dummy, 0);

Review comment (refactor):
`TARGET_POSIX` isn't allowed in generic code. It must be in a platform abstraction.

EDIT: Or removed entirely and a generic exists function should be used.

Code after:
          return 0;
        }
      }
    }
  }
  catch (...) { CLog::Log(LOGERROR, "{} - Unhandled exception", __FUNCTION__); }
  CLog::Log(LOGERROR, "{} - Error statting {}", __FUNCTION__, file.GetRedacted());
  return -1;
}

bool CFile::FileExists(const std::string& path)
{
  struct __stat64 s;
  if (XFILE::CFile::Stat(path, &s) == 0)
    return !S_ISDIR(s.st_mode);
  return false;
}

ssize_t CFile::Read(void *lpBuf, size_t uiBufSize)
{
  if (!m_pFile)
    return -1;
  if (lpBuf == NULL && uiBufSize != 0)
    return -1;

  if (uiBufSize > SSIZE_MAX)
    uiBufSize = SSIZE_MAX;

  if (uiBufSize == 0)
  {
    // "test" read with zero size
    // some VFSs don't handle correctly null buffer pointer
    // provide valid buffer pointer for them
    char dummy;
    return m_pFile->Read(&dummy, 0);
  }

  if(m_pBuffer)
  {
    if(m_flags & READ_TRUNCATED)
    {
      const ssize_t nBytes = m_pBuffer->sgetn(
        (char *)lpBuf, std::min<std::streamsize>((std::streamsize)uiBufSize,
                                                  m_pBuffer->in_avail()));
      if (m_bitStreamStats && nBytes>0)
        m_bitStreamStats->AddSampleBytes(nBytes);
      return nBytes;
    }
    else
    {
      const ssize_t nBytes = m_pBuffer->sgetn((char*)lpBuf, uiBufSize);
Repository: xbmc/xbmc
File: xbmc/interfaces/AnnouncementManager.cpp (C++)

Code before:
      std::string path;
      if (StringUtils::StartsWith(videoInfoTagPath, "removable://"))
        path = videoInfoTagPath;
      else
        path = item.GetPath();
      if (videodatabase.LoadVideoInfo(path, tag, VideoDbDetailsNone))
        id = tag.GetDatabaseId();

      videodatabase.Close();
    }
    else
    {
      CLog::LogFC(LOGWARNING, LOGANNOUNCE,
                  "Unable to open video database. Can not load video tag for announcement!");
    }
  }

  if (!tag.m_type.empty())
  {
    objItem["type"] = tag.m_type;
  }
  else
  {
    std::string type;
    type = CVideoDatabase::VideoContentTypeToString(item.GetVideoContentType());
    objItem["type"] = type;
  }

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    std::string title = tag.m_strTitle;
    if (title.empty())
      title = item.GetLabel();
    objItem["title"] = title;

    using enum VideoDbContentType;
    switch (item.GetVideoContentType())
    {
      case MOVIES:
        if (tag.HasYear())
          objItem["year"] = tag.GetYear();
        break;
      case EPISODES:
        if (tag.m_iEpisode >= 0)
          objItem["episode"] = tag.m_iEpisode;
        if (tag.m_iSeason >= 0)
          objItem["season"] = tag.m_iSeason;
        if (!tag.m_strShowTitle.empty())

Review comment (suggestion):
I think we can get rid of the temporary entirely and do:

```c++
objItem["type"] = CVideoDatabase::VideoContentTypeToString(item.GetVideoContentType());
```

Code after:
      std::string path;
      if (StringUtils::StartsWith(videoInfoTagPath, "removable://"))
        path = videoInfoTagPath;
      else
        path = item.GetPath();
      if (videodatabase.LoadVideoInfo(path, tag))
        id = tag.GetDatabaseId();

      videodatabase.Close();
    }
    else
    {
      CLog::LogFC(LOGWARNING, LOGANNOUNCE,
                  "Unable to open video database. Can not load video tag for announcement!");
    }
  }

  if (!tag.m_type.empty())
    objItem["type"] = tag.m_type;
  else
    objItem["type"] = CVideoDatabase::VideoContentTypeToString(item.GetVideoContentType());

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    std::string title = tag.m_strTitle;
    if (title.empty())
      title = item.GetLabel();
    objItem["title"] = title;

    using enum VideoDbContentType;
    switch (item.GetVideoContentType())
    {
      case MOVIES:
        if (tag.HasYear())
          objItem["year"] = tag.GetYear();
        break;
      case EPISODES:
        if (tag.m_iEpisode >= 0)
          objItem["episode"] = tag.m_iEpisode;
        if (tag.m_iSeason >= 0)
          objItem["season"] = tag.m_iSeason;
        if (!tag.m_strShowTitle.empty())
          objItem["showtitle"] = tag.m_strShowTitle;
        break;
      case MUSICVIDEOS:
        if (!tag.m_strAlbum.empty())
          objItem["album"] = tag.m_strAlbum;
        if (!tag.m_artist.empty())
Repository: xbmc/xbmc
File: xbmc/interfaces/AnnouncementManager.cpp (C++)

Code before:
  }

  if (!tag.m_type.empty())
  {
    objItem["type"] = tag.m_type;
  }
  else
  {
    std::string type;
    CVideoDatabase::VideoContentTypeToString(item.GetVideoContentType(), type);
    objItem["type"] = type;
  }

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    std::string title = tag.m_strTitle;
    if (title.empty())
      title = item.GetLabel();
    objItem["title"] = title;

    switch (item.GetVideoContentType())
    {
      case VideoDbContentType::MOVIES:
        if (tag.HasYear())
          objItem["year"] = tag.GetYear();
        break;
      case VideoDbContentType::EPISODES:
        if (tag.m_iEpisode >= 0)
          objItem["episode"] = tag.m_iEpisode;
        if (tag.m_iSeason >= 0)
          objItem["season"] = tag.m_iSeason;
        if (!tag.m_strShowTitle.empty())
          objItem["showtitle"] = tag.m_strShowTitle;
        break;
      case VideoDbContentType::MUSICVIDEOS:
        if (!tag.m_strAlbum.empty())
          objItem["album"] = tag.m_strAlbum;
        if (!tag.m_artist.empty())
          objItem["artist"] = StringUtils::Join(tag.m_artist, " / ");
        break;
      default:
        break;
    }
  }
  else
  {
    objItem["id"] = id;
  }

Review comment (suggestion):
`using enum VideoDbContentType;` + removal of `VideoDbContentType::` in the case statements increases readability a bit.

Code after:

  if (!tag.m_type.empty())
  {
    objItem["type"] = tag.m_type;
  }
  else
  {
    std::string type;
    CVideoDatabase::VideoContentTypeToString(item.GetVideoContentType(), type);
    objItem["type"] = type;
  }

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    std::string title = tag.m_strTitle;
    if (title.empty())
      title = item.GetLabel();
    objItem["title"] = title;

    using enum VideoDbContentType;
    switch (item.GetVideoContentType())
    {
      case MOVIES:
        if (tag.HasYear())
          objItem["year"] = tag.GetYear();
        break;
      case EPISODES:
        if (tag.m_iEpisode >= 0)
          objItem["episode"] = tag.m_iEpisode;
        if (tag.m_iSeason >= 0)
          objItem["season"] = tag.m_iSeason;
        if (!tag.m_strShowTitle.empty())
          objItem["showtitle"] = tag.m_strShowTitle;
        break;
      case MUSICVIDEOS:
        if (!tag.m_strAlbum.empty())
          objItem["album"] = tag.m_strAlbum;
        if (!tag.m_artist.empty())
          objItem["artist"] = StringUtils::Join(tag.m_artist, " / ");
        break;
      default:
        break;
    }
  }
  else
  {
    objItem["id"] = id;
  }
Repository: xbmc/xbmc
File: xbmc/interfaces/AnnouncementManager.cpp (C++)

Code before:

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    objItem["title"] = tag.GetTitle();
    if (objItem["title"].empty())
      objItem["title"] = item.GetLabel();

    if (tag.GetTrackNumber() > 0)
      objItem["track"] = tag.GetTrackNumber();
    if (!tag.GetAlbum().empty())
      objItem["album"] = tag.GetAlbum();
    if (!tag.GetArtist().empty())
      objItem["artist"] = tag.GetArtist();
  }
  else
  {
    objItem["id"] = id;
  }
}

CVariant CreateDataObjectFromItem(const CFileItem& item, const CVariant& data)
{
  CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;

  if (item.HasPVRChannelInfoTag())
  {
    auto copyPlayerId = data.isMember("player") && data["player"].isMember("playerid");
    CopyPVRTagInfoToObject(*item.GetPVRChannelInfoTag(), copyPlayerId, object);
  }
  else if (item.HasVideoInfoTag() && !item.HasPVRRecordingInfoTag())
  {
    CopyVideoTagInfoToObject(item, object);
  }
  else if (item.HasMusicInfoTag())
  {
    CopyMusicTagInfoToObject(item, object);
  }
  else if (VIDEO::IsVideo(item))
  {
    // video item but has no video info tag.
    object["item"]["type"] = "movie";
    object["item"]["title"] = item.GetLabel();
  }
  else if (item.HasPictureInfoTag())
  {
    object["item"]["type"] = "picture";
    object["item"]["file"] = item.GetPath();
  }

Review comment (suggestion):
Could be `const CVariant` if I read the code correctly.

Code after:
    }
  }

  if (id <= 0)
  {
    //! @todo Can be removed once this is properly handled when starting playback of a file
    item.SetProperty(LOOKUP_PROPERTY, false);

    objItem["title"] = tag.GetTitle();
    if (objItem["title"].empty())
      objItem["title"] = item.GetLabel();

    if (tag.GetTrackNumber() > 0)
      objItem["track"] = tag.GetTrackNumber();
    if (!tag.GetAlbum().empty())
      objItem["album"] = tag.GetAlbum();
    if (!tag.GetArtist().empty())
      objItem["artist"] = tag.GetArtist();
  }
  else
  {
    objItem["id"] = id;
  }
}

CVariant CreateDataObjectFromItem(CFileItem& item, const CVariant& data)
{
  CVariant object;
  if (data.isNull() || data.isObject())
    object = data;
  else
    object = CVariant::VariantTypeObject;

  if (item.HasPVRChannelInfoTag())
  {
    const bool copyPlayerId = data.isMember("player") && data["player"].isMember("playerid");
    CopyPVRTagInfoToObject(*item.GetPVRChannelInfoTag(), copyPlayerId, object);
  }
  else if (item.HasVideoInfoTag() && !item.HasPVRRecordingInfoTag())
  {
    CopyVideoTagInfoToObject(item, object);
  }
  else if (item.HasMusicInfoTag())
  {
    CopyMusicTagInfoToObject(item, object);
  }
  else if (VIDEO::IsVideo(item))
  {
    // video item but has no video info tag.
    object["item"]["type"] = "movie";
    object["item"]["title"] = item.GetLabel();