2 * Copyright (C) 2011-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "FileFactory.h"
13 #include "UPnPDirectory.h"
16 using namespace XFILE
;
18 CUPnPFile::CUPnPFile() = default;
20 CUPnPFile::~CUPnPFile() = default;
22 bool CUPnPFile::Open(const CURL
& url
)
25 if (CUPnPDirectory::GetResource(url
, item_new
))
27 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to {}.", item_new.GetPath());
28 IFile
*pNewImp
= CFileFactory::CreateLoader(item_new
.GetPath());
29 CURL
*pNewUrl
= new CURL(item_new
.GetPath());
32 throw new CRedirectException(pNewImp
, pNewUrl
);
39 int CUPnPFile::Stat(const CURL
& url
, struct __stat64
* buffer
)
42 if (CUPnPDirectory::GetResource(url
, item_new
))
44 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to {}.", item_new.GetPath());
45 IFile
*pNewImp
= CFileFactory::CreateLoader(item_new
.GetPath());
46 CURL
*pNewUrl
= new CURL(item_new
.GetPath());
49 throw new CRedirectException(pNewImp
, pNewUrl
);
56 bool CUPnPFile::Exists(const CURL
& url
)
59 if (CUPnPDirectory::GetResource(url
, item_new
))
61 //CLog::Log(LOGDEBUG,"FileUPnP - file redirect to {}.", item_new.GetPath());
62 IFile
*pNewImp
= CFileFactory::CreateLoader(item_new
.GetPath());
63 CURL
*pNewUrl
= new CURL(item_new
.GetPath());
66 throw new CRedirectException(pNewImp
, pNewUrl
);