Skip to content
Permalink
Browse files

Framework API - Initial commit (Breaks MythXML support!)

This commit adds the base code needed for the new API Framework support.

I don't know all locations that use the MythXML methods, so please let me
know if this breaks any code.

I will be updating the wiki to have details of these changes.

The following services replaced existing MythXML methods
( NOTE: response data format has changed for most methods )

Base URL - http://mythbackend:6544/Myth/

  Methods -

     GetConnectionInfo
     GetHosts
     GetKeys
     GetSetting
     PutSetting

    *GetInternetSearch
    *GetInternetSources
    *GetInternetContent

  * These methods are still implemented in MythXml using legacy approach.

Base URL - http://mythbackend:6544/Guide/

  Methods -

     GetProgramGuide
     GetProgramDetails
     GetChannelIcon

Base URL - http://mythbackend:6544/Dvr/

  Methods -

     GetExpiring
     GetRecorded
     Encoders

Base URL - http://mythbackend:6544/Content/

  Methods -

     GetFile
     GetFileList
     GetVideoArt
     GetAlbumArt
     GetPreviewImage
     GetRecording
     GetMusic
     GetVideo
  • Loading branch information
dblain committed Mar 9, 2011
1 parent ae3dccf commit 856b61b5378c4b6d8bd60638f86606e7603654ef
Showing with 6,354 additions and 1,854 deletions.
  1. +1 −0 mythplugins/programs-libs.pro
  2. +1 −0 mythtv/libs/libmythbase/compat.h
  3. +159 −0 mythtv/libs/libmythservicecontracts/datacontracthelper.h
  4. +80 −0 mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h
  5. +95 −0 mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h
  6. +102 −0 mythtv/libs/libmythservicecontracts/datacontracts/encoder.h
  7. +78 −0 mythtv/libs/libmythservicecontracts/datacontracts/encoderList.h
  8. +219 −0 mythtv/libs/libmythservicecontracts/datacontracts/programAndChannel.h
  9. +135 −0 mythtv/libs/libmythservicecontracts/datacontracts/programGuide.h
  10. +104 −0 mythtv/libs/libmythservicecontracts/datacontracts/programList.h
  11. +122 −0 mythtv/libs/libmythservicecontracts/datacontracts/recording.h
  12. +63 −0 mythtv/libs/libmythservicecontracts/datacontracts/settingList.h
  13. +59 −0 mythtv/libs/libmythservicecontracts/datacontracts/stringList.h
  14. +59 −0 mythtv/libs/libmythservicecontracts/datacontracts/successFail.h
  15. +80 −0 mythtv/libs/libmythservicecontracts/datacontracts/wolInfo.h
  16. +65 −0 mythtv/libs/libmythservicecontracts/libmythservicecontracts.pro
  17. +97 −0 mythtv/libs/libmythservicecontracts/service.cpp
  18. +79 −0 mythtv/libs/libmythservicecontracts/service.h
  19. +22 −0 mythtv/libs/libmythservicecontracts/serviceexp.h
  20. +77 −0 mythtv/libs/libmythservicecontracts/services/contentServices.h
  21. +66 −0 mythtv/libs/libmythservicecontracts/services/dvrServices.h
  22. +70 −0 mythtv/libs/libmythservicecontracts/services/guideServices.h
  23. +73 −0 mythtv/libs/libmythservicecontracts/services/mythServices.h
  24. +2 −0 mythtv/libs/libmythtv/libmythtv.pro
  25. +127 −74 mythtv/libs/libmythupnp/httprequest.cpp
  26. +8 −6 mythtv/libs/libmythupnp/httprequest.h
  27. +15 −1 mythtv/libs/libmythupnp/libmythupnp.pro
  28. +239 −0 mythtv/libs/libmythupnp/serializers/jsonSerializer.cpp
  29. +73 −0 mythtv/libs/libmythupnp/serializers/jsonSerializer.h
  30. +123 −0 mythtv/libs/libmythupnp/serializers/serializer.cpp
  31. +79 −0 mythtv/libs/libmythupnp/serializers/serializer.h
  32. +87 −0 mythtv/libs/libmythupnp/serializers/soapSerializer.h
  33. +246 −0 mythtv/libs/libmythupnp/serializers/xmlSerializer.cpp
  34. +79 −0 mythtv/libs/libmythupnp/serializers/xmlSerializer.h
  35. +343 −0 mythtv/libs/libmythupnp/servicehost.cpp
  36. +103 −0 mythtv/libs/libmythupnp/servicehost.h
  37. +3 −2 mythtv/libs/libmythupnp/ssdp.cpp
  38. +456 −0 mythtv/libs/libmythupnp/wsdl.cpp
  39. +84 −0 mythtv/libs/libmythupnp/wsdl.h
  40. +2 −0 mythtv/libs/libs.pro
  41. +5 −2 mythtv/programs/mythbackend/httpstatus.cpp
  42. +10 −0 mythtv/programs/mythbackend/mediaserver.cpp
  43. +10 −0 mythtv/programs/mythbackend/mythbackend.pro
  44. +65 −1,694 mythtv/programs/mythbackend/mythxml.cpp
  45. +0 −58 mythtv/programs/mythbackend/mythxml.h
  46. +55 −0 mythtv/programs/mythbackend/serviceHosts/contentServiceHost.h
  47. +55 −0 mythtv/programs/mythbackend/serviceHosts/dvrServiceHost.h
  48. +55 −0 mythtv/programs/mythbackend/serviceHosts/guideServiceHost.h
  49. +55 −0 mythtv/programs/mythbackend/serviceHosts/mythServiceHost.h
  50. +544 −0 mythtv/programs/mythbackend/services/content.cpp
  51. +62 −0 mythtv/programs/mythbackend/services/content.h
  52. +498 −0 mythtv/programs/mythbackend/services/dvr.cpp
  53. +47 −0 mythtv/programs/mythbackend/services/dvr.h
  54. +308 −0 mythtv/programs/mythbackend/services/guide.cpp
  55. +57 −0 mythtv/programs/mythbackend/services/guide.h
  56. +293 −0 mythtv/programs/mythbackend/services/myth.cpp
  57. +52 −0 mythtv/programs/mythbackend/services/myth.h
  58. +138 −0 mythtv/programs/mythbackend/services/serviceUtil.cpp
  59. +37 −0 mythtv/programs/mythbackend/services/serviceUtil.h
  60. +10 −6 mythtv/programs/mythfrontend/mediarenderer.cpp
  61. +18 −11 mythtv/programs/mythfrontend/mythfexml.cpp
  62. +5 −0 mythtv/programs/programs-libs.pro
