MythTV  master
channel.cpp
Go to the documentation of this file.
1 // Program Name: channel.cpp
3 // Created : Apr. 8, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 // Copyright (c) 2013 MythTV Developers
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 //
26 
27 #include <QList>
28 
29 #include <math.h>
30 
31 #include "channel.h"
32 
33 #include "compat.h"
34 #include "mythdbcon.h"
35 #include "mythdirs.h"
36 #include "mythversion.h"
37 #include "mythcorecontext.h"
38 #include "channelutil.h"
39 #include "sourceutil.h"
40 #include "cardutil.h"
41 #include "datadirect.h"
42 #include "mythdate.h"
43 
44 #include "serviceUtil.h"
45 
47 //
49 
51  uint nChannelGroupID,
52  uint nStartIndex,
53  uint nCount,
54  bool bOnlyVisible,
55  bool bDetails,
56  bool bOrderByName,
57  bool bGroupByCallsign )
58 {
59  ChannelInfoList chanList;
60 
61  uint nTotalAvailable = 0;
62 
63  chanList = ChannelUtil::LoadChannels( 0, 0, nTotalAvailable, bOnlyVisible,
66  nSourceID, nChannelGroupID);
67 
68  // ----------------------------------------------------------------------
69  // Build Response
70  // ----------------------------------------------------------------------
71 
72  DTC::ChannelInfoList *pChannelInfos = new DTC::ChannelInfoList();
73 
74  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, nTotalAvailable ) : 0;
75  nCount = (nCount > 0) ? min(nCount, (nTotalAvailable - nStartIndex)) :
76  (nTotalAvailable - nStartIndex);
77 
78  ChannelInfoList::iterator chanIt;
79  ChannelInfoList::iterator chanItBegin = chanList.begin() + nStartIndex;
80  ChannelInfoList::iterator chanItEnd = chanItBegin + nCount;
81 
82  for( chanIt = chanItBegin; chanIt < chanItEnd; ++chanIt )
83  {
84  DTC::ChannelInfo *pChannelInfo = pChannelInfos->AddNewChannelInfo();
85 
86  ChannelInfo channelInfo = (*chanIt);
87 
88  if (!FillChannelInfo(pChannelInfo, channelInfo, bDetails))
89  {
90  delete pChannelInfo;
91  delete pChannelInfos;
92  throw( QString("Channel ID appears invalid."));
93  }
94  }
95 
96  int nCurPage = 0, nTotalPages = 0;
97  if (nCount == 0)
98  nTotalPages = 1;
99  else
100  nTotalPages = (int)ceil((float)nTotalAvailable / nCount);
101 
102  if (nTotalPages == 1)
103  nCurPage = 1;
104  else
105  {
106  nCurPage = (int)ceil((float)nStartIndex / nCount) + 1;
107  }
108 
109  pChannelInfos->setStartIndex ( nStartIndex );
110  pChannelInfos->setCount ( nCount );
111  pChannelInfos->setCurrentPage ( nCurPage );
112  pChannelInfos->setTotalPages ( nTotalPages );
113  pChannelInfos->setTotalAvailable( nTotalAvailable );
114  pChannelInfos->setAsOf ( MythDate::current() );
115  pChannelInfos->setVersion ( MYTH_BINARY_VERSION );
116  pChannelInfos->setProtoVer ( MYTH_PROTO_VERSION );
117 
118  return pChannelInfos;
119 }
120 
122 //
124 
126 {
127  if (nChanID <= 0)
128  throw( QString("Channel ID appears invalid."));
129 
130  DTC::ChannelInfo *pChannelInfo = new DTC::ChannelInfo();
131 
132  if (!FillChannelInfo(pChannelInfo, nChanID, true))
133  {
134  // throw causes a crash on linux and we can't know in advance
135  // that a channel id from an old recording rule is invalid
136  //throw( QString("Channel ID appears invalid."));
137  }
138 
139  return pChannelInfo;
140 }
141 
143  uint SourceID,
144  uint ChannelID,
145  const QString &CallSign,
146  const QString &ChannelName,
147  const QString &ChannelNumber,
148  uint ServiceID,
149  uint ATSCMajorChannel,
150  uint ATSCMinorChannel,
151  bool UseEIT,
152  bool visible,
153  const QString &FrequencyID,
154  const QString &Icon,
155  const QString &Format,
156  const QString &XMLTVID,
157  const QString &DefaultAuthority )
158 {
159  bool bResult = false;
160 
161  bResult = ChannelUtil::UpdateChannel( MplexID, SourceID, ChannelID,
162  CallSign, ChannelName, ChannelNumber,
163  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
164  UseEIT, !visible, false, FrequencyID,
165  Icon, Format, XMLTVID, DefaultAuthority );
166 
167  return bResult;
168 }
169 
171  uint SourceID,
172  uint ChannelID,
173  const QString &CallSign,
174  const QString &ChannelName,
175  const QString &ChannelNumber,
176  uint ServiceID,
177  uint ATSCMajorChannel,
178  uint ATSCMinorChannel,
179  bool UseEIT,
180  bool visible,
181  const QString &FrequencyID,
182  const QString &Icon,
183  const QString &Format,
184  const QString &XMLTVID,
185  const QString &DefaultAuthority )
186 {
187  bool bResult = false;
188 
189  bResult = ChannelUtil::CreateChannel( MplexID, SourceID, ChannelID,
190  CallSign, ChannelName, ChannelNumber,
191  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
192  UseEIT, !visible, false, FrequencyID,
193  Icon, Format, XMLTVID, DefaultAuthority );
194 
195  return bResult;
196 }
197 
198 bool Channel::RemoveDBChannel( uint nChannelID )
199 {
200  bool bResult = false;
201 
202  bResult = ChannelUtil::DeleteChannel( nChannelID );
203 
204  return bResult;
205 }
206 
208 //
210 
212 {
213  MSqlQuery query(MSqlQuery::InitCon());
214 
215  if (!query.isConnected())
216  throw( QString("Database not open while trying to list "
217  "Video Sources."));
218 
219  query.prepare("SELECT sourceid, name, xmltvgrabber, userid, "
220  "freqtable, lineupid, password, useeit, configpath, "
221  "dvb_nit_id FROM videosource "
222  "ORDER BY sourceid" );
223 
224  if (!query.exec())
225  {
226  MythDB::DBError("MythAPI::GetVideoSourceList()", query);
227 
228  throw( QString( "Database Error executing query." ));
229  }
230 
231  // ----------------------------------------------------------------------
232  // return the results of the query
233  // ----------------------------------------------------------------------
234 
236 
237  while (query.next())
238  {
239 
240  DTC::VideoSource *pVideoSource = pList->AddNewVideoSource();
241 
242  pVideoSource->setId ( query.value(0).toInt() );
243  pVideoSource->setSourceName ( query.value(1).toString() );
244  pVideoSource->setGrabber ( query.value(2).toString() );
245  pVideoSource->setUserId ( query.value(3).toString() );
246  pVideoSource->setFreqTable ( query.value(4).toString() );
247  pVideoSource->setLineupId ( query.value(5).toString() );
248  pVideoSource->setPassword ( query.value(6).toString() );
249  pVideoSource->setUseEIT ( query.value(7).toBool() );
250  pVideoSource->setConfigPath ( query.value(8).toString() );
251  pVideoSource->setNITId ( query.value(9).toInt() );
252  }
253 
254  pList->setAsOf ( MythDate::current() );
255  pList->setVersion ( MYTH_BINARY_VERSION );
256  pList->setProtoVer ( MYTH_PROTO_VERSION );
257 
258  return pList;
259 }
260 
262 //
264 
266 {
267  MSqlQuery query(MSqlQuery::InitCon());
268 
269  if (!query.isConnected())
270  throw( QString("Database not open while trying to list "
271  "Video Sources."));
272 
273  query.prepare("SELECT name, xmltvgrabber, userid, "
274  "freqtable, lineupid, password, useeit, configpath, "
275  "dvb_nit_id FROM videosource WHERE sourceid = :SOURCEID "
276  "ORDER BY sourceid" );
277  query.bindValue(":SOURCEID", nSourceID);
278 
279  if (!query.exec())
280  {
281  MythDB::DBError("MythAPI::GetVideoSource()", query);
282 
283  throw( QString( "Database Error executing query." ));
284  }
285 
286  // ----------------------------------------------------------------------
287  // return the results of the query
288  // ----------------------------------------------------------------------
289 
290  DTC::VideoSource *pVideoSource = new DTC::VideoSource();
291 
292  if (query.next())
293  {
294  pVideoSource->setId ( nSourceID );
295  pVideoSource->setSourceName ( query.value(0).toString() );
296  pVideoSource->setGrabber ( query.value(1).toString() );
297  pVideoSource->setUserId ( query.value(2).toString() );
298  pVideoSource->setFreqTable ( query.value(3).toString() );
299  pVideoSource->setLineupId ( query.value(4).toString() );
300  pVideoSource->setPassword ( query.value(5).toString() );
301  pVideoSource->setUseEIT ( query.value(6).toBool() );
302  pVideoSource->setConfigPath ( query.value(7).toString() );
303  pVideoSource->setNITId ( query.value(8).toInt() );
304  }
305 
306  return pVideoSource;
307 }
308 
310 //
312 
314  const QString &sSourceName,
315  const QString &sGrabber,
316  const QString &sUserId,
317  const QString &sFreqTable,
318  const QString &sLineupId,
319  const QString &sPassword,
320  bool bUseEIT,
321  const QString &sConfigPath,
322  int nNITId )
323 {
324  bool bResult = false;
325 
326  bResult = SourceUtil::UpdateSource(nSourceId, sSourceName, sGrabber, sUserId, sFreqTable,
327  sLineupId, sPassword, bUseEIT, sConfigPath,
328  nNITId);
329 
330  return bResult;
331 }
332 
334 //
336 
337 int Channel::AddVideoSource( const QString &sSourceName,
338  const QString &sGrabber,
339  const QString &sUserId,
340  const QString &sFreqTable,
341  const QString &sLineupId,
342  const QString &sPassword,
343  bool bUseEIT,
344  const QString &sConfigPath,
345  int nNITId )
346 {
347  int nResult = SourceUtil::CreateSource(sSourceName, sGrabber, sUserId, sFreqTable,
348  sLineupId, sPassword, bUseEIT, sConfigPath,
349  nNITId);
350 
351  return nResult;
352 }
353 
355 //
357 
359 {
360  bool bResult = false;
361 
362  bResult = SourceUtil::DeleteSource( nSourceID );
363 
364  return bResult;
365 }
366 
368 //
370 
371 DTC::LineupList* Channel::GetDDLineupList( const QString &sSource,
372  const QString &sUserId,
373  const QString &sPassword )
374 {
375  int source = 0;
376 
377  DTC::LineupList *pLineups = new DTC::LineupList();
378 
379  if (sSource.toLower() == "schedulesdirect1" ||
380  sSource.toLower() == "schedulesdirect" ||
381  sSource.isEmpty())
382  {
383  source = 1;
384  DataDirectProcessor ddp(source, sUserId, sPassword);
385  if (!ddp.GrabLineupsOnly())
386  {
387  delete pLineups;
388  throw( QString("Unable to grab lineups. Check info."));
389  }
390  const DDLineupList lineups = ddp.GetLineups();
391 
392  DDLineupList::const_iterator it;
393  for (it = lineups.begin(); it != lineups.end(); ++it)
394  {
395  DTC::Lineup *pLineup = pLineups->AddNewLineup();
396 
397  pLineup->setLineupId((*it).lineupid);
398  pLineup->setName((*it).name);
399  pLineup->setDisplayName((*it).displayname);
400  pLineup->setType((*it).type);
401  pLineup->setPostal((*it).postal);
402  pLineup->setDevice((*it).device);
403  }
404  }
405 
406  return pLineups;
407 }
408 
410 //
412 
414  const uint nCardId,
415  bool bWaitForFinish )
416 {
417  if ( nSourceId < 1 || nCardId < 1)
418  throw( QString("A source ID and card ID are both required."));
419 
420  int nResult = 0;
421 
422  QString cardtype = CardUtil::GetRawInputType(nCardId);
423 
424  if (!CardUtil::IsUnscanable(cardtype) &&
425  !CardUtil::IsEncoder(cardtype))
426  {
427  throw( QString("This device is incompatible with channel fetching.") );
428  }
429 
430  SourceUtil::UpdateChannelsFromListings(nSourceId, cardtype, bWaitForFinish);
431 
432  if (bWaitForFinish)
433  nResult = SourceUtil::GetChannelCount(nSourceId);
434 
435  return nResult;
436 }
437 
439 //
441 
443  uint nStartIndex,
444  uint nCount )
445 {
446  MSqlQuery query(MSqlQuery::InitCon());
447 
448  if (!query.isConnected())
449  throw( QString("Database not open while trying to list "
450  "Video Sources."));
451 
452  query.prepare("SELECT mplexid, sourceid, transportid, networkid, "
453  "frequency, inversion, symbolrate, fec, polarity, "
454  "modulation, bandwidth, lp_code_rate, transmission_mode, "
455  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
456  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
457  "default_authority FROM dtv_multiplex WHERE sourceid = :SOURCEID "
458  "ORDER BY mplexid" );
459  query.bindValue(":SOURCEID", nSourceID);
460 
461  if (!query.exec())
462  {
463  MythDB::DBError("MythAPI::GetVideoMultiplexList()", query);
464 
465  throw( QString( "Database Error executing query." ));
466  }
467 
468  uint muxCount = (uint)query.size();
469 
470  // ----------------------------------------------------------------------
471  // Build Response
472  // ----------------------------------------------------------------------
473 
474  DTC::VideoMultiplexList *pVideoMultiplexes = new DTC::VideoMultiplexList();
475 
476  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, muxCount ) : 0;
477  nCount = (nCount > 0) ? min( nCount, muxCount ) : muxCount;
478  int nEndIndex = min((nStartIndex + nCount), muxCount );
479 
480  for( int n = nStartIndex; n < nEndIndex; n++)
481  {
482  if (query.seek(n))
483  {
484  DTC::VideoMultiplex *pVideoMultiplex = pVideoMultiplexes->AddNewVideoMultiplex();
485 
486  pVideoMultiplex->setMplexId( query.value(0).toInt() );
487  pVideoMultiplex->setSourceId( query.value(1).toInt() );
488  pVideoMultiplex->setTransportId( query.value(2).toInt() );
489  pVideoMultiplex->setNetworkId( query.value(3).toInt() );
490  pVideoMultiplex->setFrequency( query.value(4).toLongLong() );
491  pVideoMultiplex->setInversion( query.value(5).toString() );
492  pVideoMultiplex->setSymbolRate( query.value(6).toLongLong() );
493  pVideoMultiplex->setFEC( query.value(7).toString() );
494  pVideoMultiplex->setPolarity( query.value(8).toString() );
495  pVideoMultiplex->setModulation( query.value(9).toString() );
496  pVideoMultiplex->setBandwidth( query.value(10).toString() );
497  pVideoMultiplex->setLPCodeRate( query.value(11).toString() );
498  pVideoMultiplex->setTransmissionMode( query.value(12).toString() );
499  pVideoMultiplex->setGuardInterval( query.value(13).toString() );
500  pVideoMultiplex->setVisible( query.value(14).toBool() );
501  pVideoMultiplex->setConstellation( query.value(15).toString() );
502  pVideoMultiplex->setHierarchy( query.value(16).toString() );
503  pVideoMultiplex->setHPCodeRate( query.value(17).toString() );
504  pVideoMultiplex->setModulationSystem( query.value(18).toString() );
505  pVideoMultiplex->setRollOff( query.value(19).toString() );
506  pVideoMultiplex->setSIStandard( query.value(20).toString() );
507  pVideoMultiplex->setServiceVersion( query.value(21).toInt() );
508  pVideoMultiplex->setUpdateTimeStamp(
509  MythDate::as_utc(query.value(22).toDateTime()));
510  pVideoMultiplex->setDefaultAuthority( query.value(23).toString() );
511  }
512  }
513 
514  int curPage = 0, totalPages = 0;
515  if (nCount == 0)
516  totalPages = 1;
517  else
518  totalPages = (int)ceil((float)muxCount / nCount);
519 
520  if (totalPages == 1)
521  curPage = 1;
522  else
523  {
524  curPage = (int)ceil((float)nStartIndex / nCount) + 1;
525  }
526 
527  pVideoMultiplexes->setStartIndex ( nStartIndex );
528  pVideoMultiplexes->setCount ( nCount );
529  pVideoMultiplexes->setCurrentPage ( curPage );
530  pVideoMultiplexes->setTotalPages ( totalPages );
531  pVideoMultiplexes->setTotalAvailable( muxCount );
532  pVideoMultiplexes->setAsOf ( MythDate::current() );
533  pVideoMultiplexes->setVersion ( MYTH_BINARY_VERSION );
534  pVideoMultiplexes->setProtoVer ( MYTH_PROTO_VERSION );
535 
536  return pVideoMultiplexes;
537 }
538 
540 {
541  MSqlQuery query(MSqlQuery::InitCon());
542 
543  if (!query.isConnected())
544  throw( QString("Database not open while trying to list "
545  "Video Multiplex."));
546 
547  query.prepare("SELECT sourceid, transportid, networkid, "
548  "frequency, inversion, symbolrate, fec, polarity, "
549  "modulation, bandwidth, lp_code_rate, transmission_mode, "
550  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
551  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
552  "default_authority FROM dtv_multiplex WHERE mplexid = :MPLEXID "
553  "ORDER BY mplexid" );
554  query.bindValue(":MPLEXID", nMplexID);
555 
556  if (!query.exec())
557  {
558  MythDB::DBError("MythAPI::GetVideoMultiplex()", query);
559 
560  throw( QString( "Database Error executing query." ));
561  }
562 
563  DTC::VideoMultiplex *pVideoMultiplex = new DTC::VideoMultiplex();
564 
565  if (query.next())
566  {
567  pVideoMultiplex->setMplexId( nMplexID );
568  pVideoMultiplex->setSourceId( query.value(0).toInt() );
569  pVideoMultiplex->setTransportId( query.value(1).toInt() );
570  pVideoMultiplex->setNetworkId( query.value(2).toInt() );
571  pVideoMultiplex->setFrequency( query.value(3).toLongLong() );
572  pVideoMultiplex->setInversion( query.value(4).toString() );
573  pVideoMultiplex->setSymbolRate( query.value(5).toLongLong() );
574  pVideoMultiplex->setFEC( query.value(6).toString() );
575  pVideoMultiplex->setPolarity( query.value(7).toString() );
576  pVideoMultiplex->setModulation( query.value(8).toString() );
577  pVideoMultiplex->setBandwidth( query.value(9).toString() );
578  pVideoMultiplex->setLPCodeRate( query.value(10).toString() );
579  pVideoMultiplex->setTransmissionMode( query.value(11).toString() );
580  pVideoMultiplex->setGuardInterval( query.value(12).toString() );
581  pVideoMultiplex->setVisible( query.value(13).toBool() );
582  pVideoMultiplex->setConstellation( query.value(14).toString() );
583  pVideoMultiplex->setHierarchy( query.value(15).toString() );
584  pVideoMultiplex->setHPCodeRate( query.value(16).toString() );
585  pVideoMultiplex->setModulationSystem( query.value(17).toString() );
586  pVideoMultiplex->setRollOff( query.value(18).toString() );
587  pVideoMultiplex->setSIStandard( query.value(19).toString() );
588  pVideoMultiplex->setServiceVersion( query.value(20).toInt() );
589  pVideoMultiplex->setUpdateTimeStamp(
590  MythDate::as_utc(query.value(21).toDateTime()));
591  pVideoMultiplex->setDefaultAuthority( query.value(22).toString() );
592  }
593 
594  return pVideoMultiplex;
595 }
596 
598 //
600 
602 {
603  MSqlQuery query(MSqlQuery::InitCon());
604 
605  if (!query.isConnected())
606  throw( QString("Database not open while trying to get source name."));
607 
608  query.prepare("SELECT name FROM videosource WHERE sourceid = :SOURCEID ");
609  query.bindValue(":SOURCEID", SourceID);
610 
611  if (!query.exec())
612  {
613  MythDB::DBError("MythAPI::GetXMLTVIdList()", query);
614 
615  throw( QString( "Database Error executing query." ));
616  }
617 
618  QStringList idList;
619 
620  if (query.next())
621  {
622  QString sourceName = query.value(0).toString();
623 
624  QString xmltvFile = GetConfDir() + '/' + sourceName + ".xmltv";
625 
626  if (QFile::exists(xmltvFile))
627  {
628  QFile file(xmltvFile);
629  if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
630  return idList;
631 
632  while (!file.atEnd())
633  {
634  QByteArray line = file.readLine();
635 
636  if (line.startsWith("channel="))
637  {
638  QString id = line.mid(8, -1).trimmed();
639  idList.append(id);
640  }
641  }
642 
643  idList.sort();
644  }
645  }
646  else
647  throw(QString("SourceID (%1) not found").arg(SourceID));
648 
649  return idList;
650 }
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:810
static bool CreateChannel(uint db_mplexid, uint db_sourceid, uint new_channel_id, const QString &callsign, const QString &service_name, const QString &chan_num, uint service_id, uint atsc_major_channel, uint atsc_minor_channel, bool use_on_air_guide, bool hidden, bool hidden_in_guide, const QString &freqid, QString icon=QString(), QString format="Default", QString xmltvid=QString(), QString default_authority=QString())
void bindValue(const QString &placeholder, const QVariant &val)
Definition: mythdbcon.cpp:915
QStringList GetXMLTVIdList(uint SourceID)
Definition: channel.cpp:601
static uint GetChannelCount(uint sourceid)
Definition: sourceutil.cpp:109
static bool DeleteSource(uint sourceid)
Definition: sourceutil.cpp:479
bool UpdateDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool visible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority)
Definition: channel.cpp:142
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
int size(void) const
Definition: mythdbcon.h:187
bool isConnected(void)
Only updated once during object creation.
Definition: mythdbcon.h:135
static bool IsUnscanable(const QString &rawtype)
Definition: cardutil.h:145
DTC::VideoMultiplexList * GetVideoMultiplexList(uint SourceID, uint StartIndex, uint Count)
Definition: channel.cpp:442
unsigned int uint
Definition: compat.h:136
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:23
static bool IsEncoder(const QString &rawtype)
Definition: cardutil.h:123
QString GetConfDir(void)
Definition: mythdirs.cpp:224
QVariant value(int i) const
Definition: mythdbcon.h:182
bool FillChannelInfo(DTC::ChannelInfo *pChannel, uint nChanID, bool bDetails)
DDLineupList GetLineups(void) const
Definition: datadirect.h:339
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0)
Load channels from database into a list of ChannelInfo objects.
VideoSource * AddNewVideoSource()
static int CreateSource(QString sourcename, QString grabber, QString userid, QString freqtable, QString lineupid, QString password, bool useeit, QString configpath, int nitid)
Definition: sourceutil.cpp:435
static bool UpdateChannelsFromListings(uint sourceid, QString inputtype=QString(), bool wait=false)
Definition: sourceutil.cpp:362
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
bool RemoveVideoSource(uint SourceID)
Definition: channel.cpp:358
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:48
static bool UpdateChannel(uint db_mplexid, uint source_id, uint channel_id, const QString &callsign, const QString &service_name, const QString &chan_num, uint service_id, uint atsc_major_channel, uint atsc_minor_channel, bool use_on_air_guide, bool hidden, bool hidden_in_guide, QString freqid=QString(), QString icon=QString(), QString format=QString(), QString xmltvid=QString(), QString default_authority=QString())
VideoMultiplex * AddNewVideoMultiplex()
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:555
vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:121
bool RemoveDBChannel(uint ChannelID)
Definition: channel.cpp:198
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:835
bool AddDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool visible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority)
Definition: channel.cpp:170
DTC::ChannelInfo * GetChannelInfo(uint ChanID)
Definition: channel.cpp:125
vector< DataDirectLineup > DDLineupList
Definition: datadirect.h:295
bool seek(int, bool relative=false)
Wrap QSqlQuery::seek(int,bool)
Definition: mythdbcon.cpp:830
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:16
DTC::LineupList * GetDDLineupList(const QString &Source, const QString &UserId, const QString &Password)
Definition: channel.cpp:371
DTC::VideoMultiplex * GetVideoMultiplex(uint MplexID)
Definition: channel.cpp:539
DTC::VideoSource * GetVideoSource(uint SourceID)
Definition: channel.cpp:265
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:272
bool GrabLineupsOnly(void)
bool UpdateVideoSource(uint SourceID, const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId)
Definition: channel.cpp:313
int AddVideoSource(const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId)
Definition: channel.cpp:337
int FetchChannelsFromSource(const uint SourceId, const uint CardId, bool WaitForFinish)
Definition: channel.cpp:413
ChannelInfo * AddNewChannelInfo()
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:623
DTC::ChannelInfoList * GetChannelInfoList(uint SourceID, uint ChannelGroupID, uint StartIndex, uint Count, bool OnlyVisible, bool Details, bool OrderByName, bool GroupByCallsign)
Definition: channel.cpp:50
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:181
Lineup * AddNewLineup()
Definition: lineup.h:94
static bool UpdateSource(uint sourceid, QString sourcename, QString grabber, QString userid, QString freqtable, QString lineupid, QString password, bool useeit, QString configpath, int nitid)
Definition: sourceutil.cpp:402
enum MythDate::Formats Format
static bool DeleteChannel(uint channel_id)
DTC::VideoSourceList * GetVideoSourceList(void)
Definition: channel.cpp:211