Esempio n. 1
0
	void Security::Execute(const string& file)
	{
		if(!CanExecute(file))
			throw SecurityViolationError("Security::Execute(const string&)","access denied: '"+file+"'");
	}
Esempio n. 2
0
bool CMediaLibraryEvent::Execute() const
{
  if (!CanExecute())
    return false;

  int windowId = -1;
  std::string path = m_mediaPath;
  if (m_mediaType == MediaTypeVideo || m_mediaType == MediaTypeMovie || m_mediaType == MediaTypeVideoCollection ||
      m_mediaType == MediaTypeTvShow || m_mediaType == MediaTypeSeason || m_mediaType == MediaTypeEpisode ||
      m_mediaType == MediaTypeMusicVideo)
  {
    if (path.empty())
    {
      if (m_mediaType == MediaTypeVideo)
        path = "sources://video/";
      else if (m_mediaType == MediaTypeMovie)
        path = "videodb://movies/titles/";
      else if (m_mediaType == MediaTypeVideoCollection)
        path = "videodb://movies/sets/";
      else if (m_mediaType == MediaTypeMusicVideo)
        path = "videodb://musicvideos/titles/";
      else if (m_mediaType == MediaTypeTvShow || m_mediaType == MediaTypeSeason || m_mediaType == MediaTypeEpisode)
        path = "videodb://tvshows/titles/";
    }
    else
    {
      //! @todo remove the filename for now as CGUIMediaWindow::GetDirectory() can't handle it
      if (m_mediaType == MediaTypeMovie || m_mediaType == MediaTypeMusicVideo || m_mediaType == MediaTypeEpisode)
        path = URIUtils::GetDirectory(path);
    }

    windowId = WINDOW_VIDEO_NAV;
  }
  else if (m_mediaType == MediaTypeMusic || m_mediaType == MediaTypeArtist ||
           m_mediaType == MediaTypeAlbum || m_mediaType == MediaTypeSong)
  {
    if (path.empty())
    {
      if (m_mediaType == MediaTypeMusic)
        path = "sources://music/";
      else if (m_mediaType == MediaTypeArtist)
        path = "musicdb://artists/";
      else if (m_mediaType == MediaTypeAlbum)
        path = "musicdb://albums/";
      else if (m_mediaType == MediaTypeSong)
        path = "musicdb://songs/";
    }
    else
    {
      //! @todo remove the filename for now as CGUIMediaWindow::GetDirectory() can't handle it
      if (m_mediaType == MediaTypeSong)
        path = URIUtils::GetDirectory(path);
    }

    windowId = WINDOW_MUSIC_NAV;
  }

  if (windowId < 0)
    return false;

  std::vector<std::string> params;
  params.push_back(path);
  params.push_back("return");
  CServiceBroker::GetGUI()->GetWindowManager().ActivateWindow(windowId, params);
  return true;
}