MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
video.h
Go to the documentation of this file.
1 
2 // Program Name: video.h
3 // Created : Apr. 21, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #ifndef VIDEO_H
27 #define VIDEO_H
28 
29 #include <QScriptEngine>
30 
32 
33 #include "services/videoServices.h"
34 
35 class Video : public VideoServices
36 {
37  Q_OBJECT
38 
39  public:
40 
41  Q_INVOKABLE Video( QObject *parent = 0 ) {}
42 
43  public:
44 
45  /* Video Metadata Methods */
46 
47  DTC::VideoMetadataInfoList* GetVideoList ( bool Descending,
48  int StartIndex,
49  int Count );
50 
51  DTC::VideoMetadataInfo* GetVideo ( int Id );
52 
53  DTC::VideoMetadataInfo* GetVideoByFileName ( const QString &FileName );
54 
55  DTC::VideoLookupList* LookupVideo ( const QString &Title,
56  const QString &Subtitle,
57  const QString &Inetref,
58  int Season,
59  int Episode,
60  const QString &GrabberType,
61  bool AllowGeneric );
62 
63  bool RemoveVideoFromDB ( int Id );
64 
65  bool AddVideo ( const QString &FileName,
66  const QString &HostName );
67 
68  /* Bluray Methods */
69 
70  DTC::BlurayInfo* GetBluray ( const QString &Path );
71 
72 };
73 
74 // --------------------------------------------------------------------------
75 // The following class wrapper is due to a limitation in Qt Script Engine. It
76 // requires all methods that return pointers to user classes that are derived from
77 // QObject actually return QObject* (not the user class *). If the user class pointer
78 // is returned, the script engine treats it as a QVariant and doesn't create a
79 // javascript prototype wrapper for it.
80 //
81 // This class allows us to keep the rich return types in the main API class while
82 // offering the script engine a class it can work with.
83 //
84 // Only API Classes that return custom classes needs to implement these wrappers.
85 //
86 // We should continue to look for a cleaning solution to this problem.
87 // --------------------------------------------------------------------------
88 
89 class ScriptableVideo : public QObject
90 {
91  Q_OBJECT
92 
93  private:
94 
96 
97  public:
98 
99  Q_INVOKABLE ScriptableVideo( QObject *parent = 0 ) : QObject( parent ) {}
100 
101  public slots:
102 
103  QObject* GetVideoList( bool Descending,
104  int StartIndex,
105  int Count )
106  {
107  return m_obj.GetVideoList( Descending, StartIndex, Count );
108  }
109 
110  QObject* GetVideo( int Id )
111  {
112  return m_obj.GetVideo( Id );
113  }
114 
115  QObject* GetVideoByFileName( const QString &FileName )
116  {
117  return m_obj.GetVideoByFileName( FileName );
118  }
119 
120  QObject* LookupVideo( const QString &Title,
121  const QString &Subtitle,
122  const QString &Inetref,
123  int Season,
124  int Episode,
125  const QString &GrabberType,
126  bool AllowGeneric )
127  {
128  return m_obj.LookupVideo( Title, Subtitle, Inetref,
129  Season, Episode, GrabberType,
130  AllowGeneric );
131  }
132 
133  bool RemoveVideoFromDB( int Id )
134  {
135  return m_obj.RemoveVideoFromDB( Id );
136  }
137 
138  bool AddVideo( const QString &FileName,
139  const QString &HostName )
140  {
141  return m_obj.AddVideo( FileName, HostName );
142  }
143 };
144 
145 
147 
148 #endif