2 * Copyright (C) 2011-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
22 #include "UPnPDirectory.h"
23 #include "FileFactory.h"
25 #include "utils/log.h"
28 using namespace XFILE;
30 CUPnPFile::CUPnPFile()
34 CUPnPFile::~CUPnPFile()
38 bool CUPnPFile::Open(const CURL& url)
41 if (CUPnPDirectory::GetResource(url.Get(), item_new))
43 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
44 IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
45 CURL *pNewUrl = new CURL(item_new.GetPath());
48 throw new CRedirectException(pNewImp, pNewUrl);
55 int CUPnPFile::Stat(const CURL& url, struct __stat64* buffer)
58 if (CUPnPDirectory::GetResource(url.Get(), item_new))
60 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
61 IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
62 CURL *pNewUrl = new CURL(item_new.GetPath());
65 throw new CRedirectException(pNewImp, pNewUrl);
72 bool CUPnPFile::Exists(const CURL& url)
75 if (CUPnPDirectory::GetResource(url.Get(), item_new))
77 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to %s.", item_new.GetPath().c_str());
78 IFile *pNewImp = CFileFactory::CreateLoader(item_new.GetPath());
79 CURL *pNewUrl = new CURL(item_new.GetPath());
82 throw new CRedirectException(pNewImp, pNewUrl);