5 #include <QCoreApplication>
26 QString querystr = QString(
"SELECT %1 FROM %2 WHERE %3='%4'")
36 querystr = QString(
"INSERT INTO %1 (%2) VALUES ('%3')")
45 LOG(VB_GENERAL, LOG_ERR, QString(
"ChannelID, Error: ") +
46 QString(
"Failed to insert into: %1").arg(
m_table));
53 QString fieldTag = (
":WHERE" +
m_id.
getField().toUpper());
66 QString query(
m_id.
getField() +
" = " + fieldTag +
", " +
77 QString fieldTag = (
":WHERE" +
m_id.
getField().toUpper());
90 QString query(
m_id.
getField() +
" = " + fieldTag +
", " +
109 setLabel(QCoreApplication::translate(
"(Common)",
"Channel Name"));
119 setLabel(QCoreApplication::translate(
"(Common)",
"Channel Number"));
120 setHelpText(QCoreApplication::translate(
"(Common)",
121 "This is the number by which the channel is known to MythTV."));
132 setLabel(QCoreApplication::translate(
"(Common)",
"Video Source"));
133 setHelpText(QCoreApplication::translate(
"(Common)",
134 "It is NOT a good idea to change this value as it only changes "
135 "the sourceid in table channel but not in dtv_multiplex. "
136 "The sourceid in dtv_multiplex cannot and should not be changed."));
154 addSelection(QCoreApplication::translate(
"(ChannelSettings)",
155 "[Not Selected]"),
"0");
158 query.
prepare(
"SELECT name, sourceid "
160 "ORDER BY sourceid");
172 query.
value(1).toString());
190 setLabel(QCoreApplication::translate(
"(Common)",
"Callsign"));
197 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"TV Format"));
198 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
199 "If this channel uses a format other than TV Format in the General "
200 "Backend Setup screen, set it here."));
202 addSelection(QCoreApplication::translate(
"(Common)",
"Default"),
"Default");
205 for (
const QString& format : std::as_const(list))
213 list.push_back(
"NTSC");
214 list.push_back(
"NTSC-JP");
215 list.push_back(
"PAL");
216 list.push_back(
"PAL-60");
217 list.push_back(
"PAL-BG");
218 list.push_back(
"PAL-DK");
219 list.push_back(
"PAL-D");
220 list.push_back(
"PAL-I");
221 list.push_back(
"PAL-M");
222 list.push_back(
"PAL-N");
223 list.push_back(
"PAL-NC");
224 list.push_back(
"SECAM");
225 list.push_back(
"SECAM-D");
226 list.push_back(
"SECAM-DK");
238 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
239 "DataDirect Time Offset"));
241 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
242 "Offset (in minutes) to apply to the program guide data during "
243 "import. This can be used when the listings for a particular "
244 "channel are in a different time zone."));
255 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Priority"));
257 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
258 "Number of priority points to be added to any recording on this "
259 "channel during scheduling. Use a positive number as the priority "
260 "if you want this to be a preferred channel, a negative one to "
261 "depreciate this channel."));
271 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Icon"));
273 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
274 "Image file to use as the icon for this channel on various MythTV "
285 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
288 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
289 "Filters to be used when recording from this channel. Not used "
290 "with hardware encoding cards."));
302 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
303 "Playback filters"));
305 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
306 "Filters to be used when recordings from this channel are viewed. "
307 "Start with a plus to append to the global playback filters."));
318 setLabel(QCoreApplication::translate(
"(Common)",
"XMLTV ID"));
320 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
321 "ID used by listing services to get an exact correspondence "
322 "between a channel in your line-up and a channel in their "
323 "database. Normally this is set automatically when "
324 "'mythfilldatabase' is run."));
341 QFile
file(xmltvFile);
342 if (!
file.open(QIODevice::ReadOnly | QIODevice::Text))
347 while (!
file.atEnd())
349 QByteArray line =
file.readLine();
351 if (line.startsWith(
"channel="))
353 QString
id = line.mid(8, -1).trimmed();
360 for (
const QString& idName : std::as_const(idList))
374 -1, UINT16_MAX, 1, 1,
"NULL")
376 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Service ID"));
378 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
379 "Service ID (Program Number) of desired channel within the transport stream. "
380 "If there is only one channel, then setting this to anything will still find it."));
405 setLabel(QObject::tr(
"Transport ID"));
407 QObject::tr(
"The transport stream ID (tid) can be used to identify "
408 "the transport of this channel in the Transport Editor."));
420 QObject::tr(
"Frequency of the transport of this channel in Hz for "
421 "DVB-T/T2/C or in kHz plus polarization H or V for DVB-S/S2."));
431 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
432 "Commercial Detection Method"));
434 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
435 "Changes the method of commercial detection used for recordings on "
436 "this channel or skips detection by marking the channel as "
437 "Commercial Free."));
456 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Visible"));
458 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
459 "If set to Always Visible or Visible, the channel will be visible in the "
460 "EPG. Set to Always Visible or Never Visible to prevent MythTV and other "
461 "utilities from automatically managing the value for this "
464 addSelection(QCoreApplication::translate(
"(Common)",
"Always Visible"),
466 addSelection(QCoreApplication::translate(
"(Common)",
"Visible"),
468 addSelection(QCoreApplication::translate(
"(Common)",
"Not Visible"),
470 addSelection(QCoreApplication::translate(
"(Common)",
"Never Visible"),
481 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
482 "Use on air guide"));
484 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
485 "If enabled, guide information for this channel will be updated "
486 "using 'Over-the-Air' program listings."));
499 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"URL"));
500 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
501 "URL for streaming of this channel. Used by the IPTV "
502 "capture card and obtained with an \"M3U Import\" or "
503 "with a \"HDHomeRun Channel Import\" loading of an XML file."));
517 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
519 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
520 "N.B. This setting is only used for analog channels. "
521 "Depending on the tuner type, specify either the exact "
522 "frequency (in kHz) or a valid channel "
523 "number that will be understood by your tuners."));
534 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
537 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
538 "Value to be added to your desired frequency (in kHz) for "
552 setLabel(QCoreApplication::translate(
"(Common)",
"Contrast"));
563 setLabel(QCoreApplication::translate(
"(Common)",
"Brightness"));
574 setLabel(QCoreApplication::translate(
"(Common)",
"Color"));
585 setLabel(QCoreApplication::translate(
"(Common)",
"Hue"));
590 uint default_sourceid,
bool add_freqid)
592 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
593 "Channel Options - Common"));
596 auto *source =
new Source(
id, default_sourceid);
598 auto *channum =
new Channum(
id);
638 "SELECT transportid, frequency, polarity, mod_sys FROM dtv_multiplex "
639 "JOIN channel ON channel.mplexid = dtv_multiplex.mplexid "
640 "WHERE channel.chanid = :CHANID");
648 else if (query.
next())
650 QString frequency = query.
value(1).toString();
656 QString polarization = query.
value(2).toString().toUpper();
657 frequency.append(polarization);
670 bool supports_eit =
true;
671 bool uses_eit_only =
false;
674 query.
prepare(
"SELECT cardtype "
675 "FROM capturecard, videosource "
676 "WHERE capturecard.sourceid = videosource.sourceid AND "
677 " videosource.sourceid = :SOURCEID");
684 supports_eit = (query.
size() == 0);
688 query.
value(0).toString().toUpper());
691 query.
prepare(
"SELECT xmltvgrabber "
693 "WHERE sourceid = :SOURCEID");
700 uses_eit_only = (query.
size() != 0);
703 uses_eit_only &= (query.
value(0).toString() ==
"eitonly");
715 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
716 "Channel Options - Filters"));
724 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
725 "Channel Options - IPTV"));
734 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
735 "Channel Options - Video4Linux"));
752 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
753 "Channel Options - Raw Transport Stream"));
760 for (
uint i = 0; i < mx; i++)
763 m_pids[i]->setLabel(
"PID");
765 m_sids[i]->setLabel(
" StreamID");
766 for (
uint j = 0x101; j <= 0x1ff; j++)
773 .arg(desc).arg(j&0xff,2,16,QLatin1Char(
'0')),
774 QString::number(j),
false);
777 for (
uint j = 0x101; j <= 0x1ff; j++)
783 QString(
"0x%1").arg(j&0xff,2,16,QLatin1Char(
'0')),
784 QString::number(j),
false);
801 m_pcrs[i]->setLabel(
" Is PCR");
813 auto it = pid_cache.begin();
814 for (
uint i = 0; i <
kMaxPIDs && it != pid_cache.end(); )
816 if (!(it->IsPermanent()))
822 m_pids[i]->setValue(QString(
"0x%1")
823 .arg(it->GetPID(),2,16,QLatin1Char(
'0')));
824 m_sids[i]->setValue(QString::number(it->GetComposite()&0x1ff));
825 m_pcrs[i]->setValue(it->IsPCRPID());
840 uint pid =
m_pids[i]->getValue().toUInt(&ok, 0);
844 pid_cache.emplace_back(