diff options
author | Lars Op den Kamp <lars@opdenkamp.eu> | 2014-02-13 01:04:43 +0100 |
---|---|---|
committer | montellese <montellese@xbmc.org> | 2014-02-27 20:01:01 +0100 |
commit | fc0d8976f3468f36578ec54c59401685dcd969f0 (patch) | |
tree | 551518b13f93f2313921dca74edb10338a49f419 | |
parent | 88585097d694a0b23123abb46b2ed813fbe7e473 (diff) |
[PVR] added a unique id for each recording, valid as long as xbmc isn't reset
-rw-r--r-- | xbmc/pvr/recordings/PVRRecording.cpp | 4 | ||||
-rw-r--r-- | xbmc/pvr/recordings/PVRRecording.h | 1 | ||||
-rw-r--r-- | xbmc/pvr/recordings/PVRRecordings.cpp | 17 | ||||
-rw-r--r-- | xbmc/pvr/recordings/PVRRecordings.h | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/xbmc/pvr/recordings/PVRRecording.cpp b/xbmc/pvr/recordings/PVRRecording.cpp index 6f7a2829d5..1c3fb97d54 100644 --- a/xbmc/pvr/recordings/PVRRecording.cpp +++ b/xbmc/pvr/recordings/PVRRecording.cpp @@ -81,7 +81,8 @@ bool CPVRRecording::operator ==(const CPVRRecording& right) const m_strTitle == right.m_strTitle && m_strIconPath == right.m_strIconPath && m_strThumbnailPath == right.m_strThumbnailPath && - m_strFanartPath == right.m_strFanartPath); + m_strFanartPath == right.m_strFanartPath && + m_iRecordingId == right.m_iRecordingId); } bool CPVRRecording::operator !=(const CPVRRecording& right) const @@ -103,6 +104,7 @@ void CPVRRecording::Reset(void) m_strThumbnailPath = StringUtils::EmptyString; m_strFanartPath = StringUtils::EmptyString; m_bGotMetaData = false; + m_iRecordingId = 0; m_recordingTime.Reset(); CVideoInfoTag::Reset(); diff --git a/xbmc/pvr/recordings/PVRRecording.h b/xbmc/pvr/recordings/PVRRecording.h index 696c0321b2..8238bf414e 100644 --- a/xbmc/pvr/recordings/PVRRecording.h +++ b/xbmc/pvr/recordings/PVRRecording.h @@ -55,6 +55,7 @@ namespace PVR CStdString m_strIconPath; /*!< icon path */ CStdString m_strThumbnailPath; /*!< thumbnail path */ CStdString m_strFanartPath; /*!< fanart path */ + unsigned m_iRecordingId; /*!< id that won't change while xbmc is running */ CPVRRecording(void); CPVRRecording(const PVR_RECORDING &recording, unsigned int iClientId); diff --git a/xbmc/pvr/recordings/PVRRecordings.cpp b/xbmc/pvr/recordings/PVRRecordings.cpp index ecf7eead54..9495064a6b 100644 --- a/xbmc/pvr/recordings/PVRRecordings.cpp +++ b/xbmc/pvr/recordings/PVRRecordings.cpp @@ -39,7 +39,8 @@ using namespace PVR; CPVRRecordings::CPVRRecordings(void) : - m_bIsUpdating(false) + m_bIsUpdating(false), + m_iLastId(0) { } @@ -456,6 +457,19 @@ void CPVRRecordings::GetAll(CFileItemList &items) } } +CFileItemPtr CPVRRecordings::GetById(unsigned int iId) const +{ + CFileItemPtr item; + CSingleLock lock(m_critSection); + for (std::vector<CPVRRecording *>::const_iterator it = m_recordings.begin(); !item && it != m_recordings.end(); ++it) + { + if (iId == (*it)->m_iRecordingId) + item = CFileItemPtr(new CFileItem(**it)); + } + + return item; +} + CFileItemPtr CPVRRecordings::GetByPath(const CStdString &path) { CURL url(path); @@ -510,6 +524,7 @@ void CPVRRecordings::UpdateEntry(const CPVRRecording &tag) { CPVRRecording *newTag = new CPVRRecording(); newTag->Update(tag); + newTag->m_iRecordingId = ++m_iLastId; m_recordings.push_back(newTag); } } diff --git a/xbmc/pvr/recordings/PVRRecordings.h b/xbmc/pvr/recordings/PVRRecordings.h index 20c27cc2b9..b52e90a20c 100644 --- a/xbmc/pvr/recordings/PVRRecordings.h +++ b/xbmc/pvr/recordings/PVRRecordings.h @@ -35,6 +35,7 @@ namespace PVR CCriticalSection m_critSection; bool m_bIsUpdating; std::vector<CPVRRecording *> m_recordings; + unsigned int m_iLastId; virtual void UpdateFromClients(void); virtual CStdString TrimSlashes(const CStdString &strOrig) const; @@ -71,6 +72,7 @@ namespace PVR CFileItemPtr GetByPath(const CStdString &path); void SetPlayCount(const CFileItem &item, int iPlayCount); void GetAll(CFileItemList &items); + CFileItemPtr GetById(unsigned int iId) const; bool HasAllRecordingsPathExtension(const CStdString &strDirectory); }; |