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/>.
25 * CPVRRecordingInfoTag is part of the XBMC PVR system to support recording entrys,
26 * stored on a other Backend like VDR or MythTV.
28 * The recording information tag holds data about name, length, recording time
29 * and so on of recorded stream stored on the backend.
31 * The filename string is used to by the PVRManager and passed to DVDPlayer
32 * to stream data from the backend to XBMC.
34 * It is a also CVideoInfoTag and some of his variables must be set!
38 #include "addons/include/xbmc_pvr_types.h"
39 #include "video/VideoInfoTag.h"
40 #include "XBDateTime.h"
44 class CPVRRecording : public CVideoInfoTag
47 int m_iClientId; /*!< ID of the backend */
48 CStdString m_strRecordingId; /*!< unique id of the recording on the client */
49 CStdString m_strChannelName; /*!< name of the channel this was recorded from */
50 CDateTimeSpan m_duration; /*!< duration of this recording */
51 int m_iPriority; /*!< priority of this recording */
52 int m_iLifetime; /*!< lifetime of this recording */
53 CStdString m_strStreamURL; /*!< stream URL. if empty use pvr client */
54 CStdString m_strDirectory; /*!< directory of this recording on the client */
55 CStdString m_strIconPath; /*!< icon path */
56 CStdString m_strThumbnailPath; /*!< thumbnail path */
57 CStdString m_strFanartPath; /*!< fanart path */
58 unsigned m_iRecordingId; /*!< id that won't change while xbmc is running */
61 CPVRRecording(const PVR_RECORDING &recording, unsigned int iClientId);
62 virtual ~CPVRRecording() {};
64 bool operator ==(const CPVRRecording& right) const;
65 bool operator !=(const CPVRRecording& right) const;
67 virtual void Serialize(CVariant& value) const;
70 * @brief Reset this tag to it's initial state.
75 * @brief The duration of this recording in seconds.
76 * @return The duration.
78 int GetDuration() const;
81 * @brief Delete this recording on the client (if supported).
82 * @return True if it was deleted successfully, false otherwise.
87 * @brief Rename this recording on the client (if supported).
88 * @param strNewName The new name.
89 * @return True if it was renamed successfully, false otherwise.
91 bool Rename(const CStdString &strNewName);
94 * @brief Set this recording's play count on the client (if supported).
95 * @param count play count.
96 * @return True if play count was set successfully, false otherwise.
98 bool SetPlayCount(int count);
101 * @brief Increment this recording's play count on the client (if supported).
102 * @return True if play count was set successfully, false otherwise.
104 bool IncrementPlayCount();
107 * @brief Set the last watched position of a recording on the backend.
108 * @param position The last watched position in seconds
109 * @return True if the last played position was updated successfully, false otherwise
111 bool SetLastPlayedPosition(int lastplayedposition);
114 * @brief Retrieve the last watched position of a recording on the backend.
115 * @return The last watched position in seconds
117 int GetLastPlayedPosition() const;
120 * @brief Retrieve the edit decision list (EDL) of a recording on the backend.
121 * @return The edit decision list (empty on error)
123 std::vector<PVR_EDL_ENTRY> GetEdl() const;
126 * @brief Get the resume point and play count from the database if the
127 * client doesn't handle it itself.
129 void UpdateMetadata(void);
132 * @brief Update this tag with the contents of the given tag.
133 * @param tag The new tag info.
135 void Update(const CPVRRecording &tag);
137 const CDateTime &RecordingTimeAsUTC(void) const { return m_recordingTime; }
138 const CDateTime &RecordingTimeAsLocalTime(void) const;
139 void SetRecordingTimeFromUTC(CDateTime &recordingTime) { m_recordingTime = recordingTime; }
140 void SetRecordingTimeFromLocalTime(CDateTime &recordingTime) { m_recordingTime = recordingTime.GetAsUTCDateTime(); }
143 * @brief Retrieve the recording title from the URL path
144 * @param url the URL for the recording
145 * @return Title of the recording
147 static CStdString GetTitleFromURL(const CStdString &url);
150 * @brief Copy some information from the client to the given video info tag
151 * @param target video info tag to which the information will be copied
153 void CopyClientInfo(CVideoInfoTag *target) const;
156 CDateTime m_recordingTime; /*!< start time of the recording */
159 void UpdatePath(void);
160 void DisplayError(PVR_ERROR err) const;