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