Skip to content

Commit

Permalink
Merge pull request #53 from margro/update_1410
Browse files Browse the repository at this point in the history
Update to 1.4.10
  • Loading branch information
margro authored Dec 10, 2016
2 parents 8ba6a79 + a7570b9 commit fa22eb5
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 137 deletions.
2 changes: 1 addition & 1 deletion pvr.mediaportal.tvserver/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.mediaportal.tvserver"
version="2.4.9"
version="2.4.10"
name="MediaPortal PVR Client"
provider-name="Marcel Groothuis">
<requires>
Expand Down
9 changes: 9 additions & 0 deletions pvr.mediaportal.tvserver/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v2.4.10
- Add support for asynchronous connect. The addon will now regularly try to connect to the backend if it is not connected already.
- Added support for the recording channelType property to distinguish between radio and tv recordings (requires TVServerKodi v1.15.0.136 or above)
- Added a fallback for in-progress recording playback using the TSReader. When the filename is empty, try the RTSP url and vice versa.
- OpenRecordedStream: send additional error messages to the log in case things fail here.

V2.4.9
- Adapt to API change - SeekTime

v2.4.8
- Add Estuary skin support for the old series timer dialog
- Fixed: various Coverity reported issues for Live555 (part 2)
Expand Down
4 changes: 2 additions & 2 deletions src/GUIDialogRecordSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ CGUIDialogRecordSettings::CGUIDialogRecordSettings(const PVR_TIMER &timerinfo, c

// needed for every dialog
m_retVal = -1; // init to failed load value (due to xml file not being found)
// Default skin should actually be "skin.confluence", but the fallback mechanism will only
// Default skin should actually be "skin.estuary", but the fallback mechanism will only
// find the xml file and not the used image files. This will result in a transparent window
// which is basically useless. Therefore, it is better to let the dialog fail by using the
// incorrect fallback skin name "Confluence"
m_window = GUI->Window_create("DialogRecordSettings.xml", "skin.confluence", false, true);
m_window = GUI->Window_create("DialogRecordSettings.xml", "skin.estuary", false, true);
if (m_window)
{
m_window->m_cbhdl = this;
Expand Down
23 changes: 12 additions & 11 deletions src/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Socket::Socket()
#ifdef TARGET_WINDOWS
memset(&_wsaData, 0, sizeof(_wsaData));
#endif
osInit();
}


Expand All @@ -80,8 +81,10 @@ bool Socket::close()
{
if (is_valid())
{
if (_sd != SOCKET_ERROR)
if ((_sd != SOCKET_ERROR) && (_sd != INVALID_SOCKET))
{
closesocket(_sd);
}
_sd = INVALID_SOCKET;
return true;
}
Expand All @@ -92,11 +95,6 @@ bool Socket::create()
{
close();

if(!osInit())
{
return false;
}

return true;
}

Expand Down Expand Up @@ -400,8 +398,9 @@ bool Socket::connect ( const std::string& host, const unsigned short port )
}
_port = port;

char strPort[15];
char strPort[16];
snprintf(strPort, 15, "%hu", port);
strPort[15] = '\0';

struct addrinfo hints;
struct addrinfo* result = NULL;
Expand All @@ -417,6 +416,11 @@ bool Socket::connect ( const std::string& host, const unsigned short port )
errormessage(getLastError(), "Socket::connect");
return false;
}
if (result == NULL)
{
XBMC->Log(LOG_ERROR, "Socket::connect %s:%u: no address info found\n", host.c_str(), port);
return false;
}

