Merge pull request #4857 from t-nelson/Gotham_13.2_backports
[vuplus_xbmc] / xbmc / filesystem / MythDirectory.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "IDirectory.h"
23 #include "MythSession.h"
24 #include "XBDateTime.h"
25
26 namespace XFILE
27 {
28
29 enum FilterType
30 {
31   MOVIES,
32   TV_SHOWS,
33   ALL
34 };
35
36 class CMythDirectory
37   : public IDirectory
38 {
39 public:
40   CMythDirectory();
41   virtual ~CMythDirectory();
42
43   virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
44   virtual bool Exists(const char* strPath);
45   virtual bool IsAllowed(const CStdString &strFile) const { return true; };
46   virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
47
48   static bool SupportsWriteFileOperations(const CStdString& strPath);
49   static bool IsLiveTV(const CStdString& strPath);
50
51 private:
52   void Release();
53   bool GetGuide(const CStdString& base, CFileItemList &items);
54   bool GetGuideForChannel(const CStdString& base, CFileItemList &items, const int channelNumber);
55   bool GetRecordings(const CStdString& base, CFileItemList &items, enum FilterType type = ALL, const CStdString& filter = "");
56   bool GetTvShowFolders(const CStdString& base, CFileItemList &items);
57   bool GetChannels(const CStdString& base, CFileItemList &items);
58
59   CStdString GetValue(char* str)           { return m_session->GetValue(str); }
60   CDateTime  GetValue(cmyth_timestamp_t t) { return m_session->GetValue(t); }
61   bool IsVisible(const cmyth_proginfo_t program);
62   bool IsMovie(const cmyth_proginfo_t program);
63   bool IsTvShow(const cmyth_proginfo_t program);
64
65   XFILE::CMythSession*  m_session;
66   DllLibCMyth*          m_dll;
67   cmyth_database_t      m_database;
68   cmyth_recorder_t      m_recorder;
69   cmyth_proginfo_t      m_program;
70 };
71
72 }