changed: Add logic to properly handle subtitles for stacked files
[vuplus_xbmc] / xbmc / pvr / recordings / PVRRecordings.h
1 #pragma once
2 /*
3  *      Copyright (C) 2012-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 "PVRRecording.h"
23 #include "XBDateTime.h"
24 #include "threads/Thread.h"
25 #include "utils/Observer.h"
26 #include "video/VideoThumbLoader.h"
27
28 #define PVR_ALL_RECORDINGS_PATH_EXTENSION "-1"
29
30 namespace PVR
31 {
32   class CPVRRecordings : public Observable
33   {
34   private:
35     CCriticalSection             m_critSection;
36     bool                         m_bIsUpdating;
37     std::vector<CPVRRecording *> m_recordings;
38
39     virtual void UpdateFromClients(void);
40     virtual CStdString TrimSlashes(const CStdString &strOrig) const;
41     virtual const CStdString GetDirectoryFromPath(const CStdString &strPath, const CStdString &strBase) const;
42     virtual bool IsDirectoryMember(const CStdString &strDirectory, const CStdString &strEntryDirectory, bool bDirectMember = true) const;
43     virtual void GetContents(const CStdString &strDirectory, CFileItemList *results);
44     virtual void GetSubDirectories(const CStdString &strBase, CFileItemList *results, bool bAutoSkip = true);
45
46     CStdString AddAllRecordingsPathExtension(const CStdString &strDirectory);
47     CStdString RemoveAllRecordingsPathExtension(const CStdString &strDirectory);
48
49   public:
50     CPVRRecordings(void);
51     virtual ~CPVRRecordings(void) { Clear(); };
52
53     int Load();
54     void Unload();
55     void Clear();
56     void UpdateEntry(const CPVRRecording &tag);
57     void UpdateFromClient(const CPVRRecording &tag) { UpdateEntry(tag); }
58
59     /**
60      * @brief refresh the recordings list from the clients.
61      */
62     void Update(void);
63
64     int GetNumRecordings();
65     int GetRecordings(CFileItemList* results);
66     bool DeleteRecording(const CFileItem &item);
67     bool RenameRecording(CFileItem &item, CStdString &strNewName);
68     bool SetRecordingsPlayCount(const CFileItemPtr &item, int count);
69
70     bool GetDirectory(const CStdString& strPath, CFileItemList &items);
71     CFileItemPtr GetByPath(const CStdString &path);
72     void SetPlayCount(const CFileItem &item, int iPlayCount);
73     void GetAll(CFileItemList &items);
74
75     bool HasAllRecordingsPathExtension(const CStdString &strDirectory);
76   };
77 }