3 * Copyright (C) 2012-2013 Team XBMC
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)
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.
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/>.
22 #include "PVRRecording.h"
23 #include "XBDateTime.h"
24 #include "threads/Thread.h"
25 #include "utils/Observer.h"
26 #include "video/VideoThumbLoader.h"
28 #define PVR_ALL_RECORDINGS_PATH_EXTENSION "-1"
32 class CPVRRecordings : public Observable
35 CCriticalSection m_critSection;
37 std::vector<CPVRRecording *> m_recordings;
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);
46 CStdString AddAllRecordingsPathExtension(const CStdString &strDirectory);
47 CStdString RemoveAllRecordingsPathExtension(const CStdString &strDirectory);
51 virtual ~CPVRRecordings(void) { Clear(); };
56 void UpdateEntry(const CPVRRecording &tag);
57 void UpdateFromClient(const CPVRRecording &tag) { UpdateEntry(tag); }
60 * @brief refresh the recordings list from the clients.
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);
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);
75 bool HasAllRecordingsPathExtension(const CStdString &strDirectory);