Merge remote branch 'mine/ext-python'
[vuplus_xbmc] / xbmc / filesystem / MythDirectory.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2008 Team XBMC
4  *      http://www.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, write to
18  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *  http://www.gnu.org/copyleft/gpl.html
20  *
21  */
22
23 #include "IDirectory.h"
24 #include "MythSession.h"
25 #include "XBDateTime.h"
26
27 namespace XFILE
28 {
29
30 enum FilterType
31 {
32   MOVIES,
33   TV_SHOWS,
34   ALL
35 };
36
37 class CMythDirectory
38   : public IDirectory
39 {
40 public:
41   CMythDirectory();
42   virtual ~CMythDirectory();
43
44   virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
45   virtual bool Exists(const char* strPath);
46   virtual bool IsAllowed(const CStdString &strFile) const { return true; };
47   virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
48
49   static bool SupportsFileOperations(const CStdString& strPath);
50   static bool IsLiveTV(const CStdString& strPath);
51
52 private:
53   void Release();
54   bool GetGuide(const CStdString& base, CFileItemList &items);
55   bool GetGuideForChannel(const CStdString& base, CFileItemList &items, const int channelNumber);
56   bool GetRecordings(const CStdString& base, CFileItemList &items, enum FilterType type = ALL, const CStdString& filter = "");
57   bool GetTvShowFolders(const CStdString& base, CFileItemList &items);
58   bool GetChannels(const CStdString& base, CFileItemList &items);
59
60   CStdString GetValue(char* str)           { return m_session->GetValue(str); }
61   CDateTime  GetValue(cmyth_timestamp_t t) { return m_session->GetValue(t); }
62   bool IsVisible(const cmyth_proginfo_t program);
63   bool IsMovie(const cmyth_proginfo_t program);
64   bool IsTvShow(const cmyth_proginfo_t program);
65
66   XFILE::CMythSession*  m_session;
67   DllLibCMyth*          m_dll;
68   cmyth_database_t      m_database;
69   cmyth_recorder_t      m_recorder;
70   cmyth_proginfo_t      m_program;
71 };
72
73 }