for (address = result; address != NULL; address = address->ai_next)
{
Expand All @@ -442,11 +446,8 @@ bool Socket::connect ( const std::string& host, const unsigned short port )

freeaddrinfo(result);

if (address == NULL)
if (_sd == INVALID_SOCKET)
{
XBMC->Log(LOG_ERROR, "Socket::connect %s:%u\n", host.c_str(), port);
errormessage(getLastError(), "Socket::connect");
close();
return false;
}

Expand Down
13 changes: 13 additions & 0 deletions src/channels.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
#include "libXBMC_pvr.h"
#include <string>

namespace TvDatabase
{
// From MediaPortal: TvDatabase.ChannelType
namespace ChannelType
{
const int Unknown = -1; //Added
const int Tv = 0;
const int Radio = 1;
const int Web = 2;
const int All = 3;
};
}

class cChannel
{
private:
Expand Down
37 changes: 24 additions & 13 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bool g_bFastChannelSwitch = true; ///< Do
bool g_bUseRTSP = false; ///< Use RTSP streaming when using the tsreader

/* Client member variables */
ADDON_STATUS m_CurStatus = ADDON_STATUS_UNKNOWN;
ADDON_STATUS m_curStatus = ADDON_STATUS_UNKNOWN;
cPVRClientMediaPortal *g_client = NULL;
std::string g_szUserPath = "";
std::string g_szClientPath = "";
Expand All @@ -72,23 +72,28 @@ void ADDON_ReadSettings(void);
ADDON_STATUS ADDON_Create(void* hdl, void* props)
{
if (!hdl || !props)
return ADDON_STATUS_UNKNOWN;
{
m_curStatus = ADDON_STATUS_UNKNOWN;
return m_curStatus;
}

PVR_PROPERTIES* pvrprops = (PVR_PROPERTIES*)props;

XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
{
SAFE_DELETE(XBMC);
return ADDON_STATUS_PERMANENT_FAILURE;
m_curStatus = ADDON_STATUS_PERMANENT_FAILURE;
return m_curStatus;
}

PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
{
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
return ADDON_STATUS_PERMANENT_FAILURE;
m_curStatus = ADDON_STATUS_PERMANENT_FAILURE;
return m_curStatus;
}

GUI = new CHelper_libKODI_guilib;
Expand All @@ -97,12 +102,13 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
SAFE_DELETE(GUI);
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
return ADDON_STATUS_PERMANENT_FAILURE;
m_curStatus = ADDON_STATUS_PERMANENT_FAILURE;
return m_curStatus;
}

XBMC->Log(LOG_INFO, "Creating MediaPortal PVR-Client");

m_CurStatus = ADDON_STATUS_UNKNOWN;
m_curStatus = ADDON_STATUS_UNKNOWN;
g_szUserPath = pvrprops->strUserPath;
g_szClientPath = pvrprops->strClientPath;

Expand All @@ -111,16 +117,21 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
/* Create connection to MediaPortal XBMC TV client */
g_client = new cPVRClientMediaPortal();

m_CurStatus = g_client->Connect();
if (m_CurStatus != ADDON_STATUS_OK)
m_curStatus = g_client->TryConnect();
if (m_curStatus == ADDON_STATUS_PERMANENT_FAILURE)
{
SAFE_DELETE(g_client);
SAFE_DELETE(GUI);
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
}
else if (m_curStatus == ADDON_STATUS_LOST_CONNECTION)
{
// The addon will try to reconnect, so don't show the permanent failure.
return ADDON_STATUS_OK;
}

return m_CurStatus;
return m_curStatus;
}

//-- Destroy ------------------------------------------------------------------
Expand All @@ -134,7 +145,7 @@ void ADDON_Destroy()
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);

m_CurStatus = ADDON_STATUS_UNKNOWN;
m_curStatus = ADDON_STATUS_UNKNOWN;
}

//-- GetStatus ----------------------------------------------------------------
Expand All @@ -143,10 +154,10 @@ void ADDON_Destroy()
ADDON_STATUS ADDON_GetStatus()
{
/* check whether we're still connected */
if (m_CurStatus == ADDON_STATUS_OK && g_client && !g_client->IsUp())
m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
if (m_curStatus == ADDON_STATUS_OK && g_client && !g_client->IsUp())
m_curStatus = ADDON_STATUS_LOST_CONNECTION;

return m_CurStatus;
return m_curStatus;
}

//-- HasSettings --------------------------------------------------------------
Expand Down
Loading

0 comments on commit fa22eb5

Please sign in to comment.