void CEdenVideoArtUpdater::Process()
{
  // grab all movies...
  CVideoDatabase db;
  if (!db.Open())
    return;

  CFileItemList items;

  CGUIDialogExtendedProgressBar* dialog =
    (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);

  CGUIDialogProgressBarHandle *handle = dialog->GetHandle(g_localizeStrings.Get(314));
  handle->SetTitle(g_localizeStrings.Get(12349));

  // movies
  db.GetMoviesByWhere("videodb://movies/titles/", CDatabase::Filter(), items);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr item = items[i];
    handle->SetProgress(i, items.Size());
    handle->SetText(StringUtils::Format(g_localizeStrings.Get(12350).c_str(), item->GetLabel().c_str()));
    string cachedThumb = GetCachedVideoThumb(*item);
    string cachedFanart = GetCachedFanart(*item);

    item->SetPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
    item->GetVideoInfoTag()->m_fanart.Unpack();
    item->GetVideoInfoTag()->m_strPictureURL.Parse();

    map<string, string> artwork;
    if (!db.GetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork)
        || (artwork.size() == 1 && artwork.find("thumb") != artwork.end()))
    {
      CStdString art = CVideoInfoScanner::GetImage(item.get(), true, item->GetVideoInfoTag()->m_basePath != item->GetPath(), "thumb");
      std::string type;
      if (CacheTexture(art, cachedThumb, item->GetLabel(), type))
        artwork.insert(make_pair(type, art));

      art = CVideoInfoScanner::GetFanart(item.get(), true);
      if (CacheTexture(art, cachedFanart, item->GetLabel()))
        artwork.insert(make_pair("fanart", art));

      if (artwork.empty())
        artwork.insert(make_pair("thumb", ""));
      db.SetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork);
    }
  }
  items.Clear();

  // music videos
  db.GetMusicVideosNav("videodb://musicvideos/titles/", items, false);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr item = items[i];
    handle->SetProgress(i, items.Size());
    handle->SetText(StringUtils::Format(g_localizeStrings.Get(12350).c_str(), item->GetLabel().c_str()));
    string cachedThumb = GetCachedVideoThumb(*item);
    string cachedFanart = GetCachedFanart(*item);

    item->SetPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
    item->GetVideoInfoTag()->m_fanart.Unpack();
    item->GetVideoInfoTag()->m_strPictureURL.Parse();

    map<string, string> artwork;
    if (!db.GetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork)
        || (artwork.size() == 1 && artwork.find("thumb") != artwork.end()))
    {
      CStdString art = CVideoInfoScanner::GetImage(item.get(), true, item->GetVideoInfoTag()->m_basePath != item->GetPath(), "thumb");
      std::string type;
      if (CacheTexture(art, cachedThumb, item->GetLabel(), type))
        artwork.insert(make_pair(type, art));

      art = CVideoInfoScanner::GetFanart(item.get(), true);
      if (CacheTexture(art, cachedFanart, item->GetLabel()))
        artwork.insert(make_pair("fanart", art));

      if (artwork.empty())
        artwork.insert(make_pair("thumb", ""));
      db.SetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork);
    }
  }
  items.Clear();

  // tvshows
  // count the number of episodes
  db.GetTvShowsNav("videodb://tvshows/titles/", items);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr item = items[i];
    handle->SetText(StringUtils::Format(g_localizeStrings.Get(12350).c_str(), item->GetLabel().c_str()));
    string cachedThumb = GetCachedVideoThumb(*item);
    string cachedFanart = GetCachedFanart(*item);

    item->SetPath(item->GetVideoInfoTag()->m_strPath);
    item->GetVideoInfoTag()->m_fanart.Unpack();
    item->GetVideoInfoTag()->m_strPictureURL.Parse();

    map<string, string> artwork;
    if (!db.GetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork)
        || (artwork.size() == 1 && artwork.find("thumb") != artwork.end()))
    {
      CStdString art = CVideoInfoScanner::GetImage(item.get(), true, false, "thumb");
      std::string type;
      if (CacheTexture(art, cachedThumb, item->GetLabel(), type))
        artwork.insert(make_pair(type, art));

      art = CVideoInfoScanner::GetFanart(item.get(), true);
      if (CacheTexture(art, cachedFanart, item->GetLabel()))
        artwork.insert(make_pair("fanart", art));

      if (artwork.empty())
        artwork.insert(make_pair("thumb", ""));
      db.SetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork);
    }

    // now season art...
    map<int, map<string, string> > seasons;
    vector<string> artTypes; artTypes.push_back("thumb");
    CVideoInfoScanner::GetSeasonThumbs(*item->GetVideoInfoTag(), seasons, artTypes, true);
    for (map<int, map<string, string> >::const_iterator j = seasons.begin(); j != seasons.end(); ++j)
    {
      if (j->second.empty())
        continue;
      int idSeason = db.AddSeason(item->GetVideoInfoTag()->m_iDbId, j->first);
      map<string, string> seasonArt;
      if (idSeason > -1 && !db.GetArtForItem(idSeason, MediaTypeSeason, seasonArt))
      {
        std::string cachedSeason = GetCachedSeasonThumb(j->first, item->GetVideoInfoTag()->m_strPath);
        std::string type;
        std::string originalUrl = j->second.begin()->second;
        if (CacheTexture(originalUrl, cachedSeason, "", type))
          db.SetArtForItem(idSeason, MediaTypeSeason, type, originalUrl);
      }
    }

    // now episodes...
    CFileItemList items2;
    db.GetEpisodesByWhere("videodb://tvshows/titles/-1/-1/", db.PrepareSQL("episode_view.idShow=%d", item->GetVideoInfoTag()->m_iDbId), items2);
    for (int j = 0; j < items2.Size(); j++)
    {
      handle->SetProgress(j, items2.Size());
      CFileItemPtr episode = items2[j];
      string cachedThumb = GetCachedEpisodeThumb(*episode);
      if (!CFile::Exists(cachedThumb))
        cachedThumb = GetCachedVideoThumb(*episode);
      episode->SetPath(episode->GetVideoInfoTag()->m_strFileNameAndPath);
      episode->GetVideoInfoTag()->m_strPictureURL.Parse();

      map<string, string> artwork;
      if (!db.GetArtForItem(episode->GetVideoInfoTag()->m_iDbId, episode->GetVideoInfoTag()->m_type, artwork)
          || (artwork.size() == 1 && artwork.find("thumb") != artwork.end()))
      {
        CStdString art = CVideoInfoScanner::GetImage(episode.get(), true, episode->GetVideoInfoTag()->m_basePath != episode->GetPath(), "thumb");
        if (CacheTexture(art, cachedThumb, episode->GetLabel()))
          artwork.insert(make_pair("thumb", art));
        else
          artwork.insert(make_pair("thumb", ""));
        db.SetArtForItem(episode->GetVideoInfoTag()->m_iDbId, episode->GetVideoInfoTag()->m_type, artwork);
      }
    }
  }
  items.Clear();

  // now sets
  db.GetSetsNav("videodb://movies/sets/", items, VIDEODB_CONTENT_MOVIES);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr item = items[i];
    handle->SetProgress(i, items.Size());
    handle->SetText(StringUtils::Format(g_localizeStrings.Get(12350).c_str(), item->GetLabel().c_str()));
    map<string, string> artwork;
    if (!db.GetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork))
    { // grab the first movie from this set
      CFileItemList items2;
      db.GetMoviesNav("videodb://movies/titles/", items2, -1, -1, -1, -1, -1, -1, item->GetVideoInfoTag()->m_iDbId);
      if (items2.Size() > 1)
      {
        if (db.GetArtForItem(items2[0]->GetVideoInfoTag()->m_iDbId, items2[0]->GetVideoInfoTag()->m_type, artwork))
          db.SetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork);
      }
    }
  }
  items.Clear();

  // now actors
  if (CSettings::Get().GetBool("videolibrary.actorthumbs"))
  {
    db.GetActorsNav("videodb://movies/titles/", items, VIDEODB_CONTENT_MOVIES);
    db.GetActorsNav("videodb://tvshows/titles/", items, VIDEODB_CONTENT_TVSHOWS);
    db.GetActorsNav("videodb://tvshows/titles/", items, VIDEODB_CONTENT_EPISODES);
    db.GetActorsNav("videodb://musicvideos/titles/", items, VIDEODB_CONTENT_MUSICVIDEOS);
    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr item = items[i];
      handle->SetProgress(i, items.Size());
      handle->SetText(StringUtils::Format(g_localizeStrings.Get(12350).c_str(), item->GetLabel().c_str()));
      map<string, string> artwork;
      if (!db.GetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork))
      {
        item->GetVideoInfoTag()->m_strPictureURL.Parse();
        string cachedThumb = GetCachedActorThumb(*item);

        string art = CScraperUrl::GetThumbURL(item->GetVideoInfoTag()->m_strPictureURL.GetFirstThumb());
        if (CacheTexture(art, cachedThumb, item->GetLabel()))
          artwork.insert(make_pair("thumb", art));
        else
          artwork.insert(make_pair("thumb", ""));
        db.SetArtForItem(item->GetVideoInfoTag()->m_iDbId, item->GetVideoInfoTag()->m_type, artwork);
      }
    }
  }
  handle->MarkFinished();

  ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanFinished");

  items.Clear();
}