Exemple #1
0
bool CMediaSourceSettings::SetSources(TiXmlNode *root, const char *section, const VECSOURCES &shares, const std::string &defaultPath) const
{
  TiXmlElement sectionElement(section);
  TiXmlNode *sectionNode = root->InsertEndChild(sectionElement);
  if (sectionNode == NULL)
    return false;

  XMLUtils::SetPath(sectionNode, "default", defaultPath);
  for (CIVECSOURCES it = shares.begin(); it != shares.end(); it++)
  {
    const CMediaSource &share = *it;
    if (share.m_ignore)
      continue;

    TiXmlElement source(XML_SOURCE);
    XMLUtils::SetString(&source, "name", share.strName);

    for (unsigned int i = 0; i < share.vecPaths.size(); i++)
      XMLUtils::SetPath(&source, "path", share.vecPaths[i]);

    if (share.m_iHasLock)
    {
      XMLUtils::SetInt(&source, "lockmode", share.m_iLockMode);
      XMLUtils::SetString(&source, "lockcode", share.m_strLockCode);
      XMLUtils::SetInt(&source, "badpwdcount", share.m_iBadPwdCount);
    }
    if (!share.m_strThumbnailImage.empty())
      XMLUtils::SetPath(&source, "thumbnail", share.m_strThumbnailImage);

    sectionNode->InsertEndChild(source);
  }

  return true;
}
Exemple #2
0
void CFileScanner::InitSourcesOnStart()
{
  VECSOURCES sources = *(g_settings.GetSourcesFromType("all"));

  CMediaSource* pShare = NULL;
  for (IVECSOURCES it = sources.begin(); it != sources.end(); it++)
  {
    pShare = &(*it);
    time_t iLastScanned;
    if (!BOXEE::Boxee::GetInstance().GetMetadataEngine().GetScanTime(pShare->strName, pShare->strPath, pShare->m_type, iLastScanned))
    {
      CLog::Log(LOGWARNING,"CFileScanner::InitSourcesOnStart - FAILED to read LastScanTime of [name=%s][path=%s][type=%d]. [m_bPaused=%d][m_bStop=%d] (fs)",pShare->strName.c_str(),pShare->strPath.c_str(),pShare->m_iScanType,m_bPaused,m_bStop);
      continue;
    }

    if (iLastScanned == SHARE_TIMESTAMP_RESOLVING)
    {
      CLog::Log(LOGDEBUG,"CFileScanner::InitSourcesOnStart - for [name=%s][path=%s][type=%d] LastScanTime is [%lu=RESOLVING] going to reset it. [m_bPaused=%d][m_bStop=%d] (fs)",pShare->strName.c_str(),pShare->strPath.c_str(),pShare->m_iScanType,iLastScanned,m_bPaused,m_bStop);

      if (!BOXEE::Boxee::GetInstance().GetMetadataEngine().UpdateScanTime(pShare->strName, pShare->strPath, pShare->m_type, SHARE_TIMESTAMP_NOT_SCANNED))
      {
        CLog::Log(LOGERROR,"CFileScanner::InitSourcesOnStart - FAILED to reset iLastScanned of source [name=%s][path=%s][type=%d]. [m_bPaused=%d][m_bStop=%d] (fs)",pShare->strName.c_str(),pShare->strPath.c_str(),pShare->m_iScanType,m_bPaused,m_bStop);
      }
    }
  }
}
// NOTE: This function does NOT save the sources.xml file - you need to call SaveSources() separately.
bool CMediaSourceSettings::UpdateSource(const std::string &strType, const std::string &strOldName, const std::string &strUpdateChild, const std::string &strUpdateValue)
{
  VECSOURCES *pShares = GetSources(strType);
  if (pShares == NULL)
    return false;

  for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++)
  {
    if (it->strName == strOldName)
    {
      if (strUpdateChild == "name")
        it->strName = strUpdateValue;
      else if (strUpdateChild == "lockmode")
        it->m_iLockMode = (LockType)std::strtol(strUpdateValue.c_str(), NULL, 10);
      else if (strUpdateChild == "lockcode")
        it->m_strLockCode = strUpdateValue;
      else if (strUpdateChild == "badpwdcount")
        it->m_iBadPwdCount = (int)std::strtol(strUpdateValue.c_str(), NULL, 10);
      else if (strUpdateChild == "thumbnail")
        it->m_strThumbnailImage = strUpdateValue;
      else if (strUpdateChild == "path")
      {
        it->vecPaths.clear();
        it->strPath = strUpdateValue;
        it->vecPaths.push_back(strUpdateValue);
      }
      else
        return false;

      return true;
    }
  }

  return false;
}
bool CMediaSourceSettings::UpdateShare(const std::string &type, const std::string &oldName, const CMediaSource &share)
{
  VECSOURCES *pShares = GetSources(type);
  if (pShares == NULL)
    return false;

  // update our current share list
  CMediaSource* pShare = NULL;
  for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++)
  {
    if (it->strName == oldName)
    {
      it->strName = share.strName;
      it->strPath = share.strPath;
      it->vecPaths = share.vecPaths;
      pShare = &(*it);
      break;
    }
  }

  if (pShare == NULL)
    return false;

  // Update our XML file as well
  return Save();
}
Exemple #5
0
void CGUIPassword::LockSources(bool lock)
{
  // lock or unlock all sources (those with locks)
  const char* strType[] = {"programs", "music", "video", "pictures", "files", "games"};
  for (unsigned int i = 0; i < sizeof(strType) / sizeof(*strType); ++i)
  {
    VECSOURCES *shares = CMediaSourceSettings::GetInstance().GetSources(strType[i]);
    for (IVECSOURCES it=shares->begin();it != shares->end();++it)
      if (it->m_iLockMode != LOCK_MODE_EVERYONE)
        it->m_iHasLock = lock ? 2 : 1;
  }
  CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
  CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
}
Exemple #6
0
void CGUIPassword::LockSources(bool lock)
{
  // lock or unlock all sources (those with locks)
  const char* strType[5] = {"programs","music","video","pictures","files"};
  for (int i=0;i<5;++i)
  {
    VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(strType[i]);
    for (IVECSOURCES it=shares->begin();it != shares->end();++it)
      if (it->m_iLockMode != LOCK_MODE_EVERYONE)
        it->m_iHasLock = lock ? 2 : 1;
  }
  CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
  g_windowManager.SendThreadMessage(msg);
}
void CBoxeeBrowseMenuDirectory::CreateSourcesButtons(const VECSOURCES& Sources, CFileItemList& itemsList)
{
    // NOTE: currently handling only "video" sources

    for (VECSOURCES::const_iterator it = Sources.begin(); it != Sources.end(); it++)
    {
        CFileItemPtr sourceItem(new CFileItem());
        sourceItem->SetLabel(it->strName);
        sourceItem->m_strPath = "boxeeui://movies/?category=local&source=";
        sourceItem->m_strPath += it->strPath;
        sourceItem->SetProperty("isClickable",true);
        itemsList.Add(sourceItem);
    }
}
Exemple #8
0
void CWin32StorageProvider::Initialize()
{
  // check for a DVD drive
  VECSOURCES vShare;
  CWIN32Util::GetDrivesByType(vShare, DVD_DRIVES);
  if(!vShare.empty())
    g_mediaManager.SetHasOpticalDrive(true);

  // Can be removed once the StorageHandler supports optical media
  VECSOURCES::const_iterator it;
  for(it=vShare.begin();it!=vShare.end();++it)
    if(g_mediaManager.GetDriveStatus(it->strPath) == DRIVE_CLOSED_MEDIA_PRESENT)
      CJobManager::GetInstance().AddJob(new CDetectDisc(it->strPath, false), NULL);
  // remove end
}
void CGUIWindowMusicPlaylistEditor::OnLoadPlaylist()
{
  // prompt user for file to load
  std::string playlist;
  VECSOURCES shares;
  m_rootDir.GetSources(shares);
  // add the playlist share
  CMediaSource share;
  share.strName = g_localizeStrings.Get(20011);
  share.strPath = "special://musicplaylists/";
  if (find(shares.begin(), shares.end(), share) == shares.end())
    shares.push_back(share);
  if (CGUIDialogFileBrowser::ShowAndGetFile(shares, ".m3u|.pls|.b4s|.wpl", g_localizeStrings.Get(656), playlist))
    LoadPlaylist(playlist);
}
Exemple #10
0
void CGUIViewState::AddLiveTVSources()
{
  VECSOURCES *sources = CMediaSourceSettings::GetInstance().GetSources("video");
  for (IVECSOURCES it = sources->begin(); it != sources->end(); it++)
  {
    if (URIUtils::IsLiveTV((*it).strPath))
    {
      CMediaSource source;
      source.strPath = (*it).strPath;
      source.strName = (*it).strName;
      source.vecPaths = (*it).vecPaths;
      source.m_strThumbnailImage = "";
      source.FromNameAndPaths("video", source.strName, source.vecPaths);
      m_sources.push_back(source);
    }
  }
}
Exemple #11
0
void CGUIViewState::AddLiveTVSources()
{
  VECSOURCES *sources = g_settings.GetSourcesFromType("video");
  for (IVECSOURCES it = sources->begin(); it != sources->end(); it++)
  {
    if (URIUtils::IsLiveTV((*it).strPath))
    {
      CMediaSource source;
      source.strPath = (*it).strPath;
      source.strName = (*it).strName;
      source.vecPaths = (*it).vecPaths;
      source.m_strThumbnailImage = "";
      source.m_iDriveType = CMediaSource::SOURCE_TYPE_REMOTE;
      m_sources.push_back(source);
    }
  }
}
Exemple #12
0
void CWin32StorageProvider::Initialize()
{
  // check for a DVD drive
  VECSOURCES vShare;
  GetDrivesByType(vShare, DVD_DRIVES);
  if(!vShare.empty())
    g_mediaManager.SetHasOpticalDrive(true);
  else
    CLog::Log(LOGDEBUG, "%s: No optical drive found.", __FUNCTION__);

#ifdef HAS_DVD_DRIVE
  // Can be removed once the StorageHandler supports optical media
  VECSOURCES::const_iterator it;
  for(it=vShare.begin();it!=vShare.end();++it)
    if(g_mediaManager.GetDriveStatus(it->strPath) == DRIVE_CLOSED_MEDIA_PRESENT)
      CJobManager::GetInstance().AddJob(new CDetectDisc(it->strPath, false), NULL);
  // remove end
#endif
}
Exemple #13
0
void CGUIPassword::RemoveSourceLocks()
{
  // remove lock from all sources
  const char* strType[5] = {"programs","music","video","pictures","files"};
  for (int i=0;i<5;++i)
  {
    VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(strType[i]);
    for (IVECSOURCES it=shares->begin();it != shares->end();++it)
      if (it->m_iLockMode != LOCK_MODE_EVERYONE) // remove old info
      {
        it->m_iHasLock = 0;
        it->m_iLockMode = LOCK_MODE_EVERYONE;
        CMediaSourceSettings::Get().UpdateSource(strType[i], it->strName, "lockmode", "0"); // removes locks from xml
      }
  }
  CMediaSourceSettings::Get().Save();
  CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0, GUI_MSG_UPDATE_SOURCES);
  g_windowManager.SendThreadMessage(msg);
}
Exemple #14
0
bool CGUIPassword::LockSource(const std::string& strType, const std::string& strName, bool bState)
{
  VECSOURCES* pShares = CMediaSourceSettings::Get().GetSources(strType);
  bool bResult = false;
  for (IVECSOURCES it=pShares->begin();it != pShares->end();++it)
  {
    if (it->strName == strName)
    {
      if (it->m_iHasLock > 0)
      {
        it->m_iHasLock = bState?2:1;
        bResult = true;
      }
      break;
    }
  }
  CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
  g_windowManager.SendThreadMessage(msg);

  return bResult;
}
Exemple #15
0
void CVirtualDirectory::GetSources(VECSOURCES &shares) const
{
  shares = m_vecSources;
  // add our plug n play shares

#ifndef IS_PROFESSIONAL // Laureon: Added: Jukebox: Professional mode shouldn't list removable sources
  if (m_allowNonLocalSources)
    g_mediaManager.GetRemovableDrives(shares);
#endif

#ifdef HAS_DVD_DRIVE
  // and update our dvd share
  for (unsigned int i = 0; i < shares.size(); ++i)
  {
    CMediaSource& share = shares[i];
    if (share.m_iDriveType == CMediaSource::SOURCE_TYPE_DVD)
    {
      if(g_mediaManager.IsAudio(share.strPath))
      {
        share.strStatus = "Audio-CD";
        share.strPath = "cdda://local/";
        share.strDiskUniqueId = "";
      }
      else
      {
        share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
        share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
        if (!share.strPath.length()) // unmounted CD
        {
          if (g_mediaManager.GetDiscPath() == "iso9660://")
            share.strPath = "iso9660://";
          else
            // share is unmounted and not iso9660, discard it
            shares.erase(shares.begin() + i--);
        }
      }
    }
  }
#endif
}
bool CGUIControlButtonSetting::GetPath(CSettingPath *pathSetting)
{
  if (pathSetting == NULL)
    return false;

  CStdString path = pathSetting->GetValue();

  VECSOURCES shares;
  const std::vector<std::string>& sources = pathSetting->GetSources();
  for (std::vector<std::string>::const_iterator source = sources.begin(); source != sources.end(); ++source)
  {
    VECSOURCES *sources = CMediaSourceSettings::Get().GetSources(*source);
    if (sources != NULL)
      shares.insert(shares.end(), sources->begin(), sources->end());
  }

  g_mediaManager.GetNetworkLocations(shares);
  g_mediaManager.GetLocalDrives(shares);

  if (!CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(pathSetting->GetHeading()), path, pathSetting->Writable()))
    return false;

  return pathSetting->SetValue(path);
}
bool CMediaSourceSettings::DeleteSource(const std::string &strType, const std::string &strName, const std::string &strPath, bool virtualSource /* = false */)
{
  VECSOURCES *pShares = GetSources(strType);
  if (pShares == NULL)
    return false;

  bool found = false;

  for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++)
  {
    if (it->strName == strName && it->strPath == strPath)
    {
      CLog::Log(LOGDEBUG, "CMediaSourceSettings: found share, removing!");
      pShares->erase(it);
      found = true;
      break;
    }
  }

  if (virtualSource)
    return found;

  return Save();
}
void CAndroidStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives)
{
  // Uses non-public API: be extra carefull
  bool inError = false;
  VECSOURCES droidDrives;

  CJNIStorageManager manager(CJNIContext::getSystemService("storage"));
  if (xbmc_jnienv()->ExceptionCheck())
  {
    xbmc_jnienv()->ExceptionClear();
    inError = true;
  }

  if (!inError)
  {
    CJNIStorageVolumes vols = manager.getVolumeList();
    if (xbmc_jnienv()->ExceptionCheck())
    {
      xbmc_jnienv()->ExceptionClear();
      inError = true;
    }

    if (!inError)
    {
      for (auto vol : vols)
      {
//        CLog::Log(LOGDEBUG, "-- Volume: %s(%s) -- %s", vol.getPath().c_str(), vol.getUserLabel().c_str(), vol.getState().c_str());
        bool removable = vol.isRemovable();
        if (xbmc_jnienv()->ExceptionCheck())
        {
          xbmc_jnienv()->ExceptionClear();
          inError = true;
          break;
        }
        std::string state = vol.getState();
        if (xbmc_jnienv()->ExceptionCheck())
        {
          xbmc_jnienv()->ExceptionClear();
          inError = true;
          break;
        }

        if (removable && state == CJNIEnvironment::MEDIA_MOUNTED)
        {
          CMediaSource share;
          share.strPath = vol.getPath();
          if (xbmc_jnienv()->ExceptionCheck())
          {
            xbmc_jnienv()->ExceptionClear();
            inError = true;
            break;
          }
          share.strName = vol.getUserLabel();
          if (xbmc_jnienv()->ExceptionCheck())
          {
            xbmc_jnienv()->ExceptionClear();
            inError = true;
            break;
          }
          StringUtils::Trim(share.strName);
          if (share.strName.empty() || share.strName == "?" || StringUtils::CompareNoCase(share.strName, "null") == 0)
            share.strName = URIUtils::GetFileName(share.strPath);
          share.m_ignore = true;
          droidDrives.push_back(share);
        }
      }
    }
  }

  if (!inError)
    removableDrives.insert(removableDrives.end(), droidDrives.begin(), droidDrives.end());
  else
  {
    for (const auto& mountStr : GetRemovableDrivesLinux())
    {
      // Reject unreadable
      if (XFILE::CDirectory::Exists(mountStr))
      {
        CMediaSource share;
        share.strPath = unescape(mountStr);
        share.strName = URIUtils::GetFileName(mountStr);
        share.m_ignore = true;
        removableDrives.push_back(share);
      }
    }
  }
}
Exemple #19
0
int CHTTPVfsHandler::HandleHTTPRequest(const HTTPRequest &request)
{
  if (request.url.size() > 5)
  {
    m_path = request.url.substr(5);

    /* In old version of libmicrohttpd the path was decoded, this was wrong.
     * This was fix in version 0.9.35.0 : https://gnunet.org/bugs/view.php?id=3371
     * The path must be decoded in XBMC */
#if MHD_VERSION >= 0x00093500
    m_path = CURL::Decode(m_path);
#endif

    if (XFILE::CFile::Exists(m_path))
    {
      bool accessible = false;
      if (m_path.substr(0, 8) == "image://")
        accessible = true;
      else
      {
        string sourceTypes[] = { "video", "music", "pictures" };
        unsigned int size = sizeof(sourceTypes) / sizeof(string);

        string realPath = URIUtils::GetRealPath(m_path);
        // for rar:// and zip:// paths we need to extract the path to the archive
        // instead of using the VFS path
        while (URIUtils::IsInArchive(realPath))
          realPath = CURL(realPath).GetHostName();

        VECSOURCES *sources = NULL;
        for (unsigned int index = 0; index < size && !accessible; index++)
        {
          sources = CMediaSourceSettings::Get().GetSources(sourceTypes[index]);
          if (sources == NULL)
            continue;

          for (VECSOURCES::const_iterator source = sources->begin(); source != sources->end() && !accessible; source++)
          {
            // don't allow access to locked / disabled sharing sources
            if (source->m_iHasLock == 2 || !source->m_allowSharing)
              continue;

            for (vector<CStdString>::const_iterator path = source->vecPaths.begin(); path != source->vecPaths.end(); path++)
            {
              string realSourcePath = URIUtils::GetRealPath(*path);
              if (URIUtils::IsInPath(realPath, realSourcePath))
              {
                accessible = true;
                break;
              }
            }
          }
        }
      }

      if (accessible)
      {
        m_responseCode = MHD_HTTP_OK;
        m_responseType = HTTPFileDownload;
      }
      // the file exists but not in one of the defined sources so we deny access to it
      else
      {
        m_responseCode = MHD_HTTP_UNAUTHORIZED;
        m_responseType = HTTPError;
      }
    }
    else
    {
      m_responseCode = MHD_HTTP_NOT_FOUND;
      m_responseType = HTTPError;
    }
  }
  else
  {
    m_responseCode = MHD_HTTP_BAD_REQUEST;
    m_responseType = HTTPError;
  }

  return MHD_YES;
}
Exemple #20
0
CHTTPVfsHandler::CHTTPVfsHandler(const HTTPRequest &request)
  : CHTTPFileHandler(request)
{
  std::string file;
  int responseStatus = MHD_HTTP_BAD_REQUEST;

  if (m_request.pathUrl.size() > 5)
  {
    file = m_request.pathUrl.substr(5);

    if (XFILE::CFile::Exists(file))
    {
      bool accessible = false;
      if (file.substr(0, 8) == "image://")
        accessible = true;
      else
      {
        std::string sourceTypes[] = { "video", "music", "pictures" };
        unsigned int size = sizeof(sourceTypes) / sizeof(std::string);

        std::string realPath = URIUtils::GetRealPath(file);
        // for rar:// and zip:// paths we need to extract the path to the archive instead of using the VFS path
        while (URIUtils::IsInArchive(realPath))
          realPath = CURL(realPath).GetHostName();

        VECSOURCES *sources = NULL;
        for (unsigned int index = 0; index < size && !accessible; index++)
        {
          sources = CMediaSourceSettings::GetInstance().GetSources(sourceTypes[index]);
          if (sources == NULL)
            continue;

          for (VECSOURCES::const_iterator source = sources->begin(); source != sources->end() && !accessible; ++source)
          {
            // don't allow access to locked / disabled sharing sources
            if (source->m_iHasLock == 2 || !source->m_allowSharing)
              continue;

            for (std::vector<std::string>::const_iterator path = source->vecPaths.begin(); path != source->vecPaths.end(); ++path)
            {
              std::string realSourcePath = URIUtils::GetRealPath(*path);
              if (URIUtils::PathHasParent(realPath, realSourcePath, true))
              {
                accessible = true;
                break;
              }
            }
          }
        }
      }

      if (accessible)
        responseStatus = MHD_HTTP_OK;
      // the file exists but not in one of the defined sources so we deny access to it
      else
        responseStatus = MHD_HTTP_UNAUTHORIZED;
    }
    else
      responseStatus = MHD_HTTP_NOT_FOUND;
  }

  // set the file and the HTTP response status
  SetFile(file, responseStatus);
}
Exemple #21
0
static void AddHostsFromVecSource(const VECSOURCES& sources, vector<string>& hosts)
{
  for (VECSOURCES::const_iterator it = sources.begin(); it != sources.end(); it++)
    AddHostsFromMediaSource(*it, hosts);
}
Exemple #22
0
void CFileScanner::Process()
{
#ifdef _WIN32
  ::SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
#endif

  InitSourcesOnStart();

  time_t now;
  int iMillisecondsToSleep = BXConfiguration::GetInstance().GetIntParam("Boxee.FileScanner.Scan.Interval", 180000);

  // let everything initialize first before we start the first scan. this is to prevent a cpu-boost on startup
  int iDelayStartInMS = BXConfiguration::GetInstance().GetIntParam("Boxee.FileScanner.Delay.Start", 60000);
  CLog::Log(LOGDEBUG,"CFileScanner::Process - wait for %d ms before start (fs)",iDelayStartInMS);
  InterruptibleSleep(iDelayStartInMS);;

  while (!m_bStop)
  {
    // Clear the set of private paths
    m_PrivatePaths.clear();

    time(&now);

    if (m_bExtendedLog)
      CLog::Log(LOGDEBUG,"CFileScanner::Process, scan round started (filescanner)");

    CheckPause();

    CLog::Log(LOGDEBUG,"CFileScanner::Process - going to scan VIDEO shares. [m_bPaused=%d][m_bStop=%d] (fs)",m_bPaused,m_bStop);
    VECSOURCES video = *g_settings.GetSourcesFromType("video");
    ScanShares(&video, "video");
    CleanMediaFolders("videoFolder", video);

    CLog::Log(LOGDEBUG,"CFileScanner::Process - going to scan MUSIC shares. [m_bPaused=%d][m_bStop=%d] (fs)",m_bPaused,m_bStop);
    VECSOURCES audio = *g_settings.GetSourcesFromType("music");
    ScanShares(&audio, "music");
    CleanMediaFolders("musicFolder", audio);

    std::set<std::pair<CStdString, CStdString> > setUserPaths;

    {
      CSingleLock lock(m_lock);
      setUserPaths = m_setUserPaths;
    }

    int counter = 0;
    CLog::Log(LOGDEBUG,"CFileScanner::Process - going to scan USER paths [UserPathsSize=%zu]. [m_bPaused=%d][m_bStop=%d] (fs)",setUserPaths.size(),m_bPaused,m_bStop);

    std::set<std::pair<CStdString, CStdString> >::iterator it = setUserPaths.begin();
    while (it != setUserPaths.end() && !m_bStop)
    {
      counter++;
      CStdString strPath = (*it).first;
      CStdString strType = (*it).second;

      CLog::Log(LOGDEBUG,"CFileScanner::Process - [%d/%zu] - handle [path=%s][type=%s]. [m_bPaused=%d][m_bStop=%d] (fs)",counter,setUserPaths.size(),strPath.c_str(),strType.c_str(),m_bPaused,m_bStop);

      // scan path can be share or directory
      VECSOURCES shares = *g_settings.GetSourcesFromType(strType);
      VECSOURCES::iterator shareIt = shares.begin();
      CMediaSource* pShare = NULL;
      while (shareIt != shares.end())
      {
        if (_P(shareIt->strPath) == strPath)
        {
          pShare = &(*shareIt);
          break;
        }
        shareIt++;
      }

      if (pShare)
      {
        ScanShare(pShare, strType);
      }
      else
      {
        ScanMediaFolder(strPath, strType, strPath);
        UpdateScanLabel(g_localizeStrings.Get(53160));
      }

      // Notify using a message that the path has been scanned
      CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_FILE_SCANNER_UPDATE);
      msg.SetStringParam(strPath);
      g_windowManager.SendThreadMessage(msg);

      it++;
    }

    {
      CSingleLock lock(m_lock);
      m_setUserPaths.clear();
    }

    time_t then = time(NULL);
    if (m_bExtendedLog)
      CLog::Log(LOGDEBUG,"CFileScanner::Process, scan round finished, time = %lu (filescanner)", then - now);

    do
    {
      CLog::Log(LOGDEBUG,"CFileScanner::Process - BEFORE sleep for [%dms]. [m_bPaused=%d][m_bStop=%d] (fs)",iMillisecondsToSleep,m_bPaused,m_bStop);
      InterruptibleSleep(iMillisecondsToSleep);
      CLog::Log(LOGDEBUG,"CFileScanner::Process - AFTER sleep for [%dms]. [m_bPaused=%d][m_bStop=%d] (fs)",iMillisecondsToSleep,m_bPaused,m_bStop);
    }
    while (g_application.IsPlayingVideo() && !m_bStop);
  } // while

  CLog::Log(LOGDEBUG,"Boxee File Scanner, Exiting process loop (filescanner)");
}