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