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