Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pvr.demo: add support for recordings

  • Loading branch information...
commit e264cb305db9d0617ca46f1f3c7948a77092b065 1 parent b291a5a
@pieh pieh authored
View
113 addons/pvr.demo/addon/PVRDemoAddonSettings.xml
@@ -455,6 +455,117 @@
<genretype>30</genretype>
<genresubtype>0</genresubtype>
</entry>
-
</epg>
+ <recordings>
+ <recording>
+ <title>Demo Recording entry #1</title>
+ <url></url>
+ <channelname>Demo TV Channel #1</channelname>
+ <plotoutline>Lorem ipsum dolor sit amet.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>12:00</time>
+ <duration>7200</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #2</title>
+ <url></url>
+ <channelname>Demo TV Channel #2</channelname>
+ <plotoutline>Lorem ipsum dolor sit amet.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #3</title>
+ <url></url>
+ <channelname>Demo TV Channel #3</channelname>
+ <plotoutline>Lorem ipsum dolor sit amet.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>20:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #4</title>
+ <url></url>
+ <channelname>Demo TV Channel #4</channelname>
+ <plotoutline>Lorem ipsum dolor sit amet.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>18:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #5</title>
+ <url></url>
+ <channelname>Demo TV Channel #5</channelname>
+ <plotoutline>Lorem ipsum dolor sit amet.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>16:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #6</title>
+ <url></url>
+ <channelname>Demo TV Channel #6</channelname>
+ <plotoutline>Aliquam erat volutpat.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #7</title>
+ <url></url>
+ <channelname>Demo TV Channel #7</channelname>
+ <plotoutline>Aliquam erat volutpat.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #8</title>
+ <url></url>
+ <channelname>Demo TV Channel #8</channelname>
+ <plotoutline>Aliquam erat volutpat.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #9</title>
+ <url></url>
+ <channelname>Demo TV Channel #9</channelname>
+ <plotoutline>Aliquam erat volutpat.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ <recording>
+ <title>Demo Recording entry #10</title>
+ <url></url>
+ <channelname>Demo TV Channel #10</channelname>
+ <plotoutline>Aliquam erat volutpat.</plotoutline>
+ <plot>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam cursus consectetur ipsum, eu tincidunt dui aliquam ac. Sed scelerisque, augue eu lacinia ultrices, libero ante ullamcorper augue, vel malesuada justo risus ac nulla. Quisque ac libero libero. Sed tincidunt, orci eu condimentum laoreet, felis odio mattis est, et lacinia metus enim in leo. Fusce faucibus tristique risus in varius. Etiam sagittis venenatis ligula nec rutrum. Etiam gravida dictum hendrerit. Sed sodales felis in sapien rutrum non malesuada nisi lobortis. Mauris iaculis ante odio. Nunc gravida erat convallis purus dignissim et ultricies orci dapibus. Aliquam erat volutpat. Vestibulum mi felis, malesuada ac tincidunt sit amet, pulvinar nec dolor. Pellentesque vehicula est vulputate mi adipiscing euismod. Donec ac mauris nulla. Nullam suscipit felis eu quam sodales ac bibendum nisi interdum. Curabitur non lectus a ante venenatis semper eget id justo. Ut facilisis, ligula pretium dictum congue, lacus dolor commodo nibh, sit amet sodales sed.</plot>
+ <genretype>10</genretype>
+ <genresubtype>0</genresubtype>
+ <time>14:00</time>
+ <duration>7500</duration>
+ </recording>
+ </recordings>
</demo>
View
99 addons/pvr.demo/src/PVRDemoData.cpp
@@ -206,6 +206,74 @@ bool PVRDemoData::LoadDemoData(void)
}
}
+ /* load recordings */
+ iUniqueGroupId = 0; // reset unique ids
+ pElement = pRootElement->FirstChildElement("recordings");
+ if (pElement)
+ {
+ TiXmlNode *pRecordingNode = NULL;
+ while ((pRecordingNode = pElement->IterateChildren(pRecordingNode)) != NULL)
+ {
+ CStdString strTmp;
+ PVRDemoRecording recording;
+
+ /* recording title */
+ if (!XMLUtils::GetString(pRecordingNode, "title", strTmp))
+ continue;
+ recording.strTitle = strTmp;
+
+ /* recording url */
+ if (!XMLUtils::GetString(pRecordingNode, "url", strTmp))
+ recording.strStreamURL = m_strDefaultMovie;
+ else
+ recording.strStreamURL = strTmp;
+
+ iUniqueGroupId++;
+ strTmp.Format("%d", iUniqueGroupId);
+ recording.strRecordingId = strTmp;
+
+ /* channel name */
+ if (XMLUtils::GetString(pRecordingNode, "channelname", strTmp))
+ recording.strChannelName = strTmp;
+
+ /* plot */
+ if (XMLUtils::GetString(pRecordingNode, "plot", strTmp))
+ recording.strPlot = strTmp;
+
+ /* plot outline */
+ if (XMLUtils::GetString(pRecordingNode, "plotoutline", strTmp))
+ recording.strPlotOutline = strTmp;
+
+ /* genre type */
+ XMLUtils::GetInt(pRecordingNode, "genretype", recording.iGenreType);
+
+ /* genre subtype */
+ XMLUtils::GetInt(pRecordingNode, "genresubtype", recording.iGenreSubType);
+
+ /* duration */
+ XMLUtils::GetInt(pRecordingNode, "duration", recording.iDuration);
+
+ /* recording time */
+ if (XMLUtils::GetString(pRecordingNode, "time", strTmp))
+ {
+ time_t timeNow = time(NULL);
+ struct tm* now = localtime(&timeNow);
+
+ int delim = strTmp.Find(':');
+ if (delim != CStdString::npos)
+ {
+ now->tm_hour = (int)strtol(strTmp.Left(delim), NULL, 0);
+ now->tm_min = (int)strtol(strTmp.Mid(delim + 1), NULL, 0);
+ now->tm_mday--; // yesterday
+
+ recording.recordingTime = mktime(now);
+ }
+ }
+
+ m_recordings.push_back(recording);
+ }
+ }
+
return true;
}
@@ -362,3 +430,34 @@ PVR_ERROR PVRDemoData::GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &
return PVR_ERROR_NO_ERROR;
}
+
+int PVRDemoData::GetRecordingsAmount(void)
+{
+ return m_recordings.size();
+}
+
+PVR_ERROR PVRDemoData::GetRecordings(ADDON_HANDLE handle)
+{
+ for (std::vector<PVRDemoRecording>::iterator it = m_recordings.begin() ; it != m_recordings.end() ; it++)
+ {
+ PVRDemoRecording &recording = *it;
+
+ PVR_RECORDING xbmcRecording;
+
+ xbmcRecording.iDuration = recording.iDuration;
+ xbmcRecording.iGenreType = recording.iGenreType;
+ xbmcRecording.iGenreSubType = recording.iGenreSubType;
+ xbmcRecording.recordingTime = recording.recordingTime;
+
+ strncpy(xbmcRecording.strChannelName, recording.strChannelName.c_str(), sizeof(xbmcRecording.strChannelName) - 1);
+ strncpy(xbmcRecording.strPlotOutline, recording.strPlotOutline.c_str(), sizeof(xbmcRecording.strPlotOutline) - 1);
+ strncpy(xbmcRecording.strPlot, recording.strPlot.c_str(), sizeof(xbmcRecording.strPlot) - 1);
+ strncpy(xbmcRecording.strRecordingId, recording.strRecordingId.c_str(), sizeof(xbmcRecording.strRecordingId) - 1);
+ strncpy(xbmcRecording.strTitle, recording.strTitle.c_str(), sizeof(xbmcRecording.strTitle) - 1);
+ strncpy(xbmcRecording.strStreamURL, recording.strStreamURL.c_str(), sizeof(xbmcRecording.strStreamURL) - 1);
+
+ PVR->TransferRecordingEntry(handle, &xbmcRecording);
+ }
+
+ return PVR_ERROR_NO_ERROR;
+}
View
18 addons/pvr.demo/src/PVRDemoData.h
@@ -58,6 +58,20 @@ struct PVRDemoChannel
std::vector<PVRDemoEpgEntry> epg;
};
+struct PVRDemoRecording
+{
+ int iDuration;
+ int iGenreType;
+ int iGenreSubType;
+ std::string strChannelName;
+ std::string strPlotOutline;
+ std::string strPlot;
+ std::string strRecordingId;
+ std::string strStreamURL;
+ std::string strTitle;
+ time_t recordingTime;
+};
+
struct PVRDemoChannelGroup
{
bool bRadio;
@@ -82,12 +96,16 @@ class PVRDemoData
virtual PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd);
+ virtual int GetRecordingsAmount(void);
+ virtual PVR_ERROR GetRecordings(ADDON_HANDLE handle);
+
virtual std::string GetSettingsFile() const;
protected:
virtual bool LoadDemoData(void);
private:
std::vector<PVRDemoChannelGroup> m_groups;
std::vector<PVRDemoChannel> m_channels;
+ std::vector<PVRDemoRecording> m_recordings;
time_t m_iEpgStart;
CStdString m_strDefaultIcon;
CStdString m_strDefaultMovie;
View
19 addons/pvr.demo/src/client.cpp
@@ -147,6 +147,7 @@ PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
pCapabilities->bSupportsTV = true;
pCapabilities->bSupportsRadio = true;
pCapabilities->bSupportsChannelGroups = true;
+ pCapabilities->bSupportsRecordings = true;
return PVR_ERROR_NO_ERROR;
}
@@ -270,6 +271,22 @@ PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus)
return PVR_ERROR_NO_ERROR;
}
+int GetRecordingsAmount(void)
+{
+ if (m_data)
+ return m_data->GetRecordingsAmount();
+
+ return -1;
+}
+
+PVR_ERROR GetRecordings(ADDON_HANDLE handle)
+{
+ if (m_data)
+ return m_data->GetRecordings(handle);
+
+ return PVR_ERROR_NOT_IMPLEMENTED;
+}
+
/** UNUSED API FUNCTIONS */
PVR_ERROR DialogChannelScan(void) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR CallMenuHook(const PVR_MENUHOOK &menuhook) { return PVR_ERROR_NOT_IMPLEMENTED; }
@@ -291,8 +308,6 @@ long long SeekLiveStream(long long iPosition, int iWhence /* = SEEK_SET */) { re
long long PositionLiveStream(void) { return -1; }
long long LengthLiveStream(void) { return -1; }
const char * GetLiveStreamURL(const PVR_CHANNEL &channel) { return ""; }
-int GetRecordingsAmount(void) { return -1; }
-PVR_ERROR GetRecordings(ADDON_HANDLE handle) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR DeleteRecording(const PVR_RECORDING &recording) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR RenameRecording(const PVR_RECORDING &recording) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
Please sign in to comment.
Something went wrong with that request. Please try again.