diff options
author | Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> | 2011-02-10 13:14:03 +0200 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2011-02-10 22:41:13 +0100 |
commit | 23562a42a5a5d776330b42823fe844493b574830 (patch) | |
tree | defa4a6843b930d7eaf37eef0428514c3bfc63dd /recman.h | |
parent | cbe61b644bffc891c339d74fffaaf2cc482720ea (diff) | |
download | vdr-plugin-live-23562a42a5a5d776330b42823fe844493b574830.tar.gz vdr-plugin-live-23562a42a5a5d776330b42823fe844493b574830.tar.bz2 |
Added support for renaming/moving recordings and for deleting multiple recordings at once.
Diffstat (limited to 'recman.h')
-rw-r--r-- | recman.h | 73 |
1 files changed, 73 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include <ctime> #include <map> #include <vector> +#include <list> #include <vdr/recording.h> #include "stdext.h" @@ -21,6 +22,8 @@ namespace vdrlive { class RecordingsTreePtr; class RecordingsList; class RecordingsListPtr; + class DirectoryList; + class DirectoryListPtr; class RecordingsItem; typedef std::tr1::shared_ptr< RecordingsManager > RecordingsManagerPtr; @@ -57,6 +60,12 @@ namespace vdrlive { RecordingsListPtr GetRecordingsList(time_t begin, time_t end, bool ascending = true) const; /** + * Returns a shared pointer to a fully populated + * directory list. + */ + DirectoryListPtr GetDirectoryList() const; + + /** * generates a Md5 hash from a cRecording entry. It can be used * to reidentify a recording. */ @@ -69,6 +78,24 @@ namespace vdrlive { cRecording const* GetByMd5Hash(std::string const & hash) const; /** + * Rename a recording with the given hash according to + * VDRs recording mechanisms. + */ + bool RenameRecording(cRecording const * recording, std::string const & name) const; + + /** + * Delete recording resume with the given hash according to + * VDRs recording mechanisms. + */ + void DeleteResume(cRecording const * recording) const; + + /** + * Delete recording marks with the given hash according to + * VDRs recording mechanisms. + */ + void DeleteMarks(cRecording const * recording) const; + + /** * Delete a recording with the given hash according to * VDRs recording deletion mechanisms. */ @@ -97,6 +124,7 @@ namespace vdrlive { static std::tr1::weak_ptr< RecordingsManager > m_recMan; static std::tr1::shared_ptr< RecordingsTree > m_recTree; static std::tr1::shared_ptr< RecordingsList > m_recList; + static std::tr1::shared_ptr< DirectoryList > m_recDirs; static int m_recordingsState; cThreadLock m_recordingsLock; @@ -310,6 +338,51 @@ namespace vdrlive { /** + * The recording directory list contains all real directory entries. + */ + class DirectoryList + { + friend class RecordingsManager; + + private: + DirectoryList(RecordingsManagerPtr recManPtr); +#if APIVERSNUM >= 10712 + void InjectFoldersConf(cNestedItem * folder, std::string parent = ""); +#endif + public: + typedef std::list< std::string > DirVecType; + + virtual ~DirectoryList(); + + DirVecType::const_iterator begin() const { return m_pDirVec->begin(); } + DirVecType::const_iterator end() const { return m_pDirVec->end(); } + DirVecType::size_type size() const { return m_pDirVec->size(); } + + private: + DirVecType *m_pDirVec; + }; + + + /** + * A smart pointer to a directory list. As long as an instance of this + * exists the recordings are locked in the vdr. + */ + class DirectoryListPtr : public std::tr1::shared_ptr< DirectoryList > + { + friend class RecordingsManager; + + private: + DirectoryListPtr(RecordingsManagerPtr recManPtr, std::tr1::shared_ptr< DirectoryList > recDirs); + + public: + virtual ~DirectoryListPtr(); + + private: + RecordingsManagerPtr m_recManPtr; + }; + + + /** * return singleton instance of RecordingsManager as a shared Pointer. * This ensures that after last use of the RecordingsManager it is * deleted. After deletion of the original RecordingsManager a repeated |