| 1 |
/* |
| 2 |
* Copyright (C) 2005-2021 Team Kodi (https://kodi.tv) |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
* See LICENSE.md for more information. |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <stdlib.h> |
| 11 |
#include "Cards.h" |
| 12 |
#include "GenreTable.h" |
| 13 |
#include "DateTime.h" |
| 14 |
#include "channels.h" |
| 15 |
|
| 16 |
#include <kodi/addon-instance/pvr/Recordings.h> |
| 17 |
|
| 18 |
#define DEFAULTFRAMESPERSECOND 25.0 |
| 19 |
#define MAXPRIORITY 99 |
| 20 |
#define MAXLIFETIME 99 //Based on VDR addon and VDR documentation. 99=Keep forever, 0=can be deleted at any time, 1..98=days to keep |
| 21 |
|
| 22 |
class cRecording |
| 23 |
{ |
| 24 |
private: |
| 25 |
int m_Index; |
| 26 |
int m_channelID; |
| 27 |
std::string m_channelName; |
| 28 |
std::string m_filePath; ///< The full recording path as returned by the backend |
| 29 |
std::string m_basePath; ///< The base path shared by all recordings (to be determined from the Card settings) |
| 30 |
std::string m_directory; ///< An optional subdirectory below the basePath |
| 31 |
std::string m_fileName; ///< The recording filename without path |
| 32 |
std::string m_stream; |
| 33 |
std::string m_originalurl; |
| 34 |
MPTV::CDateTime m_startTime; |
| 35 |
MPTV::CDateTime m_endTime; |
| 36 |
int m_duration; ///< Duration of the recording in seconds |
| 37 |
std::string m_title; ///< Title of this event |
| 38 |
std::string m_description; ///< Description of this event |
| 39 |
std::string m_episodeName; ///< Short description of this event (typically the episode name in case of a series) |
| 40 |
std::string m_seriesNumber; |
| 41 |
std::string m_episodeNumber; |
| 42 |
std::string m_episodePart; |
| 43 |
int m_scheduleID; |
| 44 |
int m_keepUntil; |
| 45 |
MPTV::CDateTime m_keepUntilDate; ///< MediaPortal keepUntilDate |
| 46 |
CCards* m_cardSettings; ///< Pointer to the MediaPortal card settings. Will be used to determine the base path of the recordings |
| 47 |
std::string m_genre; |
| 48 |
int m_genre_type; |
| 49 |
int m_genre_subtype; |
| 50 |
bool m_isRecording; |
| 51 |
CGenreTable* m_genretable; |
| 52 |
int m_timesWatched; |
| 53 |
int m_lastPlayedPosition; |
| 54 |
int m_channelType; |
| 55 |
|
| 56 |
public: |
| 57 |
cRecording(); |
| 58 |
virtual ~cRecording(); |
| 59 |
|
| 60 |
bool ParseLine(const std::string& data); |
| 61 |
const char *ChannelName(void) const { return m_channelName.c_str(); } |
| 62 |
int Index(void) const { return m_Index; } |
| 63 |
time_t StartTime(void) const; |
| 64 |
int Duration(void) const; |
| 65 |
const char *Title(void) const { return m_title.c_str(); } |
| 66 |
const char *Description(void) const { return m_description.c_str(); } |
| 67 |
const char *EpisodeName(void) const { return m_episodeName.c_str(); } |
| 68 |
const char *SeriesNumber(void) const { return m_seriesNumber.c_str(); } |
| 69 |
const char *EpisodeNumber(void) const { return m_episodeNumber.c_str(); } |
| 70 |
const char *EpisodePart(void) const { return m_episodePart.c_str(); } |
| 71 |
int ScheduleID(void) const { return m_scheduleID; } |
| 72 |
int Lifetime(void) const; |
| 73 |
int TimesWatched(void) const {return m_timesWatched; } |
| 74 |
int LastPlayedPosition(void) const { return m_lastPlayedPosition; } |
| 75 |
bool IsRecording(void) {return m_isRecording; } |
| 76 |
int ChannelID(void) const { return m_channelID; } |
| 77 |
PVR_RECORDING_CHANNEL_TYPE GetChannelType(void) const; |
| 78 |
|
| 79 |
/** |
| 80 |
* \brief Filename of this recording with full path (at server side) |
| 81 |
*/ |
| 82 |
const char *FilePath(void) const { return m_filePath.c_str(); } |
| 83 |
|
| 84 |
/** |
| 85 |
* \brief Filename of this recording without full path |
| 86 |
* \return Filename |
| 87 |
*/ |
| 88 |
const char *FileName(void) const { return m_fileName.c_str(); } |
| 89 |
|
| 90 |
/** |
| 91 |
* \brief Directory where this recording is stored (at server side) |
| 92 |
* \return Filename |
| 93 |
*/ |
| 94 |
const char *Directory(void) const { return m_directory.c_str(); } |
| 95 |
|
| 96 |
/** |
| 97 |
* \brief Override the directory where this recording is stored |
| 98 |
*/ |
| 99 |
//void SetDirectory( std::string& directory ); |
| 100 |
|
| 101 |
/** |
| 102 |
* \brief The RTSP stream URL for this recording (hostname resolved to IP-address) |
| 103 |
* \return Stream URL |
| 104 |
*/ |
| 105 |
const char *Stream(void) const { return m_stream.c_str(); } |
| 106 |
|
| 107 |
/** |
| 108 |
* \brief The RTSP stream URL for this recording (unresolved hostname) |
| 109 |
* \return Stream URL |
| 110 |
*/ |
| 111 |
const char *OrignalURL(void) const { return m_originalurl.c_str(); } |
| 112 |
|
| 113 |
/** |
| 114 |
* \brief Pass a pointer to the MediaPortal card settings to this class |
| 115 |
* \param the cardSettings |
| 116 |
*/ |
| 117 |
void SetCardSettings(CCards* cardSettings); |
| 118 |
|
| 119 |
/** |
| 120 |
* \brief Parse Recording file path and divide it in 3 parts: base path, subdirectory and filename; |
| 121 |
*/ |
| 122 |
void SplitFilePath(void); |
| 123 |
|
| 124 |
int GenreType(void) const { return m_genre_type; } |
| 125 |
int GenreSubType(void) const { return m_genre_subtype; } |
| 126 |
void SetGenreTable(CGenreTable* genremap); |
| 127 |
const char* GetGenre(void) const { return m_genre.c_str(); } |
| 128 |
|
| 129 |
/** |
| 130 |
* \brief Returns the series number as an integer value. Returns -1 when this field is empty. |
| 131 |
*/ |
| 132 |
int GetSeriesNumber(void) const; |
| 133 |
|
| 134 |
/** |
| 135 |
* \brief Returns the episode number as an integer value. Returns -1 when this field is empty. |
| 136 |
*/ |
| 137 |
int GetEpisodeNumber(void) const; |
| 138 |
}; |