From 53c48b2fcc4479fcc7707d5631eed7539ae211c0 Mon Sep 17 00:00:00 2001 From: Graeme Blackley Date: Mon, 17 Nov 2014 08:16:59 +1300 Subject: [PATCH] Added support for ATSC subchannel numbers, fixing 'no tuner available' message users were getting with this type of channel Fixes a problem with playback of radio stations Added recording artwork Added fanart --- addons/pvr.nextpvr/addon/addon.xml.in | 2 +- addons/pvr.nextpvr/addon/changelog.txt | 6 ++++ addons/pvr.nextpvr/src/pvrclient-nextpvr.cpp | 35 +++++++++++++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/addons/pvr.nextpvr/addon/addon.xml.in b/addons/pvr.nextpvr/addon/addon.xml.in index 8fb7fc02f..2d177dd9a 100644 --- a/addons/pvr.nextpvr/addon/addon.xml.in +++ b/addons/pvr.nextpvr/addon/addon.xml.in @@ -1,7 +1,7 @@  diff --git a/addons/pvr.nextpvr/addon/changelog.txt b/addons/pvr.nextpvr/addon/changelog.txt index 115a15f16..2c856b4f8 100644 --- a/addons/pvr.nextpvr/addon/changelog.txt +++ b/addons/pvr.nextpvr/addon/changelog.txt @@ -1,3 +1,9 @@ +v1.9.19 +- added support for ATSC subchannel numbers, fixing 'no tuner available' message users were getting with this type of channel +- fixes a problem with playback of radio stations +- added recording artwork +- added fanart + v1.9.18 - Fixed mime-type for MPEG-TS diff --git a/addons/pvr.nextpvr/src/pvrclient-nextpvr.cpp b/addons/pvr.nextpvr/src/pvrclient-nextpvr.cpp index 1fe5e524b..c16b6cc87 100644 --- a/addons/pvr.nextpvr/src/pvrclient-nextpvr.cpp +++ b/addons/pvr.nextpvr/src/pvrclient-nextpvr.cpp @@ -382,7 +382,11 @@ PVR_ERROR cPVRClientNextPVR::GetEpg(ADDON_HANDLE handle, const PVR_CHANNEL &chan broadcast.startTime = atol(start); broadcast.endTime = atol(end); broadcast.strPlot = description; - broadcast.strIconPath = ""; + + // artwork URL + char artworkPath[128]; + snprintf(artworkPath, sizeof(artworkPath), "/service?method=channel.show.artwork&sid=%s&event_id=%d", m_sid, broadcast.iUniqueBroadcastId); + broadcast.strIconPath = artworkPath; char genre[128]; genre[0] = '\0'; @@ -547,6 +551,12 @@ PVR_ERROR cPVRClientNextPVR::GetChannels(ADDON_HANDLE handle, bool bRadio) tag.iUniqueId = atoi(pChannelNode->FirstChildElement("id")->FirstChild()->Value()); tag.iChannelNumber = atoi(pChannelNode->FirstChildElement("number")->FirstChild()->Value()); + // handle major.minor style subchannels + if (pChannelNode->FirstChildElement("minor")) + { + tag.iSubChannelNumber = atoi(pChannelNode->FirstChildElement("minor")->FirstChild()->Value()); + } + PVR_STRCPY(tag.strChannelName, pChannelNode->FirstChildElement("name")->FirstChild()->Value()); // check if we need to download a channel icon @@ -744,6 +754,14 @@ PVR_ERROR cPVRClientNextPVR::GetRecordings(ADDON_HANDLE handle) { tag.iLastPlayedPosition = atoi(pRecordingNode->FirstChildElement("playback_position")->FirstChild()->Value()); } + + char artworkPath[512]; + snprintf(artworkPath, sizeof(artworkPath), "http://%s:%d/service?method=recording.artwork&sid=%s&recording_id=%s", g_szHostname.c_str(), g_iPort, m_sid, tag.strRecordingId); + PVR_STRCPY(tag.strIconPath, artworkPath); + PVR_STRCPY(tag.strThumbnailPath, artworkPath); + + snprintf(artworkPath, sizeof(artworkPath), "http://%s:%d/service?method=recording.fanart&sid=%s&recording_id=%s", g_szHostname.c_str(), g_iPort, m_sid, tag.strRecordingId); + PVR_STRCPY(tag.strFanartPath, artworkPath); CStdString strStream; strStream.Format("http://%s:%d/live?recording=%s", g_szHostname, g_iPort, tag.strRecordingId); @@ -1210,11 +1228,18 @@ bool cPVRClientNextPVR::OpenLiveStream(const PVR_CHANNEL &channelinfo) delete m_pLiveShiftSource; m_pLiveShiftSource = NULL; } - + + char mode[32]; + memset(mode, 0, sizeof(mode)); + if (channelinfo.bIsRadio == false && m_supportsLiveTimeshift && g_bUseTimeshift) + strcpy(mode, "&mode=liveshift"); + char line[256]; - sprintf(line, "GET /live?channel=%d&client=XBMC-%s HTTP/1.0\r\n", channelinfo.iChannelNumber, m_sid); - if (m_supportsLiveTimeshift && g_bUseTimeshift) - sprintf(line, "GET /live?channel=%d&mode=liveshift&client=XBMC-%s HTTP/1.0\r\n", channelinfo.iChannelNumber, m_sid); + if (channelinfo.iSubChannelNumber == 0) + sprintf(line, "GET /live?channel=%d%s&client=XBMC-%s HTTP/1.0\r\n", channelinfo.iChannelNumber, mode, m_sid); + else + sprintf(line, "GET /live?channel=%d.%d%s&client=XBMC-%s HTTP/1.0\r\n", channelinfo.iChannelNumber, channelinfo.iSubChannelNumber, mode, m_sid); + m_streamingclient->send(line, strlen(line)); sprintf(line, "Connection: close\r\n");