Repository: xbmc/xbmc
File: xbmc/video/VideoInfoScanner.cpp (C++)

Code before:
        return "";
    }
  }

  VideoDbContentType ContentToVideoDbType(CONTENT_TYPE content)
  {
    switch (content)
    {
      case CONTENT_MOVIES:
        return VideoDbContentType::MOVIES;
      case CONTENT_MUSICVIDEOS:
        return VideoDbContentType::MUSICVIDEOS;
      case CONTENT_TVSHOWS:
        return VideoDbContentType::EPISODES;
      default:
        return VideoDbContentType::UNKNOWN;
    }
  }

  /*! \brief Retrieve the art type for an image from the given size.
   \param width the width of the image.
   \param height the height of the image.
   \return "poster" if the aspect ratio is at most 4:5, "banner" if the aspect ratio
           is at least 1:4, "thumb" otherwise.
   */
  static std::string GetArtTypeFromSize(unsigned int width, unsigned int height)
  {
    std::string type = "thumb";
    if (width*5 < height*4)
      type = "poster";
    else if (width*1 > height*4)
      type = "banner";
    return type;
  }

  std::pair<CVideoInfoScanner::InfoType, std::unique_ptr<IVideoInfoTagLoader>> CVideoInfoScanner::
      ReadInfoTag(CFileItem& item,
                  const ADDON::ScraperPtr& scraper,
                  bool lookInFolder,
                  bool resetTag)
  {
    auto result = InfoType::NONE;
    std::unique_ptr<IVideoInfoTagLoader> loader(
        CVideoInfoTagLoaderFactory::CreateLoader(item, scraper, lookInFolder));
    if (loader)
    {
      CVideoInfoTag& infoTag = *item.GetVideoInfoTag();
      if (resetTag)
        infoTag.Reset();
      result = loader->Load(infoTag, false);


Review comment (suggestion):
Instead of flagging the moved methods `static` you should put both of them into an unnamed namespace. This is more the "modern" approach, although the effect is the same as `static`, to keep the function local to the compilation unit.

Code after:
    if (pItem->IsFolder())
      movieDetails.m_strPath = pItem->GetPath();

    std::string strTitle(movieDetails.m_strTitle);

    if (showInfo && content == ContentType::TVSHOWS)
    {
      strTitle = StringUtils::Format("{} - {}x{} - {}", showInfo->m_strTitle,
                                     movieDetails.m_iSeason, movieDetails.m_iEpisode, strTitle);
    }

    /* As HasStreamDetails() returns true for TV shows (because the scraper calls SetVideoInfoTag()
     * directly to set the duration) a better test is just to see if we have any common flag info
     * missing.  If we have already read an nfo file then this data should be populated, otherwise
     * get it from the video file */

    if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
            CSettings::SETTING_MYVIDEOS_EXTRACTFLAGS))
    {
      const auto& strmdetails = movieDetails.m_streamDetails;
      if (strmdetails.GetVideoCodec(1).empty() || strmdetails.GetVideoHeight(1) == 0 ||
          strmdetails.GetVideoWidth(1) == 0 || strmdetails.GetVideoDuration(1) == 0)

      {
        CDVDFileInfo::GetFileStreamDetails(pItem);
        CLog::Log(LOGDEBUG, "VideoInfoScanner: Extracted filestream details from video file {}",
                  CURL::GetRedacted(pItem->GetPath()));
      }
    }

    CLog::Log(LOGDEBUG, "VideoInfoScanner: Adding new item to {}:{}", TranslateContent(content), CURL::GetRedacted(pItem->GetPath()));
    long lResult = -1;

    if (content == ContentType::MOVIES)
    {
      // find local trailer first
      std::string strTrailer = UTILS::FindTrailer(*pItem);
      if (!strTrailer.empty())
        movieDetails.m_strTrailer = strTrailer;

      // Deal with 'Disc n' subdirectories
      const std::string discNum{CUtil::GetPartNumberFromPath(movieDetails.m_strFileNameAndPath)};
      if (!discNum.empty())
      {
        if (movieDetails.m_set.title.empty())
        {
          const std::string setName{m_database.GetSetByNameLike(movieDetails.m_strTitle)};
          if (!setName.empty())
          {
            // Add movie to existing set
            movieDetails.SetSet(setName);