Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
62 changed files
with
6,354 additions
and
1,854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 159 additions & 0 deletions
159
mythtv/libs/libmythservicecontracts/datacontracthelper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
80 changes: 80 additions & 0 deletions
80
mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
95 changes: 95 additions & 0 deletions
95
mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.