@@ -6,6 +6,7 @@ DEPENDPATH *= $${INCLUDEPATH}

LIBS += -L$${LIBDIR} $$EXTRA_LIBS -lmythbase-$$LIBVERSION
LIBS += -lmyth-$$LIBVERSION -lmythui-$$LIBVERSION -lmythupnp-$$LIBVERSION
LIBS += -lmythservicecontracts-$$LIBVERSION
LIBS += -lmythavcodec
LIBS += -lmythavcore
LIBS += -lmythavutil
@@ -25,6 +25,7 @@
# undef CreateFont
# undef DeleteFile
# undef GetCurrentTime
# undef SetJob

#ifndef _MSC_VER
# include <winsock2.h>
@@ -0,0 +1,159 @@
//////////////////////////////////////////////////////////////////////////////
// Program Name: datacontracthelper.h
// Created : Jan. 15, 2010
//
// Copyright (c) 2010 David Blain <dblain@mythtv.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or at your option any later version of the LGPL.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////
//
// * Copy Constructors (needed for Q_PROPERTY) don't do Deep Copies yet.
// * DECLARE_METATYPE not working if this header is not included... need
// to find solution since Serializer classes doesn't include this header.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef DATACONTRACTHELPER_H_
#define DATACONTRACTHELPER_H_

#include <QList>
#include <QStringList>
#include <QVariantMap>

//////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////

#define PROPERTYIMP( type, name ) \
private: type m_##name; \
public: \
type name() const \
{ \
return m_##name; \
} \
void set##name(const type val) \
{ \
m_##name = val; \
}

//////////////////////////////////////////////////////////////////////////////

#define PROPERTYIMP_ENUM( type, name ) \
private: type m_##name; \
public: \
type name() const \
{ \
return m_##name; \
} \
void set##name(const type val) \
{ \
m_##name = val; \
} \
void set##name( int val) \
{ \
m_##name = (type)val; \
}

//////////////////////////////////////////////////////////////////////////////

