Remove LiveTV menu.
[vuplus_xbmc] / xbmc / pvr / recordings / PVRRecording.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 /*
23  * DESCRIPTION:
24  *
25  * CPVRRecordingInfoTag is part of the XBMC PVR system to support recording entrys,
26  * stored on a other Backend like VDR or MythTV.
27  *
28  * The recording information tag holds data about name, length, recording time
29  * and so on of recorded stream stored on the backend.
30  *
31  * The filename string is used to by the PVRManager and passed to DVDPlayer
32  * to stream data from the backend to XBMC.
33  *
34  * It is a also CVideoInfoTag and some of his variables must be set!
35  *
36  */
37
38 #include "addons/include/xbmc_pvr_types.h"
39 #include "video/VideoInfoTag.h"
40 #include "XBDateTime.h"
41
42 namespace PVR
43 {
44   class CPVRRecording : public CVideoInfoTag
45   {
46   public:
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 */
59
60     CPVRRecording(void);
61     CPVRRecording(const PVR_RECORDING &recording, unsigned int iClientId);
62     virtual ~CPVRRecording() {};
63
64     bool operator ==(const CPVRRecording& right) const;
65     bool operator !=(const CPVRRecording& right) const;
66
67     virtual void Serialize(CVariant& value) const;
68
69     /*!
70      * @brief Reset this tag to it's initial state.
71      */
72     void Reset(void);
73
74     /*!
75      * @brief The duration of this recording in seconds.
76      * @return The duration.
77      */
78     int GetDuration() const;
79
80     /*!
81      * @brief Delete this recording on the client (if supported).
82      * @return True if it was deleted successfully, false otherwise.
83      */
84     bool Delete(void);
85
86     /*!
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.
90      */
91     bool Rename(const CStdString &strNewName);
92
93     /*!
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.
97      */
98     bool SetPlayCount(int count);
99
100     /*!
101      * @brief Increment this recording's play count on the client (if supported).
102      * @return True if play count was set successfully, false otherwise.
103      */
104     bool IncrementPlayCount();
105
106     /*!
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
110      */
111     bool SetLastPlayedPosition(int lastplayedposition);
112
113     /*!
114      * @brief Retrieve the last watched position of a recording on the backend.
115      * @return The last watched position in seconds
116      */
117     int GetLastPlayedPosition() const;
118
119     /*!
120      * @brief Retrieve the edit decision list (EDL) of a recording on the backend.
121      * @return The edit decision list (empty on error)
122      */
123     std::vector<PVR_EDL_ENTRY> GetEdl() const;
124
125     /*!
126      * @brief Get the resume point and play count from the database if the 
127      * client doesn't handle it itself.
128      */
129     void UpdateMetadata(void);
130
131     /*!
132      * @brief Update this tag with the contents of the given tag.
133      * @param tag The new tag info.
134      */
135     void Update(const CPVRRecording &tag);
136
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(); }
141
142     /*!
143      * @brief Retrieve the recording title from the URL path
144      * @param url the URL for the recording
145      * @return Title of the recording
146      */
147     static CStdString GetTitleFromURL(const CStdString &url);
148
149     /*!
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
152      */
153     void CopyClientInfo(CVideoInfoTag *target) const;
154
155   private:
156     CDateTime m_recordingTime; /*!< start time of the recording */
157     bool      m_bGotMetaData;
158
159     void UpdatePath(void);
160     void DisplayError(PVR_ERROR err) const;
161   };
162 }