5 #include <QCoreApplication>
21 QString fieldTag = (
":WHERE" +
m_id.
getField().toUpper());
34 QString query(
m_id.
getField() +
" = " + fieldTag +
", " +
45 QString fieldTag = (
":WHERE" +
m_id.
getField().toUpper());
58 QString query(
m_id.
getField() +
" = " + fieldTag +
", " +
77 setLabel(QCoreApplication::translate(
"(Common)",
"Channel Name"));
87 setLabel(QCoreApplication::translate(
"(Common)",
"Channel Number"));
89 "This is the number by which the channel is known to MythTV."));
100 setLabel(QCoreApplication::translate(
"(Common)",
"Video Source"));
101 setHelpText(QCoreApplication::translate(
"(Common)",
102 "It is NOT a good idea to change this value as it only changes "
103 "the sourceid in table channel but not in dtv_multiplex. "
104 "The sourceid in dtv_multiplex cannot and should not be changed."));
122 addSelection(QCoreApplication::translate(
"(ChannelSettings)",
123 "[Not Selected]"),
"0");
126 query.
prepare(
"SELECT name, sourceid "
128 "ORDER BY sourceid");
140 query.
value(1).toString());
158 setLabel(QCoreApplication::translate(
"(Common)",
"Callsign"));
165 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"TV Format"));
166 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
167 "If this channel uses a format other than TV Format in the General "
168 "Backend Setup screen, set it here."));
170 addSelection(QCoreApplication::translate(
"(Common)",
"Default"),
"Default");
173 for (
const QString& format : qAsConst(list))
181 list.push_back(
"NTSC");
182 list.push_back(
"NTSC-JP");
183 list.push_back(
"PAL");
184 list.push_back(
"PAL-60");
185 list.push_back(
"PAL-BG");
186 list.push_back(
"PAL-DK");
187 list.push_back(
"PAL-D");
188 list.push_back(
"PAL-I");
189 list.push_back(
"PAL-M");
190 list.push_back(
"PAL-N");
191 list.push_back(
"PAL-NC");
192 list.push_back(
"SECAM");
193 list.push_back(
"SECAM-D");
194 list.push_back(
"SECAM-DK");
206 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
207 "DataDirect Time Offset"));
209 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
210 "Offset (in minutes) to apply to the program guide data during "
211 "import. This can be used when the listings for a particular "
212 "channel are in a different time zone."));
223 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Priority"));
225 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
226 "Number of priority points to be added to any recording on this "
227 "channel during scheduling. Use a positive number as the priority "
228 "if you want this to be a preferred channel, a negative one to "
229 "depreciate this channel."));
239 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Icon"));
241 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
242 "Image file to use as the icon for this channel on various MythTV "
253 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
256 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
257 "Filters to be used when recording from this channel. Not used "
258 "with hardware encoding cards."));
270 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
271 "Playback filters"));
273 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
274 "Filters to be used when recordings from this channel are viewed. "
275 "Start with a plus to append to the global playback filters."));
286 setLabel(QCoreApplication::translate(
"(Common)",
"XMLTV ID"));
288 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
289 "ID used by listing services to get an exact correspondence "
290 "between a channel in your line-up and a channel in their "
291 "database. Normally this is set automatically when "
292 "'mythfilldatabase' is run."));
307 if (QFile::exists(xmltvFile))
309 QFile
file(xmltvFile);
310 if (!
file.open(QIODevice::ReadOnly | QIODevice::Text))
315 while (!
file.atEnd())
317 QByteArray line =
file.readLine();
319 if (line.startsWith(
"channel="))
321 QString
id = line.mid(8, -1).trimmed();
328 for (
const QString& idName : qAsConst(idList))
342 -1, UINT16_MAX, 1, 1,
"NULL")
344 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Service ID"));
346 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
347 "Service ID (Program Number) of desired channel within the transport stream. "
348 "If there is only one channel, then setting this to anything will still find it."));
373 setLabel(QObject::tr(
"Transport ID"));
375 QObject::tr(
"The transport stream ID (tid) can be used to identify "
376 "the transport of this channel in the Transport Editor."));
388 QObject::tr(
"Frequency of the transport of this channel in Hz for "
389 "DVB-T/T2/C or in kHz plus polarization H or V for DVB-S/S2."));
399 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
400 "Commercial Detection Method"));
402 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
403 "Changes the method of commercial detection used for recordings on "
404 "this channel or skips detection by marking the channel as "
405 "Commercial Free."));
424 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"Visible"));
426 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
427 "If set to Always Visible or Visible, the channel will be visible in the "
428 "EPG. Set to Always Visible or Never Visible to prevent MythTV and other "
429 "utilities from automatically managing the value for this "
432 addSelection(QCoreApplication::translate(
"(Common)",
"Always Visible"),
434 addSelection(QCoreApplication::translate(
"(Common)",
"Visible"),
436 addSelection(QCoreApplication::translate(
"(Common)",
"Not Visible"),
438 addSelection(QCoreApplication::translate(
"(Common)",
"Never Visible"),
449 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
450 "Use on air guide"));
452 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
453 "If enabled, guide information for this channel will be updated "
454 "using 'Over-the-Air' program listings."));
467 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
"URL"));
468 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
469 "URL for streaming of this channel. Used by the IPTV "
470 "capture card and obtained with an \"M3U Import\" or "
471 "with a \"HDHomeRun Channel Import\" loading of an XML file."));
485 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
487 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
488 "N.B. This setting is only used for analog channels. "
489 "Depending on the tuner type, specify either the exact "
490 "frequency (in kHz) or a valid channel "
491 "number that will be understood by your tuners."));
502 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
505 setHelpText(QCoreApplication::translate(
"(ChannelSettings)",
506 "Value to be added to your desired frequency (in kHz) for "
520 setLabel(QCoreApplication::translate(
"(Common)",
"Contrast"));
531 setLabel(QCoreApplication::translate(
"(Common)",
"Brightness"));
542 setLabel(QCoreApplication::translate(
"(Common)",
"Color"));
553 setLabel(QCoreApplication::translate(
"(Common)",
"Hue"));
558 uint default_sourceid,
bool add_freqid)
560 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
561 "Channel Options - Common"));
564 auto *source =
new Source(
id, default_sourceid);
566 auto *channum =
new Channum(
id);
604 "SELECT transportid, frequency, polarity, mod_sys FROM dtv_multiplex "
605 "JOIN channel ON channel.mplexid = dtv_multiplex.mplexid "
606 "WHERE channel.chanid = :CHANID");
614 else if (query.
next())
616 QString frequency = query.
value(1).toString();
622 QString polarization = query.
value(2).toString().toUpper();
623 frequency.append(polarization);
636 bool supports_eit =
true;
637 bool uses_eit_only =
false;
640 query.
prepare(
"SELECT cardtype "
641 "FROM capturecard, videosource "
642 "WHERE capturecard.sourceid = videosource.sourceid AND "
643 " videosource.sourceid = :SOURCEID");
650 supports_eit = (query.
size() == 0);
654 query.
value(0).toString().toUpper());
657 query.
prepare(
"SELECT xmltvgrabber "
659 "WHERE sourceid = :SOURCEID");
666 uses_eit_only = (query.
size() != 0);
669 uses_eit_only &= (query.
value(0).toString() ==
"eitonly");
681 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
682 "Channel Options - Filters"));
690 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
691 "Channel Options - IPTV"));
700 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
701 "Channel Options - Video4Linux"));
718 setLabel(QCoreApplication::translate(
"(ChannelSettings)",
719 "Channel Options - Raw Transport Stream"));
726 for (
uint i = 0; i < mx; i++)
729 m_pids[i]->setLabel(
"PID");
731 m_sids[i]->setLabel(
" StreamID");
732 for (
uint j = 0x101; j <= 0x1ff; j++)
739 .arg(desc).arg(j&0xff,2,16,QLatin1Char(
'0')),
740 QString::number(j),
false);
743 for (
uint j = 0x101; j <= 0x1ff; j++)
749 QString(
"0x%1").arg(j&0xff,2,16,QLatin1Char(
'0')),
750 QString::number(j),
false);
767 m_pcrs[i]->setLabel(
" Is PCR");
779 auto it = pid_cache.begin();
780 for (
uint i = 0; i <
kMaxPIDs && it != pid_cache.end(); )
782 if (!(it->IsPermanent()))
788 m_pids[i]->setValue(QString(
"0x%1")
789 .arg(it->GetPID(),2,16,QLatin1Char(
'0')));
790 m_sids[i]->setValue(QString::number(it->GetComposite()&0x1ff));
791 m_pcrs[i]->setValue(it->IsPCRPID());
806 uint pid =
m_pids[i]->getValue().toUInt(&ok, 0);
810 pid_cache.emplace_back(