#define PROPERTYIMP_PTR( type, name ) \
private: type* m_##name; \
public: \
type* name() \
{ \
if (m_##name == NULL) \
m_##name = new type( this );\
return m_##name; \
}

//////////////////////////////////////////////////////////////////////////////

#define PROPERTYIMP_PTR_Old( type, name ) \
private: type* m_##name; \
public: \
type* name() \
{ \
return m_##name; \
} \
void set##name( QObject* val) \
{ \
m_##name = qobject_cast< type* >( val ); \
} \
void set##name( type* val) \
{ \
m_##name = val; \
}

//////////////////////////////////////////////////////////////////////////////

#define PROPERTYIMP_RO_REF( type, name ) \
private: type m_##name; \
public: \
type &name() \
{ \
return m_##name; \
}


namespace DTC
{

/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////

inline void DeleteListContents( QVariantList &list )
{
while( !list.isEmpty() )
{
QVariant vValue = list.takeFirst();

const QObject *pObject = vValue.value< QObject* >();

if (pObject != NULL)
delete pObject;
}
}

/////////////////////////////////////////////////////////////////////////////

template< class T >
void CopyListContents( QObject *pParent, QVariantList &dst, const QVariantList &src )
{
for( int nIdx = 0; nIdx < src.size(); nIdx++ )
{
QVariant vValue = src[ nIdx ];

if ( vValue.canConvert< QObject* >())
{
const QObject *pObject = vValue.value< QObject* >();

if (pObject != NULL)
{
QObject *pNew = new T( pParent );

((T *)pNew)->Copy( (const T &)(*pObject) );

dst.append( QVariant::fromValue<QObject *>( pNew ));
}
}
}
}

} // namespace DTC

#endif


@@ -0,0 +1,80 @@
//////////////////////////////////////////////////////////////////////////////
// Program Name: connectionInfo.h
// Created : Jan. 15, 2010
//
// Copyright (c) 2010 David Blain <dblain@mythtv.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or at your option any later version of the LGPL.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef CONNECTIONINFO_H_
#define CONNECTIONINFO_H_

#include "serviceexp.h"
#include "datacontracthelper.h"

#include "databaseInfo.h"
#include "wolInfo.h"

namespace DTC
{

class SERVICE_PUBLIC ConnectionInfo : public QObject
{
Q_OBJECT
Q_CLASSINFO( "version" , "1.0" );

Q_PROPERTY( QObject* Database READ Database )
Q_PROPERTY( QObject* WOL READ WOL )

PROPERTYIMP_PTR( DatabaseInfo, Database )
PROPERTYIMP_PTR( WOLInfo , WOL )

public:

ConnectionInfo(QObject *parent = 0)
: QObject ( parent ),
m_Database ( NULL ),
m_WOL ( NULL )
{
}

ConnectionInfo( const ConnectionInfo &src )
: m_Database ( NULL ),
m_WOL ( NULL )
{
Copy( src );
}

void Copy( const ConnectionInfo &src )
{
// We always need to make sure the child object is
// created with the correct parent *

if (src.m_Database)
Database()->Copy( src.m_Database );

if (src.m_WOL)
WOL ()->Copy( src.m_WOL );
}
};

typedef ConnectionInfo* ConnectionInfoPtr;

} // namespace DTC

Q_DECLARE_METATYPE( DTC::ConnectionInfo )

#endif
@@ -0,0 +1,95 @@
//////////////////////////////////////////////////////////////////////////////
// Program Name: databaseInfo.h
// Created : Jan. 15, 2010
//
// Copyright (c) 2010 David Blain <dblain@mythtv.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or at your option any later version of the LGPL.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef DATABASEINFO_H_
#define DATABASEINFO_H_

#include <QString>

#include "serviceexp.h"
#include "datacontracthelper.h"

namespace DTC
{

class SERVICE_PUBLIC DatabaseInfo : public QObject
{
Q_OBJECT
Q_CLASSINFO( "version", "1.0" );

Q_PROPERTY( QString Host READ Host WRITE setHost )
Q_PROPERTY( bool Ping READ Ping WRITE setPing )
Q_PROPERTY( int Port READ Port WRITE setPort )
Q_PROPERTY( QString UserName READ UserName WRITE setUserName )
Q_PROPERTY( QString Password READ Password WRITE setPassword )
Q_PROPERTY( QString Name READ Name WRITE setName )
Q_PROPERTY( QString Type READ Type WRITE setType )
Q_PROPERTY( bool LocalEnabled READ LocalEnabled WRITE setLocalEnabled )
Q_PROPERTY( QString LocalHostName READ LocalHostName WRITE setLocalHostName )

PROPERTYIMP( QString, Host )
PROPERTYIMP( bool , Ping )
PROPERTYIMP( int , Port )
PROPERTYIMP( QString, UserName )
PROPERTYIMP( QString, Password )
PROPERTYIMP( QString, Name )
PROPERTYIMP( QString, Type )
PROPERTYIMP( bool , LocalEnabled )
PROPERTYIMP( QString, LocalHostName )

public:

DatabaseInfo(QObject *parent = 0)
: QObject ( parent ),
m_Ping ( false ),
m_Port ( 0 ),
m_LocalEnabled( false )
{
}

DatabaseInfo( const DatabaseInfo &src )
{
Copy( src );
}

void Copy( const DatabaseInfo &src )
{
m_Host = src.m_Host ;
m_Ping = src.m_Ping ;
m_Port = src.m_Port ;
m_UserName = src.m_UserName ;
m_Password = src.m_Password ;
m_Name = src.m_Name ;
m_Type = src.m_Type ;
m_LocalEnabled = src.m_LocalEnabled ;
m_LocalHostName= src.m_LocalHostName;
}

};

typedef DatabaseInfo * DatabaseInfoPtr;

} // namespace DTC

Q_DECLARE_METATYPE( DTC::DatabaseInfo )


#endif

0 comments on commit 856b61b

Please sign in to comment.
You can’t perform that action at this time.