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 nStartIndex,
52  uint nCount,
53  bool bOnlyVisible,
54  bool bDetails )
55 {
56  ChannelInfoList chanList;
57 
58  uint nTotalAvailable = 0;
59  chanList = ChannelUtil::LoadChannels( 0, 0, nTotalAvailable, bOnlyVisible,
62  nSourceID ); //, nChanGroupID
63 
64  // ----------------------------------------------------------------------
65  // Build Response
66  // ----------------------------------------------------------------------
67 
68  DTC::ChannelInfoList *pChannelInfos = new DTC::ChannelInfoList();
69 
70  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, nTotalAvailable ) : 0;
71  nCount = (nCount > 0) ? min(nCount, (nTotalAvailable - nStartIndex)) :
72  (nTotalAvailable - nStartIndex);
73 
74  ChannelInfoList::iterator chanIt;
75  ChannelInfoList::iterator chanItBegin = chanList.begin() + nStartIndex;
76  ChannelInfoList::iterator chanItEnd = chanItBegin + nCount;
77 
78  for( chanIt = chanItBegin; chanIt < chanItEnd; ++chanIt )
79  {
80  DTC::ChannelInfo *pChannelInfo = pChannelInfos->AddNewChannelInfo();
81 
82  ChannelInfo channelInfo = (*chanIt);
83 
84  if (!FillChannelInfo(pChannelInfo, channelInfo, bDetails))
85  {
86  delete pChannelInfo;
87  delete pChannelInfos;
88  throw( QString("Channel ID appears invalid."));
89  }
90  }
91 
92  int nCurPage = 0, nTotalPages = 0;
93  if (nCount == 0)
94  nTotalPages = 1;
95  else
96  nTotalPages = (int)ceil((float)nTotalAvailable / nCount);
97 
98  if (nTotalPages == 1)
99  nCurPage = 1;
100  else
101  {
102  nCurPage = (int)ceil((float)nStartIndex / nCount) + 1;
103  }
104 
105  pChannelInfos->setStartIndex ( nStartIndex );
106  pChannelInfos->setCount ( nCount );
107  pChannelInfos->setCurrentPage ( nCurPage );
108  pChannelInfos->setTotalPages ( nTotalPages );
109  pChannelInfos->setTotalAvailable( nTotalAvailable );
110  pChannelInfos->setAsOf ( MythDate::current() );
111  pChannelInfos->setVersion ( MYTH_BINARY_VERSION );
112  pChannelInfos->setProtoVer ( MYTH_PROTO_VERSION );
113 
114  return pChannelInfos;
115 }
116 
118 //
120 
122 {
123  if (nChanID <= 0)
124  throw( QString("Channel ID appears invalid."));
125 
126  DTC::ChannelInfo *pChannelInfo = new DTC::ChannelInfo();
127 
128  if (!FillChannelInfo(pChannelInfo, nChanID, true))
129  {
130  // throw causes a crash on linux and we can't know in advance
131  // that a channel id from an old recording rule is invalid
132  //throw( QString("Channel ID appears invalid."));
133  }
134 
135  return pChannelInfo;
136 }
137 
139  uint SourceID,
140  uint ChannelID,
141  const QString &CallSign,
142  const QString &ChannelName,
143  const QString &ChannelNumber,
144  uint ServiceID,
145  uint ATSCMajorChannel,
146  uint ATSCMinorChannel,
147  bool UseEIT,
148  bool visible,
149  const QString &FrequencyID,
150  const QString &Icon,
151  const QString &Format,
152  const QString &XMLTVID,
153  const QString &DefaultAuthority )
154 {
155  bool bResult = false;
156 
157  bResult = ChannelUtil::UpdateChannel( MplexID, SourceID, ChannelID,
158  CallSign, ChannelName, ChannelNumber,
159  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
160  UseEIT, !visible, false, FrequencyID,
161  Icon, Format, XMLTVID, DefaultAuthority );
162 
163  return bResult;
164 }
165 
167  uint SourceID,
168  uint ChannelID,
169  const QString &CallSign,
170  const QString &ChannelName,
171  const QString &ChannelNumber,
172  uint ServiceID,
173  uint ATSCMajorChannel,
174  uint ATSCMinorChannel,
175  bool UseEIT,
176  bool visible,
177  const QString &FrequencyID,
178  const QString &Icon,
179  const QString &Format,
180  const QString &XMLTVID,
181  const QString &DefaultAuthority )
182 {
183  bool bResult = false;
184 
185  bResult = ChannelUtil::CreateChannel( MplexID, SourceID, ChannelID,
186  CallSign, ChannelName, ChannelNumber,
187  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
188  UseEIT, !visible, false, FrequencyID,
189  Icon, Format, XMLTVID, DefaultAuthority );
190 
191  return bResult;
192 }
193 
194 bool Channel::RemoveDBChannel( uint nChannelID )
195 {
196  bool bResult = false;
197 
198  bResult = ChannelUtil::DeleteChannel( nChannelID );
199 
200  return bResult;
201 }
202 
204 //
206 
208 {
209  MSqlQuery query(MSqlQuery::InitCon());
210 
211  if (!query.isConnected())
212  throw( QString("Database not open while trying to list "
213  "Video Sources."));
214 
215  query.prepare("SELECT sourceid, name, xmltvgrabber, userid, "
216  "freqtable, lineupid, password, useeit, configpath, "
217  "dvb_nit_id FROM videosource "
218  "ORDER BY sourceid" );
219 
220  if (!query.exec())
221  {
222  MythDB::DBError("MythAPI::GetVideoSourceList()", query);
223 
224  throw( QString( "Database Error executing query." ));
225  }
226 
227  // ----------------------------------------------------------------------
228  // return the results of the query
229  // ----------------------------------------------------------------------
230 
232 
233  while (query.next())
234  {
235 
236  DTC::VideoSource *pVideoSource = pList->AddNewVideoSource();
237 
238  pVideoSource->setId ( query.value(0).toInt() );
239  pVideoSource->setSourceName ( query.value(1).toString() );
240  pVideoSource->setGrabber ( query.value(2).toString() );
241  pVideoSource->setUserId ( query.value(3).toString() );
242  pVideoSource->setFreqTable ( query.value(4).toString() );
243  pVideoSource->setLineupId ( query.value(5).toString() );
244  pVideoSource->setPassword ( query.value(6).toString() );
245  pVideoSource->setUseEIT ( query.value(7).toBool() );
246  pVideoSource->setConfigPath ( query.value(8).toString() );
247  pVideoSource->setNITId ( query.value(9).toInt() );
248  }
249 
250  pList->setAsOf ( MythDate::current() );
251  pList->setVersion ( MYTH_BINARY_VERSION );
252  pList->setProtoVer ( MYTH_PROTO_VERSION );
253 
254  return pList;
255 }
256 
258 //
260 
262 {
263  MSqlQuery query(MSqlQuery::InitCon());
264 
265  if (!query.isConnected())
266  throw( QString("Database not open while trying to list "
267  "Video Sources."));
268 
269  query.prepare("SELECT name, xmltvgrabber, userid, "
270  "freqtable, lineupid, password, useeit, configpath, "
271  "dvb_nit_id FROM videosource WHERE sourceid = :SOURCEID "
272  "ORDER BY sourceid" );
273  query.bindValue(":SOURCEID", nSourceID);
274 
275  if (!query.exec())
276  {
277  MythDB::DBError("MythAPI::GetVideoSource()", query);
278 
279  throw( QString( "Database Error executing query." ));
280  }
281 
282  // ----------------------------------------------------------------------
283  // return the results of the query
284  // ----------------------------------------------------------------------
285 
286  DTC::VideoSource *pVideoSource = new DTC::VideoSource();
287 
288  if (query.next())
289  {
290  pVideoSource->setId ( nSourceID );
291  pVideoSource->setSourceName ( query.value(0).toString() );
292  pVideoSource->setGrabber ( query.value(1).toString() );
293  pVideoSource->setUserId ( query.value(2).toString() );
294  pVideoSource->setFreqTable ( query.value(3).toString() );
295  pVideoSource->setLineupId ( query.value(4).toString() );
296  pVideoSource->setPassword ( query.value(5).toString() );
297  pVideoSource->setUseEIT ( query.value(6).toBool() );
298  pVideoSource->setConfigPath ( query.value(7).toString() );
299  pVideoSource->setNITId ( query.value(8).toInt() );
300  }
301 
302  return pVideoSource;
303 }
304 
306 //
308 
310  const QString &sSourceName,
311  const QString &sGrabber,
312  const QString &sUserId,
313  const QString &sFreqTable,
314  const QString &sLineupId,
315  const QString &sPassword,
316  bool bUseEIT,
317  const QString &sConfigPath,
318  int nNITId )
319 {
320  bool bResult = false;
321 
322  bResult = SourceUtil::UpdateSource(nSourceId, sSourceName, sGrabber, sUserId, sFreqTable,
323  sLineupId, sPassword, bUseEIT, sConfigPath,
324  nNITId);
325 
326  return bResult;
327 }
328 
330 //
332 
333 int Channel::AddVideoSource( const QString &sSourceName,
334  const QString &sGrabber,
335  const QString &sUserId,
336  const QString &sFreqTable,
337  const QString &sLineupId,
338  const QString &sPassword,
339  bool bUseEIT,
340  const QString &sConfigPath,
341  int nNITId )
342 {
343  int nResult = SourceUtil::CreateSource(sSourceName, sGrabber, sUserId, sFreqTable,
344  sLineupId, sPassword, bUseEIT, sConfigPath,
345  nNITId);
346 
347  return nResult;
348 }
349 
351 //
353 
355 {
356  bool bResult = false;
357 
358  bResult = SourceUtil::DeleteSource( nSourceID );
359 
360  return bResult;
361 }
362 
364 //
366 
367 DTC::LineupList* Channel::GetDDLineupList( const QString &sSource,
368  const QString &sUserId,
369  const QString &sPassword )
370 {
371  int source = 0;
372 
373  DTC::LineupList *pLineups = new DTC::LineupList();
374 
375  if (sSource.toLower() == "schedulesdirect1" ||
376  sSource.toLower() == "schedulesdirect" ||
377  sSource.isEmpty())
378  {
379  source = 1;
380  DataDirectProcessor ddp(source, sUserId, sPassword);
381  if (!ddp.GrabLineupsOnly())
382  {
383  delete pLineups;
384  throw( QString("Unable to grab lineups. Check info."));
385  }
386  const DDLineupList lineups = ddp.GetLineups();
387 
388  DDLineupList::const_iterator it;
389  for (it = lineups.begin(); it != lineups.end(); ++it)
390  {
391  DTC::Lineup *pLineup = pLineups->AddNewLineup();
392 
393  pLineup->setLineupId((*it).lineupid);
394  pLineup->setName((*it).name);
395  pLineup->setDisplayName((*it).displayname);
396  pLineup->setType((*it).type);
397  pLineup->setPostal((*it).postal);
398  pLineup->setDevice((*it).device);
399  }
400  }
401 
402  return pLineups;
403 }
404 
406 //
408 
410  const uint nCardId,
411  bool bWaitForFinish )
412 {
413  if ( nSourceId < 1 || nCardId < 1)
414  throw( QString("A source ID and card ID are both required."));
415 
416  int nResult = 0;
417 
418  QString cardtype = CardUtil::GetRawInputType(nCardId);
419 
420  if (!CardUtil::IsUnscanable(cardtype) &&
421  !CardUtil::IsEncoder(cardtype))
422  {
423  throw( QString("This device is incompatible with channel fetching.") );
424  }
425 
426  SourceUtil::UpdateChannelsFromListings(nSourceId, cardtype, bWaitForFinish);
427 
428  if (bWaitForFinish)
429  nResult = SourceUtil::GetChannelCount(nSourceId);
430 
431  return nResult;
432 }
433 
435 //
437 
439  uint nStartIndex,
440  uint nCount )
441 {
442  MSqlQuery query(MSqlQuery::InitCon());
443 
444  if (!query.isConnected())
445  throw( QString("Database not open while trying to list "
446  "Video Sources."));
447 
448  query.prepare("SELECT mplexid, sourceid, transportid, networkid, "
449  "frequency, inversion, symbolrate, fec, polarity, "
450  "modulation, bandwidth, lp_code_rate, transmission_mode, "
451  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
452  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
453  "default_authority FROM dtv_multiplex WHERE sourceid = :SOURCEID "
454  "ORDER BY mplexid" );
455  query.bindValue(":SOURCEID", nSourceID);
456 
457  if (!query.exec())
458  {
459  MythDB::DBError("MythAPI::GetVideoMultiplexList()", query);
460 
461  throw( QString( "Database Error executing query." ));
462  }
463 
464  uint muxCount = (uint)query.size();
465 
466  // ----------------------------------------------------------------------
467  // Build Response
468  // ----------------------------------------------------------------------
469 
470  DTC::VideoMultiplexList *pVideoMultiplexes = new DTC::VideoMultiplexList();
471 
472  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, muxCount ) : 0;
473  nCount = (nCount > 0) ? min( nCount, muxCount ) : muxCount;
474  int nEndIndex = min((nStartIndex + nCount), muxCount );
475 
476  for( int n = nStartIndex; n < nEndIndex; n++)
477  {
478  if (query.seek(n))
479  {
480  DTC::VideoMultiplex *pVideoMultiplex = pVideoMultiplexes->AddNewVideoMultiplex();
481 
482  pVideoMultiplex->setMplexId( query.value(0).toInt() );
483  pVideoMultiplex->setSourceId( query.value(1).toInt() );
484  pVideoMultiplex->setTransportId( query.value(2).toInt() );
485  pVideoMultiplex->setNetworkId( query.value(3).toInt() );
486  pVideoMultiplex->setFrequency( query.value(4).toLongLong() );
487  pVideoMultiplex->setInversion( query.value(5).toString() );
488  pVideoMultiplex->setSymbolRate( query.value(6).toLongLong() );
489  pVideoMultiplex->setFEC( query.value(7).toString() );
490  pVideoMultiplex->setPolarity( query.value(8).toString() );
491  pVideoMultiplex->setModulation( query.value(9).toString() );
492  pVideoMultiplex->setBandwidth( query.value(10).toString() );
493  pVideoMultiplex->setLPCodeRate( query.value(11).toString() );
494  pVideoMultiplex->setTransmissionMode( query.value(12).toString() );
495  pVideoMultiplex->setGuardInterval( query.value(13).toString() );
496  pVideoMultiplex->setVisible( query.value(14).toBool() );
497  pVideoMultiplex->setConstellation( query.value(15).toString() );
498  pVideoMultiplex->setHierarchy( query.value(16).toString() );
499  pVideoMultiplex->setHPCodeRate( query.value(17).toString() );
500  pVideoMultiplex->setModulationSystem( query.value(18).toString() );
501  pVideoMultiplex->setRollOff( query.value(19).toString() );
502  pVideoMultiplex->setSIStandard( query.value(20).toString() );
503  pVideoMultiplex->setServiceVersion( query.value(21).toInt() );
504  pVideoMultiplex->setUpdateTimeStamp(
505  MythDate::as_utc(query.value(22).toDateTime()));
506  pVideoMultiplex->setDefaultAuthority( query.value(23).toString() );
507  }
508  }
509 
510  int curPage = 0, totalPages = 0;
511  if (nCount == 0)
512  totalPages = 1;
513  else
514  totalPages = (int)ceil((float)muxCount / nCount);
515 
516  if (totalPages == 1)
517  curPage = 1;
518  else
519  {
520  curPage = (int)ceil((float)nStartIndex / nCount) + 1;
521  }
522 
523  pVideoMultiplexes->setStartIndex ( nStartIndex );
524  pVideoMultiplexes->setCount ( nCount );
525  pVideoMultiplexes->setCurrentPage ( curPage );
526  pVideoMultiplexes->setTotalPages ( totalPages );
527  pVideoMultiplexes->setTotalAvailable( muxCount );
528  pVideoMultiplexes->setAsOf ( MythDate::current() );
529  pVideoMultiplexes->setVersion ( MYTH_BINARY_VERSION );
530  pVideoMultiplexes->setProtoVer ( MYTH_PROTO_VERSION );
531 
532  return pVideoMultiplexes;
533 }
534 
536 {
537  MSqlQuery query(MSqlQuery::InitCon());
538 
539  if (!query.isConnected())
540  throw( QString("Database not open while trying to list "
541  "Video Multiplex."));
542 
543  query.prepare("SELECT sourceid, transportid, networkid, "
544  "frequency, inversion, symbolrate, fec, polarity, "
545  "modulation, bandwidth, lp_code_rate, transmission_mode, "
546  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
547  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
548  "default_authority FROM dtv_multiplex WHERE mplexid = :MPLEXID "
549  "ORDER BY mplexid" );
550  query.bindValue(":MPLEXID", nMplexID);
551 
552  if (!query.exec())
553  {
554  MythDB::DBError("MythAPI::GetVideoMultiplex()", query);
555 
556  throw( QString( "Database Error executing query." ));
557  }
558 
559  DTC::VideoMultiplex *pVideoMultiplex = new DTC::VideoMultiplex();
560 
561  if (query.next())
562  {
563  pVideoMultiplex->setMplexId( nMplexID );
564  pVideoMultiplex->setSourceId( query.value(0).toInt() );
565  pVideoMultiplex->setTransportId( query.value(1).toInt() );
566  pVideoMultiplex->setNetworkId( query.value(2).toInt() );
567  pVideoMultiplex->setFrequency( query.value(3).toLongLong() );
568  pVideoMultiplex->setInversion( query.value(4).toString() );
569  pVideoMultiplex->setSymbolRate( query.value(5).toLongLong() );
570  pVideoMultiplex->setFEC( query.value(6).toString() );
571  pVideoMultiplex->setPolarity( query.value(7).toString() );
572  pVideoMultiplex->setModulation( query.value(8).toString() );
573  pVideoMultiplex->setBandwidth( query.value(9).toString() );
574  pVideoMultiplex->setLPCodeRate( query.value(10).toString() );
575  pVideoMultiplex->setTransmissionMode( query.value(11).toString() );
576  pVideoMultiplex->setGuardInterval( query.value(12).toString() );
577  pVideoMultiplex->setVisible( query.value(13).toBool() );
578  pVideoMultiplex->setConstellation( query.value(14).toString() );
579  pVideoMultiplex->setHierarchy( query.value(15).toString() );
580  pVideoMultiplex->setHPCodeRate( query.value(16).toString() );
581  pVideoMultiplex->setModulationSystem( query.value(17).toString() );
582  pVideoMultiplex->setRollOff( query.value(18).toString() );
583  pVideoMultiplex->setSIStandard( query.value(19).toString() );
584  pVideoMultiplex->setServiceVersion( query.value(20).toInt() );
585  pVideoMultiplex->setUpdateTimeStamp(
586  MythDate::as_utc(query.value(21).toDateTime()));
587  pVideoMultiplex->setDefaultAuthority( query.value(22).toString() );
588  }
589 
590  return pVideoMultiplex;
591 }
592 
594 //
596 
598 {
599  MSqlQuery query(MSqlQuery::InitCon());
600 
601  if (!query.isConnected())
602  throw( QString("Database not open while trying to get source name."));
603 
604  query.prepare("SELECT name FROM videosource WHERE sourceid = :SOURCEID ");
605  query.bindValue(":SOURCEID", SourceID);
606 
607  if (!query.exec())
608  {
609  MythDB::DBError("MythAPI::GetXMLTVIdList()", query);
610 
611  throw( QString( "Database Error executing query." ));
612  }
613 
614  QStringList idList;
615 
616  if (query.next())
617  {
618  QString sourceName = query.value(0).toString();
619 
620  QString xmltvFile = GetConfDir() + '/' + sourceName + ".xmltv";
621 
622  if (QFile::exists(xmltvFile))
623  {
624  QFile file(xmltvFile);
625  if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
626  return idList;
627 
628  while (!file.atEnd())
629  {
630  QByteArray line = file.readLine();
631 
632  if (line.startsWith("channel="))
633  {
634  QString id = line.mid(8, -1).trimmed();
635  idList.append(id);
636  }
637  }
638 
639  idList.sort();
640  }
641  }
642  else
643  throw(QString("SourceID (%1) not found").arg(SourceID));
644 
645  return idList;
646 }
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:785
void bindValue(const QString &placeholder, const QVariant &val)
Definition: mythdbcon.cpp:884
QStringList GetXMLTVIdList(uint SourceID)
Definition: channel.cpp:597
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:138
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:438
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::null, QString format="Default", QString xmltvid=QString::null, QString default_authority=QString::null)
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:27
static bool IsEncoder(const QString &rawtype)
Definition: cardutil.h:123
QString GetConfDir(void)
Definition: mythdirs.cpp:212
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:343
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
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
struct v4l2_mpeg_vbi_itv0_line line[35]
Definition: videodev2.h:1039
bool RemoveVideoSource(uint SourceID)
Definition: channel.cpp:354
VideoMultiplex * AddNewVideoMultiplex()
static MSqlQueryInfo InitCon(ConnectionReuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:542
DTC::ChannelInfoList * GetChannelInfoList(uint SourceID, uint StartIndex, uint Count, bool OnlyVisible, bool Details)
Definition: channel.cpp:50
vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:121
bool RemoveDBChannel(uint ChannelID)
Definition: channel.cpp:194
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:810
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:166
DTC::ChannelInfo * GetChannelInfo(uint ChanID)
Definition: channel.cpp:121
vector< DataDirectLineup > DDLineupList
Definition: datadirect.h:299
bool seek(int, bool relative=false)
Wrap QSqlQuery::seek(int,bool)
Definition: mythdbcon.cpp:805
static bool UpdateChannelsFromListings(uint sourceid, QString inputtype=QString::null, bool wait=false)
Definition: sourceutil.cpp:362
DTC::LineupList * GetDDLineupList(const QString &Source, const QString &UserId, const QString &Password)
Definition: channel.cpp:367
DTC::VideoMultiplex * GetVideoMultiplex(uint MplexID)
Definition: channel.cpp:535
DTC::VideoSource * GetVideoSource(uint SourceID)
Definition: channel.cpp:261
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:271
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:309
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:333
int FetchChannelsFromSource(const uint SourceId, const uint CardId, bool WaitForFinish)
Definition: channel.cpp:409
ChannelInfo * AddNewChannelInfo()
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:610
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:181
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::null, QString icon=QString::null, QString format=QString::null, QString xmltvid=QString::null, QString default_authority=QString::null)
Lineup * AddNewLineup()
Definition: lineup.h:105
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:207