MythTV  master
v2channel.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 // C++
28 #include <cmath>
29 
30 // Qt
31 #include <QList>
32 
33 // MythTV
35 #include "libmythbase/compat.h"
36 #include "libmythbase/mythdbcon.h"
37 #include "libmythbase/mythdirs.h"
38 #include "libmythbase/mythversion.h"
41 #include "libmythtv/channelutil.h"
46 #include "libmythtv/sourceutil.h"
47 #include "libmythtv/cardutil.h"
48 #include "libmythbase/mythdate.h"
49 #include "libmythtv/frequencies.h"
51 
52 // MythBackend
53 #include "v2artworkInfoList.h"
54 #include "v2castMemberList.h"
55 #include "v2channel.h"
56 #include "v2programAndChannel.h"
57 #include "v2recording.h"
58 #include "v2serviceUtil.h"
59 #include "v2grabber.h"
60 #include "v2freqtable.h"
61 
63 //
65 
67 (CHANNEL_HANDLE, V2Channel::staticMetaObject, &V2Channel::RegisterCustomTypes))
68 
70 {
71  qRegisterMetaType<V2ChannelInfoList*>("V2ChannelInfoList");
72  qRegisterMetaType<V2ChannelInfo*>("V2ChannelInfo");
73  qRegisterMetaType<V2VideoSourceList*>("V2VideoSourceList");
74  qRegisterMetaType<V2VideoSource*>("V2VideoSource");
75  qRegisterMetaType<V2LineupList*>("V2LineupList");
76  qRegisterMetaType<V2Lineup*>("V2Lineup");
77  qRegisterMetaType<V2VideoMultiplexList*>("V2VideoMultiplexList");
78  qRegisterMetaType<V2VideoMultiplex*>("V2VideoMultiplex");
79  qRegisterMetaType<V2Program*>("V2Program");
80  qRegisterMetaType<V2RecordingInfo*>("V2RecordingInfo");
81  qRegisterMetaType<V2ArtworkInfoList*>("V2ArtworkInfoList");
82  qRegisterMetaType<V2ArtworkInfo*>("V2ArtworkInfo");
83  qRegisterMetaType<V2CastMemberList*>("V2CastMemberList");
84  qRegisterMetaType<V2CastMember*>("V2CastMember");
85  qRegisterMetaType<V2Grabber*>("V2Grabber");
86  qRegisterMetaType<V2GrabberList*>("V2GrabberList");
87  qRegisterMetaType<V2FreqTableList*>("V2FreqTableList");
88  qRegisterMetaType<V2CommMethodList*>("V2CommMethodList");
89  qRegisterMetaType<V2CommMethod*>("V2CommMethod");
90  qRegisterMetaType<V2ScanStatus*>("V2ScanStatus");
91  qRegisterMetaType<V2Scan*>("V2Scan");
92  qRegisterMetaType<V2ScanList*>("V2ScanList");
93 }
94 
96 {
97 }
98 
99 
100 
102  uint nChannelGroupID,
103  uint nStartIndex,
104  uint nCount,
105  bool bOnlyVisible,
106  bool bDetails,
107  bool bOrderByName,
108  bool bGroupByCallsign,
109  bool bOnlyTunable )
110 {
111  ChannelInfoList chanList;
112 
113  uint nTotalAvailable = 0;
114 
115  chanList = ChannelUtil::LoadChannels( 0, 0, nTotalAvailable, bOnlyVisible,
118  nSourceID, nChannelGroupID, false, "",
119  "", bOnlyTunable);
120 
121  // ----------------------------------------------------------------------
122  // Build Response
123  // ----------------------------------------------------------------------
124 
125  auto *pChannelInfos = new V2ChannelInfoList();
126 
127  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, nTotalAvailable ) : 0;
128  nCount = (nCount > 0) ? std::min(nCount, (nTotalAvailable - nStartIndex)) :
129  (nTotalAvailable - nStartIndex);
130 
131  ChannelInfoList::iterator chanIt;
132  auto chanItBegin = chanList.begin() + nStartIndex;
133  auto chanItEnd = chanItBegin + nCount;
134 
135  for( chanIt = chanItBegin; chanIt < chanItEnd; ++chanIt )
136  {
137  V2ChannelInfo *pChannelInfo = pChannelInfos->AddNewChannelInfo();
138 
139  ChannelInfo channelInfo = (*chanIt);
140 
141  if (!V2FillChannelInfo(pChannelInfo, channelInfo, bDetails))
142  {
143  delete pChannelInfo;
144  delete pChannelInfos;
145  throw( QString("V2Channel ID appears invalid."));
146  }
147  }
148 
149  int nCurPage = 0;
150  int nTotalPages = 0;
151  if (nCount == 0)
152  nTotalPages = 1;
153  else
154  nTotalPages = (int)std::ceil((float)nTotalAvailable / nCount);
155 
156  if (nTotalPages == 1)
157  nCurPage = 1;
158  else
159  {
160  nCurPage = (int)std::ceil((float)nStartIndex / nCount) + 1;
161  }
162 
163  pChannelInfos->setStartIndex ( nStartIndex );
164  pChannelInfos->setCount ( nCount );
165  pChannelInfos->setCurrentPage ( nCurPage );
166  pChannelInfos->setTotalPages ( nTotalPages );
167  pChannelInfos->setTotalAvailable( nTotalAvailable );
168  pChannelInfos->setAsOf ( MythDate::current() );
169  pChannelInfos->setVersion ( MYTH_BINARY_VERSION );
170  pChannelInfos->setProtoVer ( MYTH_PROTO_VERSION );
171 
172  return pChannelInfos;
173 }
174 
176 //
178 
180 {
181  if (nChanID == 0)
182  throw( QString("V2Channel ID appears invalid."));
183 
184  auto *pChannelInfo = new V2ChannelInfo();
185 
186  if (!V2FillChannelInfo(pChannelInfo, nChanID, true))
187  {
188  // throw causes a crash on linux and we can't know in advance
189  // that a channel id from an old recording rule is invalid
190  //throw( QString("V2Channel ID appears invalid."));
191  }
192 
193  return pChannelInfo;
194 }
195 
197  uint SourceID,
198  uint ChannelID,
199  const QString &CallSign,
200  const QString &ChannelName,
201  const QString &ChannelNumber,
202  uint ServiceID,
203  uint ATSCMajorChannel,
204  uint ATSCMinorChannel,
205  bool UseEIT,
206  bool Visible,
207  const QString &ExtendedVisible,
208  const QString &FrequencyID,
209  const QString &Icon,
210  const QString &Format,
211  const QString &XMLTVID,
212  const QString &DefaultAuthority,
213  uint ServiceType,
214  int RecPriority,
215  int TimeOffset,
216  int CommMethod )
217 {
218  if (!HAS_PARAMv2("ChannelID"))
219  throw QString("ChannelId is required");
220 
221  if (m_request->m_queries.size() < 2 )
222  throw QString("Nothing to update");
223 
224  ChannelInfo channel;
225  if (!channel.Load(ChannelID))
226  throw QString("ChannelId %1 doesn't exist");
227 
228  if (HAS_PARAMv2("MplexID"))
229  channel.m_mplexId = MplexID;
230  if (HAS_PARAMv2("SourceID"))
231  channel.m_sourceId = SourceID;
232  if (HAS_PARAMv2("CallSign"))
233  channel.m_callSign = CallSign;
234  if (HAS_PARAMv2("ChannelName"))
235  channel.m_name = ChannelName;
236  if (HAS_PARAMv2("ChannelNumber"))
237  channel.m_chanNum = ChannelNumber;
238  if (HAS_PARAMv2("ServiceID"))
239  channel.m_serviceId = ServiceID;
240  if (HAS_PARAMv2("ATSCMajorChannel"))
241  channel.m_atscMajorChan = ATSCMajorChannel;
242  if (HAS_PARAMv2("ATSCMinorChannel"))
243  channel.m_atscMinorChan = ATSCMinorChannel;
244  if (HAS_PARAMv2("UseEIT"))
245  channel.m_useOnAirGuide = UseEIT;
246  if (HAS_PARAMv2("ExtendedVisible"))
247  channel.m_visible = channelVisibleTypeFromString(ExtendedVisible);
248  else if (HAS_PARAMv2("Visible"))
249  {
250  if (channel.m_visible == kChannelVisible ||
251  channel.m_visible == kChannelNotVisible)
252  {
253  channel.m_visible =
255  }
256  else if ((channel.m_visible == kChannelAlwaysVisible && !Visible) ||
257  (channel.m_visible == kChannelNeverVisible && Visible))
258  {
259  throw QString("Can't override Always/NeverVisible");
260  }
261  }
262  if (HAS_PARAMv2("FrequencyID"))
263  channel.m_freqId = FrequencyID;
264  if (HAS_PARAMv2("Icon"))
265  channel.m_icon = Icon;
266  if (HAS_PARAMv2("Format"))
267  channel.m_tvFormat = Format;
268  if (HAS_PARAMv2("XMLTVID"))
269  channel.m_xmltvId = XMLTVID;
270  if (HAS_PARAMv2("DefaultAuthority"))
271  channel.m_defaultAuthority = DefaultAuthority;
272  if (HAS_PARAMv2("servicetype"))
273  channel.m_serviceType = ServiceType;
274  if (HAS_PARAMv2("RecPriority"))
275  channel.m_recPriority = RecPriority;
276  if (HAS_PARAMv2("TimeOffset"))
277  channel.m_tmOffset = TimeOffset;
278  if (HAS_PARAMv2("CommMethod"))
279  channel.m_commMethod = CommMethod;
280  bool bResult = ChannelUtil::UpdateChannel(
281  channel.m_mplexId, channel.m_sourceId, channel.m_chanId,
282  channel.m_callSign, channel.m_name, channel.m_chanNum,
283  channel.m_serviceId, channel.m_atscMajorChan,
284  channel.m_atscMinorChan, channel.m_useOnAirGuide,
285  channel.m_visible, channel.m_freqId,
286  channel.m_icon, channel.m_tvFormat, channel.m_xmltvId,
287  channel.m_defaultAuthority, channel.m_serviceType,
288  channel.m_recPriority, channel.m_tmOffset, channel.m_commMethod );
289 
290  return bResult;
291 }
292 
293 
295  uint chanId = 0;
296 
297  MSqlQuery query(MSqlQuery::InitCon());
298  query.prepare("SELECT MAX(chanid) FROM channel");
299  if (!query.exec())
300  {
301  MythDB::DBError("V2Channel::AddDBChannel", query);
302  throw( QString( "Database Error executing query." ));
303  }
304  if (query.next())
305  chanId = query.value(0).toUInt() + 1;
306  if (chanId < 1000)
307  chanId = 1000;
308  return chanId;
309 }
310 
312  uint SourceID,
313  uint ChannelID,
314  const QString &CallSign,
315  const QString &ChannelName,
316  const QString &ChannelNumber,
317  uint ServiceID,
318  uint ATSCMajorChannel,
319  uint ATSCMinorChannel,
320  bool UseEIT,
321  bool Visible,
322  const QString &ExtendedVisible,
323  const QString &FrequencyID,
324  const QString &Icon,
325  const QString &Format,
326  const QString &XMLTVID,
327  const QString &DefaultAuthority,
328  uint ServiceType,
329  int RecPriority,
330  int TimeOffset,
331  int CommMethod )
332 {
333  ChannelVisibleType chan_visible = kChannelVisible;
334  if (HAS_PARAMv2("ExtendedVisible"))
335  chan_visible = channelVisibleTypeFromString(ExtendedVisible);
336  else if (HAS_PARAMv2("Visible"))
337  chan_visible = (Visible ? kChannelVisible : kChannelNotVisible);
338 
339  bool bResult = ChannelUtil::CreateChannel( MplexID, SourceID, ChannelID,
340  CallSign, ChannelName, ChannelNumber,
341  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
342  UseEIT, chan_visible, FrequencyID,
343  Icon, Format, XMLTVID, DefaultAuthority,
344  ServiceType, RecPriority, TimeOffset, CommMethod );
345 
346  return bResult;
347 }
348 
350 {
351  bool bResult = ChannelUtil::DeleteChannel( nChannelID );
352 
353  return bResult;
354 }
355 
356 
358 {
359  auto* pList = new V2CommMethodList();
360 
361  std::deque<int> tmp = GetPreferredSkipTypeCombinations();
362  tmp.push_front(COMM_DETECT_UNINIT);
363  tmp.push_back(COMM_DETECT_COMMFREE);
364 
365  for (int pref : tmp)
366  {
367  V2CommMethod* pCommMethod = pList->AddNewCommMethod();
368  pCommMethod->setCommMethod(pref);
369  pCommMethod->setLocalizedName(SkipTypeToString(pref));
370  }
371  return pList;
372 }
373 
374 
376 //
378 
380 {
381  MSqlQuery query(MSqlQuery::InitCon());
382 
383  if (!query.isConnected())
384  throw( QString("Database not open while trying to list "
385  "Video Sources."));
386 
387  query.prepare("SELECT sourceid, name, xmltvgrabber, userid, "
388  "freqtable, lineupid, password, useeit, configpath, "
389  "dvb_nit_id, bouquet_id, region_id, scanfrequency, "
390  "lcnoffset FROM videosource "
391  "ORDER BY sourceid" );
392 
393  if (!query.exec())
394  {
395  MythDB::DBError("MythAPI::GetVideoSourceList()", query);
396 
397  throw( QString( "Database Error executing query." ));
398  }
399 
400  // ----------------------------------------------------------------------
401  // return the results of the query
402  // ----------------------------------------------------------------------
403 
404  auto* pList = new V2VideoSourceList();
405 
406  while (query.next())
407  {
408 
409  V2VideoSource *pVideoSource = pList->AddNewVideoSource();
410 
411  pVideoSource->setId ( query.value(0).toInt() );
412  pVideoSource->setSourceName ( query.value(1).toString() );
413  pVideoSource->setGrabber ( query.value(2).toString() );
414  pVideoSource->setUserId ( query.value(3).toString() );
415  pVideoSource->setFreqTable ( query.value(4).toString() );
416  pVideoSource->setLineupId ( query.value(5).toString() );
417  pVideoSource->setPassword ( query.value(6).toString() );
418  pVideoSource->setUseEIT ( query.value(7).toBool() );
419  pVideoSource->setConfigPath ( query.value(8).toString() );
420  pVideoSource->setNITId ( query.value(9).toInt() );
421  pVideoSource->setBouquetId ( query.value(10).toUInt() );
422  pVideoSource->setRegionId ( query.value(11).toUInt() );
423  pVideoSource->setScanFrequency ( query.value(12).toUInt() );
424  pVideoSource->setLCNOffset ( query.value(13).toUInt() );
425  }
426 
427  pList->setAsOf ( MythDate::current() );
428  pList->setVersion ( MYTH_BINARY_VERSION );
429  pList->setProtoVer ( MYTH_PROTO_VERSION );
430 
431  return pList;
432 }
433 
435 //
437 
439 {
440  MSqlQuery query(MSqlQuery::InitCon());
441 
442  if (!query.isConnected())
443  throw( QString("Database not open while trying to list "
444  "Video Sources."));
445 
446  query.prepare("SELECT name, xmltvgrabber, userid, "
447  "freqtable, lineupid, password, useeit, configpath, "
448  "dvb_nit_id, bouquet_id, region_id, scanfrequency, "
449  "lcnoffset "
450  "FROM videosource WHERE sourceid = :SOURCEID "
451  "ORDER BY sourceid" );
452  query.bindValue(":SOURCEID", nSourceID);
453 
454  if (!query.exec())
455  {
456  MythDB::DBError("MythAPI::GetVideoSource()", query);
457 
458  throw( QString( "Database Error executing query." ));
459  }
460 
461  // ----------------------------------------------------------------------
462  // return the results of the query
463  // ----------------------------------------------------------------------
464 
465  auto *pVideoSource = new V2VideoSource();
466 
467  if (query.next())
468  {
469  pVideoSource->setId ( nSourceID );
470  pVideoSource->setSourceName ( query.value(0).toString() );
471  pVideoSource->setGrabber ( query.value(1).toString() );
472  pVideoSource->setUserId ( query.value(2).toString() );
473  pVideoSource->setFreqTable ( query.value(3).toString() );
474  pVideoSource->setLineupId ( query.value(4).toString() );
475  pVideoSource->setPassword ( query.value(5).toString() );
476  pVideoSource->setUseEIT ( query.value(6).toBool() );
477  pVideoSource->setConfigPath ( query.value(7).toString() );
478  pVideoSource->setNITId ( query.value(8).toInt() );
479  pVideoSource->setBouquetId ( query.value(9).toUInt() );
480  pVideoSource->setRegionId ( query.value(10).toUInt() );
481  pVideoSource->setScanFrequency ( query.value(11).toUInt() );
482  pVideoSource->setLCNOffset ( query.value(12).toUInt() );
483  }
484 
485  return pVideoSource;
486 }
487 
489 //
491 
493  const QString &sSourceName,
494  const QString &sGrabber,
495  const QString &sUserId,
496  const QString &sFreqTable,
497  const QString &sLineupId,
498  const QString &sPassword,
499  bool bUseEIT,
500  const QString &sConfigPath,
501  int nNITId,
502  uint nBouquetId,
503  uint nRegionId,
504  uint nScanFrequency,
505  uint nLCNOffset )
506 {
507 
508  if (!HAS_PARAMv2("SourceID"))
509  {
510  LOG(VB_GENERAL, LOG_ERR, "SourceId is required");
511  return false;
512  }
513 
514  if (!SourceUtil::IsSourceIDValid(nSourceId))
515  {
516  LOG(VB_GENERAL, LOG_ERR, QString("SourceId %1 doesn't exist")
517  .arg(nSourceId));
518  return false;
519  }
520 
521  if (m_request->m_queries.size() < 2 )
522  {
523  LOG(VB_GENERAL, LOG_ERR, QString("SourceId=%1 was the only parameter")
524  .arg(nSourceId));
525  return false;
526  }
527 
528  MSqlBindings bindings;
529  MSqlBindings::const_iterator it;
530  QString settings;
531 
532  if ( HAS_PARAMv2("SourceName") )
533  ADD_SQLv2(settings, bindings, "name", "SourceName", sSourceName);
534 
535  if ( HAS_PARAMv2("Grabber") )
536  ADD_SQLv2(settings, bindings, "xmltvgrabber", "Grabber", sGrabber);
537 
538  if ( HAS_PARAMv2("UserId") )
539  ADD_SQLv2(settings, bindings, "userid", "UserId", sUserId);
540 
541  if ( HAS_PARAMv2("FreqTable") )
542  ADD_SQLv2(settings, bindings, "freqtable", "FreqTable", sFreqTable);
543 
544  if ( HAS_PARAMv2("LineupId") )
545  ADD_SQLv2(settings, bindings, "lineupid", "LineupId", sLineupId);
546 
547  if ( HAS_PARAMv2("Password") )
548  ADD_SQLv2(settings, bindings, "password", "Password", sPassword);
549 
550  if ( HAS_PARAMv2("UseEIT") )
551  ADD_SQLv2(settings, bindings, "useeit", "UseEIT", bUseEIT);
552 
553  if (HAS_PARAMv2("ConfigPath"))
554  {
555  if (sConfigPath.isEmpty())
556  settings += "configpath=NULL, "; // mythfilldatabase grabber requirement
557  else
558  ADD_SQLv2(settings, bindings, "configpath", "ConfigPath", sConfigPath);
559  }
560 
561  if ( HAS_PARAMv2("NITId") )
562  ADD_SQLv2(settings, bindings, "dvb_nit_id", "NITId", nNITId);
563 
564  if ( HAS_PARAMv2("BouquetId") )
565  ADD_SQLv2(settings, bindings, "bouquet_id", "BouquetId", nBouquetId);
566 
567  if ( HAS_PARAMv2("RegionId") )
568  ADD_SQLv2(settings, bindings, "region_id", "RegionId", nRegionId);
569 
570  if ( HAS_PARAMv2("ScanFrequency") )
571  ADD_SQLv2(settings, bindings, "scanfrequency", "ScanFrequency", nScanFrequency);
572 
573  if ( HAS_PARAMv2("LCNOffset") )
574  ADD_SQLv2(settings, bindings, "lcnoffset", "LCNOffset", nLCNOffset);
575 
576  if ( settings.isEmpty() )
577  {
578  LOG(VB_GENERAL, LOG_ERR, "No valid parameters were passed");
579  return false;
580  }
581 
582  settings.chop(2);
583 
584  MSqlQuery query(MSqlQuery::InitCon());
585 
586  query.prepare(QString("UPDATE videosource SET %1 WHERE sourceid=:SOURCEID")
587  .arg(settings));
588  bindings[":SOURCEID"] = nSourceId;
589 
590  for (it = bindings.cbegin(); it != bindings.cend(); ++it)
591  query.bindValue(it.key(), it.value());
592 
593  if (!query.exec())
594  {
595  MythDB::DBError("MythAPI::UpdateVideoSource()", query);
596 
597  throw( QString( "Database Error executing query." ));
598  }
599 
600  return true;
601 }
602 
604 //
606 
607 int V2Channel::AddVideoSource( const QString &sSourceName,
608  const QString &sGrabber,
609  const QString &sUserId,
610  const QString &sFreqTable,
611  const QString &sLineupId,
612  const QString &sPassword,
613  bool bUseEIT,
614  const QString &sConfigPath,
615  int nNITId,
616  uint nBouquetId,
617  uint nRegionId,
618  uint nScanFrequency,
619  uint nLCNOffset )
620 {
621  int nResult = SourceUtil::CreateSource(sSourceName, sGrabber, sUserId, sFreqTable,
622  sLineupId, sPassword, bUseEIT, sConfigPath,
623  nNITId, nBouquetId, nRegionId, nScanFrequency,
624  nLCNOffset);
625 
626  return nResult;
627 }
628 
630 //
632 
634 {
635  bool bResult = SourceUtil::DeleteAllSources();
636 
637  return bResult;
638 }
639 
641 {
642  bool bResult = SourceUtil::DeleteSource( nSourceID );
643 
644  return bResult;
645 }
646 
648 //
650 
651 V2LineupList* V2Channel::GetDDLineupList( const QString &/*sSource*/,
652  const QString &/*sUserId*/,
653  const QString &/*sPassword*/ )
654 {
655  auto *pLineups = new V2LineupList();
656  return pLineups;
657 }
658 
660 //
662 
664  const uint nCardId,
665  bool bWaitForFinish )
666 {
667  if ( nSourceId < 1 || nCardId < 1)
668  throw( QString("A source ID and card ID are both required."));
669 
670  int nResult = 0;
671 
672  QString cardtype = CardUtil::GetRawInputType(nCardId);
673 
674  // These tests commented because they prevent fetching channels for CETON
675  // cable card device, which is compatible with fetching and requires fetching.
676  // if (!CardUtil::IsUnscanable(cardtype) &&
677  // !CardUtil::IsEncoder(cardtype))
678  // {
679  // throw( QString("This device is incompatible with channel fetching.") );
680  // }
681 
682  SourceUtil::UpdateChannelsFromListings(nSourceId, cardtype, bWaitForFinish);
683 
684  if (bWaitForFinish)
685  nResult = SourceUtil::GetChannelCount(nSourceId);
686 
687  return nResult;
688 }
689 
691 //
693 
695  uint nStartIndex,
696  uint nCount )
697 {
698  MSqlQuery query(MSqlQuery::InitCon());
699 
700  if (!query.isConnected())
701  throw( QString("Database not open while trying to list "
702  "Video Sources."));
703 
704  query.prepare("SELECT mplexid, sourceid, transportid, networkid, "
705  "frequency, inversion, symbolrate, fec, polarity, "
706  "modulation, bandwidth, lp_code_rate, transmission_mode, "
707  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
708  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
709  "default_authority FROM dtv_multiplex WHERE sourceid = :SOURCEID "
710  "ORDER BY mplexid" );
711  query.bindValue(":SOURCEID", nSourceID);
712 
713  if (!query.exec())
714  {
715  MythDB::DBError("MythAPI::GetVideoMultiplexList()", query);
716 
717  throw( QString( "Database Error executing query." ));
718  }
719 
720  uint muxCount = (uint)query.size();
721 
722  // ----------------------------------------------------------------------
723  // Build Response
724  // ----------------------------------------------------------------------
725 
726  auto *pVideoMultiplexes = new V2VideoMultiplexList();
727 
728  nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, muxCount ) : 0;
729  nCount = (nCount > 0) ? std::min( nCount, muxCount ) : muxCount;
730  int nEndIndex = std::min((nStartIndex + nCount), muxCount );
731 
732  for( int n = nStartIndex; n < nEndIndex; n++)
733  {
734  if (query.seek(n))
735  {
736  V2VideoMultiplex *pVideoMultiplex = pVideoMultiplexes->AddNewVideoMultiplex();
737 
738  pVideoMultiplex->setMplexId( query.value(0).toInt() );
739  pVideoMultiplex->setSourceId( query.value(1).toInt() );
740  pVideoMultiplex->setTransportId( query.value(2).toInt() );
741  pVideoMultiplex->setNetworkId( query.value(3).toInt() );
742  pVideoMultiplex->setFrequency( query.value(4).toLongLong() );
743  pVideoMultiplex->setInversion( query.value(5).toString() );
744  pVideoMultiplex->setSymbolRate( query.value(6).toLongLong() );
745  pVideoMultiplex->setFEC( query.value(7).toString() );
746  pVideoMultiplex->setPolarity( query.value(8).toString() );
747  pVideoMultiplex->setModulation( query.value(9).toString() );
748  pVideoMultiplex->setBandwidth( query.value(10).toString() );
749  pVideoMultiplex->setLPCodeRate( query.value(11).toString() );
750  pVideoMultiplex->setTransmissionMode( query.value(12).toString() );
751  pVideoMultiplex->setGuardInterval( query.value(13).toString() );
752  pVideoMultiplex->setVisible( query.value(14).toBool() );
753  pVideoMultiplex->setConstellation( query.value(15).toString() );
754  pVideoMultiplex->setHierarchy( query.value(16).toString() );
755  pVideoMultiplex->setHPCodeRate( query.value(17).toString() );
756  pVideoMultiplex->setModulationSystem( query.value(18).toString() );
757  pVideoMultiplex->setRollOff( query.value(19).toString() );
758  pVideoMultiplex->setSIStandard( query.value(20).toString() );
759  pVideoMultiplex->setServiceVersion( query.value(21).toInt() );
760  pVideoMultiplex->setUpdateTimeStamp(
761  MythDate::as_utc(query.value(22).toDateTime()));
762  pVideoMultiplex->setDefaultAuthority( query.value(23).toString() );
763 
764  // Code from libs/libmythtv/channelscan/multiplexsetting.cpp:53
765  QString DisplayText;
766  if (query.value(9).toString() == "8vsb") //modulation
767  {
768  QString ChannelNumber =
769  // value(4) = frequency
770  QString("Freq %1").arg(query.value(4).toInt());
771  int findFrequency = (query.value(4).toInt() / 1000) - 1750;
772  for (const auto & list : gChanLists[0].list)
773  {
774  if ((list.freq <= findFrequency + 200) &&
775  (list.freq >= findFrequency - 200))
776  {
777  ChannelNumber = QString("%1").arg(list.name);
778  }
779  }
780  //: %1 is the channel number
781  DisplayText = tr("ATSC Channel %1").arg(ChannelNumber);
782  }
783  else
784  {
785  DisplayText = QString("%1 Hz (%2) (%3) (%4)")
786  .arg(query.value(4).toString(), // frequency
787  query.value(6).toString(), // symbolrate
788  query.value(3).toString(), // networkid
789  query.value(2).toString()); // transportid
790  }
791  pVideoMultiplex->setDescription(DisplayText);
792  }
793  }
794 
795  int curPage = 0;
796  int totalPages = 0;
797  if (nCount == 0)
798  totalPages = 1;
799  else
800  totalPages = (int)std::ceil((float)muxCount / nCount);
801 
802  if (totalPages == 1)
803  curPage = 1;
804  else
805  {
806  curPage = (int)std::ceil((float)nStartIndex / nCount) + 1;
807  }
808 
809  pVideoMultiplexes->setStartIndex ( nStartIndex );
810  pVideoMultiplexes->setCount ( nCount );
811  pVideoMultiplexes->setCurrentPage ( curPage );
812  pVideoMultiplexes->setTotalPages ( totalPages );
813  pVideoMultiplexes->setTotalAvailable( muxCount );
814  pVideoMultiplexes->setAsOf ( MythDate::current() );
815  pVideoMultiplexes->setVersion ( MYTH_BINARY_VERSION );
816  pVideoMultiplexes->setProtoVer ( MYTH_PROTO_VERSION );
817 
818  return pVideoMultiplexes;
819 }
820 
822 {
823  MSqlQuery query(MSqlQuery::InitCon());
824 
825  if (!query.isConnected())
826  throw( QString("Database not open while trying to list "
827  "Video Multiplex."));
828 
829  query.prepare("SELECT sourceid, transportid, networkid, "
830  "frequency, inversion, symbolrate, fec, polarity, "
831  "modulation, bandwidth, lp_code_rate, transmission_mode, "
832  "guard_interval, visible, constellation, hierarchy, hp_code_rate, "
833  "mod_sys, rolloff, sistandard, serviceversion, updatetimestamp, "
834  "default_authority FROM dtv_multiplex WHERE mplexid = :MPLEXID "
835  "ORDER BY mplexid" );
836  query.bindValue(":MPLEXID", nMplexID);
837 
838  if (!query.exec())
839  {
840  MythDB::DBError("MythAPI::GetVideoMultiplex()", query);
841 
842  throw( QString( "Database Error executing query." ));
843  }
844 
845  auto *pVideoMultiplex = new V2VideoMultiplex();
846 
847  if (query.next())
848  {
849  pVideoMultiplex->setMplexId( nMplexID );
850  pVideoMultiplex->setSourceId( query.value(0).toInt() );
851  pVideoMultiplex->setTransportId( query.value(1).toInt() );
852  pVideoMultiplex->setNetworkId( query.value(2).toInt() );
853  pVideoMultiplex->setFrequency( query.value(3).toLongLong() );
854  pVideoMultiplex->setInversion( query.value(4).toString() );
855  pVideoMultiplex->setSymbolRate( query.value(5).toLongLong() );
856  pVideoMultiplex->setFEC( query.value(6).toString() );
857  pVideoMultiplex->setPolarity( query.value(7).toString() );
858  pVideoMultiplex->setModulation( query.value(8).toString() );
859  pVideoMultiplex->setBandwidth( query.value(9).toString() );
860  pVideoMultiplex->setLPCodeRate( query.value(10).toString() );
861  pVideoMultiplex->setTransmissionMode( query.value(11).toString() );
862  pVideoMultiplex->setGuardInterval( query.value(12).toString() );
863  pVideoMultiplex->setVisible( query.value(13).toBool() );
864  pVideoMultiplex->setConstellation( query.value(14).toString() );
865  pVideoMultiplex->setHierarchy( query.value(15).toString() );
866  pVideoMultiplex->setHPCodeRate( query.value(16).toString() );
867  pVideoMultiplex->setModulationSystem( query.value(17).toString() );
868  pVideoMultiplex->setRollOff( query.value(18).toString() );
869  pVideoMultiplex->setSIStandard( query.value(19).toString() );
870  pVideoMultiplex->setServiceVersion( query.value(20).toInt() );
871  pVideoMultiplex->setUpdateTimeStamp(
872  MythDate::as_utc(query.value(21).toDateTime()));
873  pVideoMultiplex->setDefaultAuthority( query.value(22).toString() );
874  }
875 
876  return pVideoMultiplex;
877 }
878 
880 //
882 
884 {
885  MSqlQuery query(MSqlQuery::InitCon());
886 
887  if (!query.isConnected())
888  throw( QString("Database not open while trying to get source name."));
889 
890  query.prepare("SELECT name FROM videosource WHERE sourceid = :SOURCEID ");
891  query.bindValue(":SOURCEID", SourceID);
892 
893  if (!query.exec())
894  {
895  MythDB::DBError("MythAPI::GetXMLTVIdList()", query);
896 
897  throw( QString( "Database Error executing query." ));
898  }
899 
900  QStringList idList;
901 
902  if (query.next())
903  {
904  QString sourceName = query.value(0).toString();
905 
906  QString xmltvFile = GetConfDir() + '/' + sourceName + ".xmltv";
907 
908  if (QFile::exists(xmltvFile))
909  {
910  QFile file(xmltvFile);
911  if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
912  return idList;
913 
914  while (!file.atEnd())
915  {
916  QByteArray line = file.readLine();
917 
918  if (line.startsWith("channel="))
919  {
920  QString id = line.mid(8, -1).trimmed();
921  idList.append(id);
922  }
923  }
924 
925  idList.sort();
926  }
927  }
928  else
929  throw(QString("SourceID (%1) not found").arg(SourceID));
930 
931  return idList;
932 }
933 
934 // Prevent concurrent access to tv_find_grabbers
935 static QMutex lockGrabber;
936 
938 {
939  // ----------------------------------------------------------------------
940  // Build Response
941  // ----------------------------------------------------------------------
942 
943  QMutexLocker lock(&lockGrabber);
944 
945  auto *pGrabberList = new V2GrabberList();
946 
947  // Add default grabbers
948  V2Grabber *pGrabber = pGrabberList->AddNewGrabber();
949  pGrabber->setProgram("eitonly");
950  pGrabber->setDisplayName(QObject::tr("Transmitted guide only (EIT)"));
951  pGrabber = pGrabberList->AddNewGrabber();
952  pGrabber->setProgram("/bin/true");
953  pGrabber->setDisplayName(QObject::tr("No grabber"));
954 
955  QStringList args;
956  args += "baseline";
957 
958  MythSystemLegacy find_grabber_proc("tv_find_grabbers", args,
960  find_grabber_proc.Run(25s);
961  LOG(VB_GENERAL, LOG_INFO,
962  "Running 'tv_find_grabbers " + args.join(" ") + "'.");
963  uint status = find_grabber_proc.Wait();
964 
965  if (status == GENERIC_EXIT_OK)
966  {
967  QTextStream ostream(find_grabber_proc.ReadAll());
968  while (!ostream.atEnd())
969  {
970  QString grabber_list(ostream.readLine());
971  QStringList grabber_split =
972  grabber_list.split("|", Qt::SkipEmptyParts);
973  QString grabber_name = grabber_split[1];
974  QFileInfo grabber_file(grabber_split[0]);
975  QString program = grabber_file.fileName();
976 
977  if (!pGrabberList->containsProgram(program))
978  {
979  pGrabber = pGrabberList->AddNewGrabber();
980  pGrabber->setProgram(program);
981  pGrabber->setDisplayName(grabber_name);
982  }
983  LOG(VB_GENERAL, LOG_DEBUG, "Found " + grabber_split[0]);
984  }
985  LOG(VB_GENERAL, LOG_INFO, "Finished running tv_find_grabbers");
986  }
987  else
988  {
989  LOG(VB_GENERAL, LOG_ERR, "Failed to run tv_find_grabbers");
990  }
991 
992  return pGrabberList;
993 }
994 
996 {
997  // Channel Frequency Table
998  QStringList freqList;
999  freqList.append("default");
1000  for (const auto & freqEntry : gChanLists)
1001  {
1002  freqList.append(freqEntry.name);
1003  }
1004  return freqList;
1005 
1006 }
1007 
1009  const QString &DesiredServices,
1010  bool FreeToAirOnly,
1011  bool ChannelNumbersOnly,
1012  bool CompleteChannelsOnly,
1013  bool FullChannelSearch,
1014  bool RemoveDuplicates,
1015  bool AddFullTS,
1016  bool TestDecryptable,
1017  const QString &ScanType,
1018  const QString &FreqTable,
1019  const QString &Modulation,
1020  const QString &FirstChan,
1021  const QString &LastChan,
1022  uint ScanId,
1023  bool IgnoreSignalTimeout,
1024  bool FollowNITSetting,
1025  uint MplexId,
1026  const QString &Frequency,
1027  const QString &Bandwidth,
1028  const QString &Polarity,
1029  const QString &SymbolRate,
1030  const QString &Inversion,
1031  const QString &Constellation,
1032  const QString &ModSys,
1033  const QString &CodeRateLP,
1034  const QString &CodeRateHP,
1035  const QString &FEC,
1036  const QString &TransmissionMode,
1037  const QString &GuardInterval,
1038  const QString &Hierarchy,
1039  const QString &RollOff)
1040 {
1042  if (pScanner->m_status == "RUNNING")
1043  return false;
1044 
1045  return pScanner->StartScan (CardId,
1047  FreeToAirOnly,
1052  AddFullTS,
1053  TestDecryptable,
1054  ScanType,
1055  FreqTable,
1056  Modulation,
1057  FirstChan,
1058  LastChan,
1059  ScanId,
1062  MplexId,
1063  Frequency,
1064  Bandwidth,
1065  Polarity,
1066  SymbolRate,
1067  Inversion,
1068  Constellation,
1069  ModSys,
1070  CodeRateLP,
1071  CodeRateHP,
1072  FEC,
1073  TransmissionMode,
1074  GuardInterval,
1075  Hierarchy,
1076  RollOff);
1077 }
1078 
1079 
1081 {
1082  auto *pStatus = new V2ScanStatus();
1084  pStatus->setCardId(pScanner->m_cardid);
1085  pStatus->setStatus(pScanner->m_status);
1086  pStatus->setSignalLock(pScanner->m_statusLock);
1087  pStatus->setProgress(pScanner->m_statusProgress);
1088  pStatus->setSignalNoise(pScanner->m_statusSnr);
1089  pStatus->setSignalStrength(pScanner->m_statusSignalStrength);
1090  pStatus->setStatusLog(pScanner->m_statusLog);
1091  pStatus->setStatusText(pScanner->m_statusText);
1092  pStatus->setStatusTitle(pScanner->m_statusTitleText);
1093  pStatus->setDialogMsg(pScanner->m_dlgMsg);
1094  pStatus->setDialogButtons(pScanner->m_dlgButtons);
1095  pStatus->setDialogInputReq(pScanner->m_dlgInputReq);
1096 
1097  return pStatus;
1098 }
1099 
1100 
1101 bool V2Channel::StopScan ( uint Cardid )
1102 {
1104  if (pScanner->m_status != "RUNNING" || pScanner->m_cardid != Cardid)
1105  return false;
1106  pScanner->stopScan();
1107  return true;
1108 }
1109 
1111 {
1112  auto scanList = LoadScanList(SourceId);
1113  auto * pResult = new V2ScanList();
1114  for (const ScanInfo &scan : scanList)
1115  {
1116  auto *pItem = pResult->AddNewScan();
1117  pItem->setScanId (scan.m_scanid);
1118  pItem->setCardId (scan.m_cardid);
1119  pItem->setSourceId (scan.m_sourceid);
1120  pItem->setProcessed (scan.m_processed);
1121  pItem->setScanDate (scan.m_scandate);
1122  }
1123  return pResult;
1124 }
1125 
1127  const QString &DialogString,
1128  int DialogButton )
1129 {
1131  if (pScanner->m_cardid == Cardid)
1132  {
1133  pScanner->m_dlgString = DialogString;
1134  pScanner->m_dlgButton = DialogButton;
1135  pScanner->m_dlgButtons.clear();
1136  pScanner->m_dlgInputReq = false;
1137  pScanner->m_dlgMsg = "";
1138  pScanner->m_waitCondition.wakeOne();
1139  return true;
1140  }
1141  return false;
1142 }
ChannelInfo
Definition: channelinfo.h:31
MythHTTPService::HAS_PARAMv2
bool HAS_PARAMv2(const QString &p)
Definition: mythhttpservice.h:36
V2Channel::RemoveDBChannel
static bool RemoveDBChannel(uint ChannelID)
Definition: v2channel.cpp:349
V2CommMethodList
Definition: v2commMethod.h:45
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:100
CommMethod
Definition: channelsettings.cpp:393
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:813
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
build_compdb.args
args
Definition: build_compdb.py:11
ChannelScannerWeb::m_dlgInputReq
bool m_dlgInputReq
Definition: channelscanner_web.h:125
ChannelInfo::m_serviceType
uint m_serviceType
Definition: channelinfo.h:112
MSqlQuery::size
int size(void) const
Definition: mythdbcon.h:214
SourceUtil::DeleteSource
static bool DeleteSource(uint sourceid)
Definition: sourceutil.cpp:530
RemoveDuplicates
Definition: channelscanmiscsettings.h:174
ChannelScannerWeb::m_statusProgress
uint m_statusProgress
Definition: channelscanner_web.h:116
LoadScanList
std::vector< ScanInfo > LoadScanList(void)
Definition: scaninfo.cpp:266
CompleteChannelsOnly
Definition: channelscanmiscsettings.h:139
MythSystemLegacy
Definition: mythsystemlegacy.h:67
ChannelInfo::m_chanId
uint m_chanId
Definition: channelinfo.h:85
V2Channel::UpdateDBChannel
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 &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType, int RecPriority, int TimeOffset, int CommMethod)
Definition: v2channel.cpp:196
MythDate::as_utc
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:27
ChannelUtil::LoadChannels
static ChannelInfoList LoadChannels(uint startIndex, uint count, uint &totalAvailable, bool ignoreHidden=true, OrderBy orderBy=kChanOrderByChanNum, GroupBy groupBy=kChanGroupByChanid, uint sourceID=0, uint channelGroupID=0, bool liveTVOnly=false, const QString &callsign="", const QString &channum="", bool ignoreUntunable=true)
Load channels from database into a list of ChannelInfo objects.
Definition: channelutil.cpp:2455
SourceUtil::GetChannelCount
static uint GetChannelCount(uint sourceid)
Definition: sourceutil.cpp:136
channelimporter.h
UseEIT
Definition: videosource.cpp:594
ADD_SQLv2
static void ADD_SQLv2(QString &settings_var, MSqlBindings &bindvar, const QString &col, const QString &api_param, const T &val)
Definition: v2serviceUtil.h:29
kChannelNeverVisible
@ kChannelNeverVisible
Definition: channelinfo.h:25
ChannelUtil::DeleteChannel
static bool DeleteChannel(uint channel_id)
Definition: channelutil.cpp:1787
ChannelScannerWeb::StartScan
bool StartScan(uint CardId, const QString &DesiredServices, bool FreeToAirOnly, bool ChannelNumbersOnly, bool CompleteChannelsOnly, bool FullChannelSearch, bool RemoveDuplicates, bool AddFullTS, bool TestDecryptable, const QString &ScanType, const QString &FreqTable, QString Modulation, const QString &FirstChan, const QString &LastChan, uint ScanId, bool IgnoreSignalTimeout, bool FollowNITSetting, uint MplexId, const QString &Frequency, const QString &Bandwidth, const QString &Polarity, const QString &SymbolRate, const QString &Inversion, const QString &Constellation, const QString &ModSys, const QString &CodeRate_LP, const QString &CodeRate_HP, const QString &FEC, const QString &Trans_Mode, const QString &Guard_Interval, const QString &Hierarchy, const QString &RollOff)
Definition: channelscanner_web.cpp:53
ChannelInfo::m_freqId
QString m_freqId
Definition: channelinfo.h:87
v2programAndChannel.h
V2Channel::RemoveVideoSource
static bool RemoveVideoSource(uint SourceID)
Definition: v2channel.cpp:640
V2Channel::StopScan
static bool StopScan(uint Cardid)
Definition: v2channel.cpp:1101
ChannelUtil::kChanGroupByChanid
@ kChanGroupByChanid
Definition: channelutil.h:217
frequencies.h
ChannelScannerWeb::m_waitCondition
QWaitCondition m_waitCondition
Definition: channelscanner_web.h:110
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:204
mythdbcon.h
V2VideoSourceList
Definition: v2videoSourceList.h:12
V2Channel::GetScanList
static V2ScanList * GetScanList(uint SourceId)
Definition: v2channel.cpp:1110
v2recording.h
scanwizardconfig.h
mythhttpmetaservice.h
ChannelInfo::m_atscMajorChan
uint m_atscMajorChan
Definition: channelinfo.h:113
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:619
ChannelInfo::m_name
QString m_name
Definition: channelinfo.h:92
SkipTypeToString
QString SkipTypeToString(int flags)
Definition: programtypes.cpp:91
MythDate::Format
Format
Definition: mythdate.h:15
channelscanner_web.h
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
SourceID
Definition: videosource.cpp:2860
MythSystemLegacy::ReadAll
QByteArray & ReadAll()
Definition: mythsystemlegacy.cpp:402
ChannelUtil::kChanOrderByName
@ kChanOrderByName
Definition: channelutil.h:209
ChannelScannerWeb::m_cardid
uint m_cardid
Definition: channelscanner_web.h:111
build_compdb.file
file
Definition: build_compdb.py:55
SourceUtil::CreateSource
static int CreateSource(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, uint bouquetid, uint regionid, uint scanfrequency, uint lcnoffset)
Definition: sourceutil.cpp:477
mythdirs.h
V2Channel::StartScan
static bool StartScan(uint CardId, const QString &DesiredServices, bool FreeToAirOnly, bool ChannelNumbersOnly, bool CompleteChannelsOnly, bool FullChannelSearch, bool RemoveDuplicates, bool AddFullTS, bool TestDecryptable, const QString &ScanType, const QString &FreqTable, const QString &Modulation, const QString &FirstChan, const QString &LastChan, uint ScanId, bool IgnoreSignalTimeout, bool FollowNITSetting, uint MplexId, const QString &Frequency, const QString &Bandwidth, const QString &Polarity, const QString &SymbolRate, const QString &Inversion, const QString &Constellation, const QString &ModSys, const QString &CodeRateLP, const QString &CodeRateHP, const QString &FEC, const QString &TransmissionMode, const QString &GuardInterval, const QString &Hierarchy, const QString &RollOff)
Definition: v2channel.cpp:1008
V2Channel::RegisterCustomTypes
static void RegisterCustomTypes()
ChannelScannerWeb::m_dlgString
QString m_dlgString
Definition: channelscanner_web.h:127
kChannelAlwaysVisible
@ kChannelAlwaysVisible
Definition: channelinfo.h:22
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:11
Visible
Definition: channelsettings.cpp:416
ChannelInfo::m_icon
QString m_icon
Definition: channelinfo.h:93
V2Channel::GetChannelInfoList
static V2ChannelInfoList * GetChannelInfoList(uint SourceID, uint ChannelGroupID, uint StartIndex, uint Count, bool OnlyVisible, bool Details, bool OrderByName, bool GroupByCallsign, bool OnlyTunable)
Definition: v2channel.cpp:101
hardwareprofile.scan.scan
def scan(profile, smoonURL, gate)
Definition: scan.py:55
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
V2Grabber
Definition: v2grabber.h:20
V2Channel::GetScanStatus
static V2ScanStatus * GetScanStatus()
Definition: v2channel.cpp:1080
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
IgnoreSignalTimeout
Definition: channelscanmiscsettings.h:52
V2Channel::GetGrabberList
static V2GrabberList * GetGrabberList()
Definition: v2channel.cpp:937
mythsystemlegacy.h
programtypes.h
ChannelID
Definition: channelsettings.h:20
SourceUtil::IsSourceIDValid
static bool IsSourceIDValid(uint sourceid)
Definition: sourceutil.cpp:380
ChannelInfo::m_commMethod
int m_commMethod
Definition: channelinfo.h:119
ChannelInfo::m_useOnAirGuide
bool m_useOnAirGuide
Definition: channelinfo.h:108
v2channel.h
V2CommMethod
Definition: v2commMethod.h:17
mythdate.h
sourceutil.h
SourceUtil::UpdateChannelsFromListings
static bool UpdateChannelsFromListings(uint sourceid, const QString &inputtype=QString(), bool wait=false)
Definition: sourceutil.cpp:396
V2ChannelInfoList
Definition: v2channelInfoList.h:10
ServiceID
Definition: channelsettings.cpp:337
COMM_DETECT_COMMFREE
@ COMM_DETECT_COMMFREE
Definition: programtypes.h:129
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:256
v2serviceUtil.h
channelVisibleTypeFromString
ChannelVisibleType channelVisibleTypeFromString(const QString &type)
Definition: channelinfo.cpp:539
V2Channel::GetVideoMultiplex
static V2VideoMultiplex * GetVideoMultiplex(uint MplexID)
Definition: v2channel.cpp:821
V2Channel::GetXMLTVIdList
static QStringList GetXMLTVIdList(uint SourceID)
Definition: v2channel.cpp:883
ChannelInfo::m_atscMinorChan
uint m_atscMinorChan
Definition: channelinfo.h:114
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:551
ChannelUtil::UpdateChannel
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, ChannelVisibleType visible, const QString &freqid=QString(), const QString &icon=QString(), QString format=QString(), const QString &xmltvid=QString(), const QString &default_authority=QString(), uint service_type=0, int recpriority=INT_MIN, int tmOffset=INT_MIN, int commMethod=INT_MIN)
Definition: channelutil.cpp:1573
compat.h
ChannelScannerWeb::m_dlgButton
int m_dlgButton
Definition: channelscanner_web.h:126
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:226
V2Channel::AddVideoSource
static 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, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset)
Definition: v2channel.cpp:607
v2freqtable.h
ChannelInfo::m_chanNum
QString m_chanNum
Definition: channelinfo.h:86
V2Channel::GetAvailableChanid
static uint GetAvailableChanid(void)
Definition: v2channel.cpp:294
ChannelScannerWeb::m_statusSnr
int m_statusSnr
Definition: channelscanner_web.h:117
FreqTable
static GlobalComboBoxSetting * FreqTable()
Definition: backendsettings.cpp:251
MythSystemLegacy::Wait
uint Wait(std::chrono::seconds timeout=0s)
Definition: mythsystemlegacy.cpp:243
ChannelScannerWeb::m_statusLock
bool m_statusLock
Definition: channelscanner_web.h:115
scaninfo.h
V2Channel::V2Channel
V2Channel()
Definition: v2channel.cpp:95
CHANNEL_HANDLE
#define CHANNEL_HANDLE
Definition: v2channel.h:39
V2Channel::UpdateVideoSource
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, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset)
Definition: v2channel.cpp:492
V2Channel::GetChannelInfo
static V2ChannelInfo * GetChannelInfo(uint ChanID)
Definition: v2channel.cpp:179
MSqlQuery::seek
bool seek(int where, bool relative=false)
Wrap QSqlQuery::seek(int,bool)
Definition: mythdbcon.cpp:833
V2FillChannelInfo
bool V2FillChannelInfo(V2ChannelInfo *pChannel, uint nChanID, bool bDetails)
Definition: v2serviceUtil.cpp:163
ChannelInfo::m_tmOffset
int m_tmOffset
Definition: channelinfo.h:120
V2Channel::GetVideoSource
static V2VideoSource * GetVideoSource(uint SourceID)
Definition: v2channel.cpp:438
ChannelVisibleType
ChannelVisibleType
Definition: channelinfo.h:20
V2Channel::SendScanDialogResponse
static bool SendScanDialogResponse(uint Cardid, const QString &DialogString, int DialogButton)
Definition: v2channel.cpp:1126
MSqlQuery::isConnected
bool isConnected(void) const
Only updated once during object creation.
Definition: mythdbcon.h:137
uint
unsigned int uint
Definition: compat.h:81
FullChannelSearch
Definition: channelscanmiscsettings.h:157
ChannelScannerWeb::m_dlgMsg
QString m_dlgMsg
Definition: channelscanner_web.h:123
MythHTTPService
Definition: mythhttpservice.h:19
V2Channel::AddDBChannel
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 &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType, int RecPriority, int TimeOffset, int CommMethod)
Definition: v2channel.cpp:311
kMSRunShell
@ kMSRunShell
run process through shell
Definition: mythsystem.h:43
ChannelUtil::CreateChannel
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, ChannelVisibleType visible, const QString &freqid, const QString &icon=QString(), QString format="Default", const QString &xmltvid=QString(), const QString &default_authority=QString(), uint service_type=0, int recpriority=0, int tmOffset=0, int commMethod=-1)
Definition: channelutil.cpp:1485
lockGrabber
static QMutex lockGrabber
Definition: v2channel.cpp:935
channelutil.h
ChannelScannerWeb
Definition: channelscanner_web.h:46
FollowNITSetting
Definition: channelscanmiscsettings.h:65
ChannelScannerWeb::m_statusText
QString m_statusText
Definition: channelscanner_web.h:118
V2Channel::RemoveAllVideoSources
static bool RemoveAllVideoSources(void)
Definition: v2channel.cpp:633
TimeOffset
Definition: channelsettings.cpp:199
v2artworkInfoList.h
gChanLists
const CHANLISTS_vec gChanLists
Definition: frequencies.cpp:2215
ChannelScannerWeb::m_status
QString m_status
Definition: channelscanner_web.h:114
COMM_DETECT_UNINIT
@ COMM_DETECT_UNINIT
Definition: programtypes.h:130
CardUtil::GetRawInputType
static QString GetRawInputType(uint inputid)
Definition: cardutil.h:292
ChannelInfo::m_serviceId
uint m_serviceId
Definition: channelinfo.h:111
V2ScanList
Definition: v2channelScan.h:62
ChannelNumbersOnly
Definition: channelscanmiscsettings.h:123
kChannelVisible
@ kChannelVisible
Definition: channelinfo.h:23
mythcorecontext.h
Frequency
Definition: transporteditor.cpp:466
V2Channel::GetDDLineupList
static V2LineupList * GetDDLineupList(const QString &Source, const QString &UserId, const QString &Password)
Definition: v2channel.cpp:651
cardutil.h
V2VideoMultiplexList
Definition: v2videoMultiplexList.h:11
Modulation
Definition: transporteditor.cpp:541
DesiredServices
Definition: channelscanmiscsettings.h:79
ChannelInfo::Load
bool Load(uint lchanid=-1)
Definition: channelinfo.cpp:131
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:889
Q_GLOBAL_STATIC_WITH_ARGS
Q_GLOBAL_STATIC_WITH_ARGS(MythHTTPMetaService, s_service,(CHANNEL_HANDLE, V2Channel::staticMetaObject, &V2Channel::RegisterCustomTypes)) void V2Channel
Definition: v2channel.cpp:66
V2Channel::FetchChannelsFromSource
static int FetchChannelsFromSource(uint SourceId, uint CardId, bool WaitForFinish)
Definition: v2channel.cpp:663
V2LineupList
Definition: v2lineup.h:56
ChannelInfo::m_sourceId
uint m_sourceId
Definition: channelinfo.h:89
V2GrabberList
Definition: v2grabber.h:48
ChannelInfo::m_tvFormat
QString m_tvFormat
Definition: channelinfo.h:105
ChannelScannerWeb::m_statusLog
QString m_statusLog
Definition: channelscanner_web.h:119
ChannelScannerWeb::m_statusTitleText
QString m_statusTitleText
Definition: channelscanner_web.h:120
ChannelInfo::m_recPriority
int m_recPriority
Definition: channelinfo.h:98
V2Channel::GetVideoSourceList
static V2VideoSourceList * GetVideoSourceList(void)
Definition: v2channel.cpp:379
V2Channel::GetFreqTableList
static QStringList GetFreqTableList()
Definition: v2channel.cpp:995
SourceUtil::DeleteAllSources
static bool DeleteAllSources(void)
Definition: sourceutil.cpp:586
V2VideoMultiplex
Definition: v2videoMultiplex.h:12
ChannelScannerWeb::getInstance
static ChannelScannerWeb * getInstance()
Definition: channelscanner_web.cpp:44
ChannelInfo::m_xmltvId
QString m_xmltvId
Definition: channelinfo.h:97
Icon
Definition: channelsettings.cpp:233
FreeToAirOnly
Definition: channelscanmiscsettings.h:109
MythHTTPService::m_request
HTTPRequest2 m_request
Definition: mythhttpservice.h:35
MythSystemLegacy::Run
void Run(std::chrono::seconds timeout=0s)
Runs a command inside the /bin/sh shell. Returns immediately.
Definition: mythsystemlegacy.cpp:213
ChannelScannerWeb::stopScan
void stopScan()
Definition: channelscanner_web.cpp:405
V2Channel::GetVideoMultiplexList
static V2VideoMultiplexList * GetVideoMultiplexList(uint SourceID, uint StartIndex, uint Count)
Definition: v2channel.cpp:694
RollOff
Definition: transporteditor.cpp:832
V2ScanStatus
Definition: v2channelScan.h:6
GetPreferredSkipTypeCombinations
std::deque< int > GetPreferredSkipTypeCombinations(void)
Definition: programtypes.cpp:129
ChannelInfo::m_mplexId
uint m_mplexId
Definition: channelinfo.h:110
v2castMemberList.h
ChannelInfo::m_visible
ChannelVisibleType m_visible
Definition: channelinfo.h:106
kMSStdOut
@ kMSStdOut
allow access to stdout
Definition: mythsystem.h:41
v2grabber.h
V2VideoSource
Definition: v2videoSource.h:10
ChannelScannerWeb::m_statusSignalStrength
int m_statusSignalStrength
Definition: channelscanner_web.h:122
MythHTTPMetaService
Definition: mythhttpmetaservice.h:10
ScanInfo
Definition: scaninfo.h:17
ChannelInfo::m_defaultAuthority
QString m_defaultAuthority
Definition: channelinfo.h:118
ChannelInfo::m_callSign
QString m_callSign
Definition: channelinfo.h:91
ChannelScannerWeb::m_dlgButtons
QStringList m_dlgButtons
Definition: channelscanner_web.h:124
V2ChannelInfo
Definition: v2programAndChannel.h:27
ChannelUtil::kChanOrderByChanNum
@ kChanOrderByChanNum
Definition: channelutil.h:208
ChannelUtil::kChanGroupByCallsign
@ kChanGroupByCallsign
Definition: channelutil.h:215
kChannelNotVisible
@ kChannelNotVisible
Definition: channelinfo.h:24
V2Channel::GetCommMethodList
static V2CommMethodList * GetCommMethodList(void)
Definition: v2channel.cpp:357
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:838
AddFullTS
Definition: channelscanmiscsettings.h:190
ChannelInfoList
std::vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:131