[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / filesystem / UPnPFile.cpp
blob560517039899b7f596f4f335731451725088da10
1 /*
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.
7 */
9 #include "UPnPFile.h"
11 #include "FileFactory.h"
12 #include "FileItem.h"
13 #include "UPnPDirectory.h"
14 #include "URL.h"
16 using namespace XFILE;
18 CUPnPFile::CUPnPFile() = default;
20 CUPnPFile::~CUPnPFile() = default;
22 bool CUPnPFile::Open(const CURL& url)
24 CFileItem item_new;
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());
30 if (pNewImp)
32 throw new CRedirectException(pNewImp, pNewUrl);
34 delete pNewUrl;
36 return false;
39 int CUPnPFile::Stat(const CURL& url, struct __stat64* buffer)
41 CFileItem item_new;
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());
47 if (pNewImp)
49 throw new CRedirectException(pNewImp, pNewUrl);
51 delete pNewUrl;
53 return -1;
56 bool CUPnPFile::Exists(const CURL& url)
58 CFileItem item_new;
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());
64 if (pNewImp)
66 throw new CRedirectException(pNewImp, pNewUrl);
68 delete pNewUrl;
70 return false;