예제 #1
0
bool CFavouritesDirectory::IsFavourite(CFileItem *item, int contextWindow)
{
  CFileItemList items;
  if (!Load(items)) return false;

  return items.Contains(GetExecutePath(*item, contextWindow));
}
예제 #2
0
bool CFavouritesDirectory::AddOrRemove(CFileItem *item, int contextWindow)
{
  if (!item) return false;

  // load our list
  CFileItemList items;
  Load(items);

  std::string executePath(GetExecutePath(*item, contextWindow));

  CFileItemPtr match = items.Get(executePath);
  if (match)
  { // remove the item
    items.Remove(match.get());
  }
  else
  { // create our new favourite item
    CFileItemPtr favourite(new CFileItem(item->GetLabel()));
    if (item->GetLabel().empty())
      favourite->SetLabel(CUtil::GetTitleFromPath(item->GetPath(), item->m_bIsFolder));
    favourite->SetArt("thumb", item->GetArt("thumb"));
    favourite->SetPath(executePath);
    items.Add(favourite);
  }

  // and save our list again
  return Save(items);
}
예제 #3
0
std::string CFavouritesService::GetFavouritesUrl(const CFileItem& item, int contextWindow) const
{
  CURL url;
  url.SetProtocol("favourites");
  url.SetHostName(CURL::Encode(GetExecutePath(item, contextWindow)));
  return url.Get();
}
예제 #4
0
bool CFavourites::AddOrRemove(CFileItem *item, int contextWindow)
{
  if (!item) return false;

  // load our list
  CFileItemList items;
  Load(items);

  CStdString executePath(GetExecutePath(item, contextWindow));

  CFileItemPtr match = items.Get(executePath);
  if (match)
  { // remove the item
    items.Remove(match.get());
  }
  else
  { // create our new favourite item
    CFileItemPtr favourite(new CFileItem(item->GetLabel()));
    if (item->GetLabel().IsEmpty())
      favourite->SetLabel(CUtil::GetTitleFromPath(item->m_strPath, item->m_bIsFolder));
    favourite->SetThumbnailImage(item->GetThumbnailImage());
    favourite->m_strPath = executePath;
    items.Add(favourite);
  }

  // and save our list again
  return Save(items);
}
예제 #5
0
CString CHttpFileDownload::GetDownPath()
{
	switch (m_nDownMethod){
		case HTTP_DOWNLOAD_PATH_EXECUTE:
			m_strDownPath = GetExecutePath();
			break;

		case HTTP_DOWNLOAD_PATH_TEMP:
			m_strDownPath = GetTempPath();
			break;
		
		case HTTP_DOWNLOAD_PATH_USER:
			if(SetDownPath(m_strDownPath)){
				if(!CheckFolder(m_strDownPath))
					m_strDownPath = "";
			}
			break;
		
		default:
			m_strDownPath = "";
	}

	return m_strDownPath;
}
예제 #6
0
std::string CFavouritesDirectory::GetExecutePath(const CFileItem &item, int contextWindow)
{
  return GetExecutePath(item, StringUtils::Format("%i", contextWindow));
}