Repository: xbmc/xbmc
File: xbmc/NfoFile.cpp (C++)

Code before:
   *
   * | result   | Could be converted to:     |
   * | -------- | -------------------------- |
   * | NONE     | URL NONE                   |
   * | OVERRIDE | COMBINED OVERRIDE          |
   * | FULL     | COMBINED OVERRIDE FULL     |
   *
   * The following call to `searchNfoForScraperUrls` will generate the
   * desired result from this approximation.
   *
   * This call is expensive as it encodes the NFO file into a URL param
   * and executes a python interpreter for each installed python scraper.
  */
  auto result = TryParsing(CURL{nfoPath}, info->Content(), index);
  if (result == CInfoScanner::InfoType::ERROR_NFO)
    return CInfoScanner::InfoType::NONE;
  return searchNfoForScraperUrls(result, info);
}

CInfoScanner::InfoType CNfoFile::searchNfoForScraperUrls(CInfoScanner::InfoType parseResult,
                                                         const ScraperPtr& info)
{
  using enum CInfoScanner::InfoType;

  SetScraperInfo(info); // assume we can use these settings
  auto addonType = ScraperTypeFromContent(info->Content());

  for (const auto& scraper : GetScrapers(addonType, info))
  {
    if (scraper->IsNoop())
    {
      m_scurl = CScraperUrl();
      break;
    }

    scraper->ClearCache();
    try
    {
      m_scurl = scraper->NfoUrl(m_doc);
    }
    catch (const CScraperError& sce)
    {
      CVideoInfoDownloader::ShowErrorDialog(sce);
      if (!sce.FAborted())
        return ERROR_NFO;
    }

    if (m_scurl.HasUrls())
      return (parseResult == FULL || parseResult == OVERRIDE) ? COMBINED : URL;
  }


Review comment (suggestion):
`const auto` or even better, because increased readability, use the real type instead of `auto`.

Code after:
   *
   * | result   | Could be converted to:     |
   * | -------- | -------------------------- |
   * | NONE     | URL NONE                   |
   * | OVERRIDE | COMBINED OVERRIDE          |
   * | FULL     | COMBINED OVERRIDE FULL     |
   *
   * The following call to `SearchNfoForScraperUrls` will generate the
   * desired result from this approximation.
   *
   * This call is expensive as it encodes the NFO file into a URL param
   * and executes a python interpreter for each installed python scraper.
  */
  const CInfoScanner::InfoType result = TryParsing(CURL{nfoPath}, info->Content(), index);
  if (result == CInfoScanner::InfoType::ERROR_NFO)
    return CInfoScanner::InfoType::NONE;
  return SearchNfoForScraperUrls(result, info);
}

CInfoScanner::InfoType CNfoFile::SearchNfoForScraperUrls(CInfoScanner::InfoType parseResult,
                                                         const ScraperPtr& info)
{
  using enum CInfoScanner::InfoType;

  SetScraperInfo(info); // assume we can use these settings
  const AddonType addonType = ScraperTypeFromContent(info->Content());

  for (const auto& scraper : GetScrapers(addonType, info))
  {
    if (scraper->IsNoop())
    {
      m_scurl = CScraperUrl();
      break;
    }

    scraper->ClearCache();
    try
    {
      m_scurl = scraper->NfoUrl(m_doc);
    }
    catch (const CScraperError& sce)
    {
      CVideoInfoDownloader::ShowErrorDialog(sce);
      if (!sce.FAborted())
        return ERROR_NFO;
    }

    if (m_scurl.HasUrls())
      return (parseResult == FULL || parseResult == OVERRIDE) ? COMBINED : URL;
  }