MythTV master
backendsettings.cpp
Go to the documentation of this file.
1// C/C++
2#include <cstdio>
3#include <unistd.h>
4
5// Qt
6#include <QNetworkInterface>
7
8// MythTV
10#include "libmythtv/channelsettings.h" // for ChannelTVFormat::GetFormats()
12
13// MythTV Setup
14#include "backendsettings.h"
15
17{
18 auto *gc = new TransMythUICheckBoxSetting();
19 gc->setLabel(QObject::tr("This server is the Master Backend"));
20 gc->setValue(false);
21 gc->setHelpText(QObject::tr(
22 "Enable this if this is the only backend or is the "
23 "master backend server. If enabled, all frontend and "
24 "non-master backend machines "
25 "will connect to this server. To change to a new master "
26 "backend, run setup on that server and select it as "
27 "master backend."));
28 return gc;
29};
30
32{
33 auto *gc = new GlobalTextEditSetting("MasterServerName");
34 gc->setLabel(QObject::tr("Master Backend Name"));
35 gc->setValue("");
36 gc->setEnabled(true);
37 gc->setReadOnly(true);
38 gc->setHelpText(QObject::tr(
39 "Host name of Master Backend. This is set by selecting "
40 "\"This server is the Master Backend\" on that server."));
41 return gc;
42};
43
45{
46 auto *gc = new HostCheckBoxSetting("AllowConnFromAll");
47 gc->setLabel(QObject::tr("Allow Connections from all Subnets"));
48 gc->setValue(false);
49 gc->setHelpText(QObject::tr(
50 "Allow this backend to receive connections from any IP "
51 "address on the internet. NOT recommended for most users. "
52 "Use this only if you have secure IPV4 and IPV6 " "firewalls."));
53 return gc;
54};
55
57{
58 auto *gc = new HostComboBoxSetting("BackendServerIP");
59 gc->setLabel(QObject::tr("IPv4 address"));
60 QList<QHostAddress> list = QNetworkInterface::allAddresses();
61 QList<QHostAddress>::iterator it;
62 for (it = list.begin(); it != list.end(); ++it)
63 {
64 if ((*it).protocol() == QAbstractSocket::IPv4Protocol)
65 gc->addSelection((*it).toString(), (*it).toString());
66 }
67
68 gc->setValue("127.0.0.1");
69 gc->setHelpText(QObject::tr("Enter the IP address of this machine. "
70 "Use an externally accessible address (ie, not "
71 "127.0.0.1) if you are going to be running a frontend "
72 "on a different machine than this one. Note, in IPv6 "
73 "setups, this is still required for certain extras "
74 "such as UPnP."));
75 return gc;
76};
77
79{
80 auto *gc = new HostComboBoxSetting("BackendServerIP6");
81 gc->setLabel(QObject::tr("Listen on IPv6 address"));
82 QList<QHostAddress> list = QNetworkInterface::allAddresses();
83 QList<QHostAddress>::iterator it;
84 for (it = list.begin(); it != list.end(); ++it)
85 {
86 if ((*it).protocol() == QAbstractSocket::IPv6Protocol)
87 {
88 // If it is a link-local IPV6 address with scope,
89 // remove the scope.
90 it->setScopeId(QString());
91 gc->addSelection((*it).toString(), (*it).toString());
92 }
93 }
94
95 if (list.isEmpty())
96 {
97 gc->setEnabled(false);
98 gc->setValue("");
99 }
100 else
101 {
102 if (list.contains(QHostAddress("::1")))
103 gc->setValue("::1");
104 }
105
106 gc->setHelpText(QObject::tr("Enter the IPv6 address of this machine. "
107 "Use an externally accessible address (ie, not "
108 "::1) if you are going to be running a frontend "
109 "on a different machine than this one."));
110 return gc;
111}
112
114{
115 auto *hc = new HostCheckBoxSetting("AllowLinkLocal");
116 hc->setLabel(QObject::tr("Listen on Link-Local addresses"));
117 hc->setValue(true);
118 hc->setHelpText(QObject::tr("Enable servers on this machine to listen on "
119 "link-local addresses. These are auto-configured "
120 "addresses and not accessible outside the local network. "
121 "This must be enabled for anything requiring Bonjour to "
122 "work."));
123 return hc;
124};
125
127{
128 public:
131 explicit IpAddressSettings(/*Setting* trigger*/) :
132 HostCheckBoxSetting("ListenOnAllIps"),
135 {
136 setLabel(BackendSettings::tr("Listen on All IP Addresses"));
137 setValue(true);
138 setHelpText(BackendSettings::tr("Allow this backend to receive "
139 "connections on any IP Address assigned to it. "
140 "Recommended for most users for ease and "
141 "reliability."));
142
143 // show ip addresses if ListenOnAllIps is off
147 };
148};
149
150
152{
154}
155
157{
158 auto *gc = new HostTextEditSetting("BackendServerPort");
159 gc->setLabel(QObject::tr("Port"));
160 gc->setValue("6543");
161 gc->setHelpText(QObject::tr("Unless you've got good reason, don't "
162 "change this."));
163 connect(gc, &StandardSetting::ChangeSaved,
165 return gc;
166};
167
169{
170 auto *gc = new HostTextEditSetting("BackendStatusPort");
171 gc->setLabel(QObject::tr("Status port"));
172 gc->setValue("6544");
173 gc->setHelpText(QObject::tr("Port on which the server will listen for "
174 "HTTP requests, including backend status and MythXML "
175 "requests."));
176 return gc;
177};
178
180{
181 auto *gc = new HostComboBoxSetting("BackendServerAddr", true);
182 gc->setLabel(QObject::tr("Primary IP address / DNS name"));
183 gc->setValue("127.0.0.1");
184 gc->setHelpText(QObject::tr("The Primary IP address of this backend "
185 "server. You can select an IP "
186 "address from the list or type a DNS name "
187 "or host name. Other systems will contact this "
188 "server using this address. "
189 "If you use a host name make sure it is assigned "
190 "an ip address other than 127.0.0.1 in the hosts "
191 "file."));
192 return gc;
193};
194
195// Deprecated
197{
198 auto *gc = new GlobalTextEditSetting("MasterServerIP");
199 gc->setLabel(QObject::tr("IP address"));
200 gc->setValue("127.0.0.1");
201 return gc;
202};
203
204// Deprecated
206{
207 auto *gc = new GlobalTextEditSetting("MasterServerPort");
208 gc->setLabel(QObject::tr("Port"));
209 gc->setValue("6543");
210 return gc;
211};
212
214{
215 auto *gc = new HostTextEditSetting("SecurityPin");
216 gc->setLabel(QObject::tr("Security PIN (required)"));
217 gc->setValue("");
218 gc->setHelpText(QObject::tr("PIN code required for a frontend to connect "
219 "to the backend. Blank prevents all "
220 "connections; 0000 allows any client to "
221 "connect."));
222 return gc;
223};
224
226{
227 auto *gc = new GlobalComboBoxSetting("TVFormat");
228 gc->setLabel(QObject::tr("TV format"));
229
230 QStringList list = ChannelTVFormat::GetFormats();
231 for (const QString& item : std::as_const(list))
232 gc->addSelection(item);
233
234 gc->setHelpText(QObject::tr("The TV standard to use for viewing TV."));
235 return gc;
236};
237
239{
240 auto *gc = new GlobalComboBoxSetting("VbiFormat");
241 gc->setLabel(QObject::tr("VBI format"));
242 gc->addSelection("None");
243 gc->addSelection("PAL teletext");
244 gc->addSelection("NTSC closed caption");
245 gc->setHelpText(QObject::tr("The VBI (Vertical Blanking Interval) is "
246 "used to carry Teletext or Closed Captioning "
247 "data."));
248 return gc;
249};
250
252{
253 auto *gc = new GlobalComboBoxSetting("FreqTable");
254 gc->setLabel(QObject::tr("Channel frequency table"));
255
256 for (const auto &list : gChanLists)
257 gc->addSelection(list.name);
258
259 gc->setHelpText(QObject::tr("Select the appropriate frequency table for "
260 "your system. If you have an antenna, use a \"-bcast\" "
261 "frequency."));
262 return gc;
263};
264
266{
267 auto *gc = new GlobalCheckBoxSetting("SaveTranscoding");
268 gc->setLabel(QObject::tr("Save original files after transcoding (globally)"));
269 gc->setValue(false);
270 gc->setHelpText(QObject::tr("If enabled and the transcoder is active, the "
271 "original files will be renamed to .old once the "
272 "transcoding is complete."));
273 return gc;
274};
275
277{
278 auto *hc = new HostCheckBoxSetting("TruncateDeletesSlowly");
279 hc->setLabel(QObject::tr("Delete files slowly"));
280 hc->setValue(false);
281 hc->setHelpText(QObject::tr("Some filesystems use a lot of resources when "
282 "deleting large files. If enabled, this option makes "
283 "MythTV delete files slowly on this backend to lessen the "
284 "impact."));
285 return hc;
286};
287
289{
290 auto *gc = new GlobalCheckBoxSetting("DeletesFollowLinks");
291 gc->setLabel(QObject::tr("Follow symbolic links when deleting files"));
292 gc->setValue(false);
293 gc->setHelpText(QObject::tr("If enabled, MythTV will follow symlinks "
294 "when recordings and related files are deleted, instead "
295 "of deleting the symlink and leaving the actual file."));
296 return gc;
297};
298
300{
301 auto *bs = new GlobalSpinBoxSetting(
302 "HDRingbufferSize", 25*188, 500*188, 25*188);
303 bs->setLabel(QObject::tr("HD ringbuffer size (kB)"));
304 bs->setHelpText(QObject::tr("The HD device ringbuffer allows the "
305 "backend to weather moments of stress. "
306 "The larger the ringbuffer (in kilobytes), the longer "
307 "the moments of stress can be. However, "
308 "setting the size too large can cause "
309 "swapping, which is detrimental."));
310 bs->setValue(50*188);
311 return bs;
312}
313
315{
316 auto *gc = new GlobalComboBoxSetting("StorageScheduler");
317 gc->setLabel(QObject::tr("Storage Group disk scheduler"));
318 gc->addSelection(QObject::tr("Balanced free space"), "BalancedFreeSpace");
319 gc->addSelection(QObject::tr("Balanced percent free space"), "BalancedPercFreeSpace");
320 gc->addSelection(QObject::tr("Balanced disk I/O"), "BalancedDiskIO");
321 gc->addSelection(QObject::tr("Combination"), "Combination");
322 gc->setValue("BalancedFreeSpace");
323 gc->setHelpText(QObject::tr("This setting controls how the Storage Group "
324 "scheduling code will balance new recordings across "
325 "directories. 'Balanced Free Space' is the recommended "
326 "method for most users." ));
327 return gc;
328};
329
331{
332 auto *gc = new GlobalCheckBoxSetting("DisableAutomaticBackup");
333 gc->setLabel(QObject::tr("Disable automatic database backup"));
334 gc->setValue(false);
335 gc->setHelpText(QObject::tr("If enabled, MythTV will not backup the "
336 "database before upgrades. You should "
337 "therefore have your own database backup "
338 "strategy in place."));
339 return gc;
340};
341
343{
344 auto *hc = new HostCheckBoxSetting("DisableFirewireReset");
345 hc->setLabel(QObject::tr("Disable FireWire reset"));
346 hc->setHelpText(
347 QObject::tr(
348 "By default, MythTV resets the FireWire bus when a "
349 "FireWire recorder stops responding to commands. If "
350 "this causes problems, you can disable this behavior "
351 "here."));
352 hc->setValue(false);
353 return hc;
354}
355
357{
358 auto *he = new HostTextEditSetting("MiscStatusScript");
359 he->setLabel(QObject::tr("Miscellaneous status application"));
360 he->setValue("");
361 he->setHelpText(QObject::tr("External application or script that outputs "
362 "extra information for inclusion in the "
363 "backend status page. See http://www.mythtv."
364 "org/wiki/Miscellaneous_Status_Information"));
365 return he;
366}
367
369{
370 auto *gc = new GlobalSpinBoxSetting("EITTransportTimeout", 1, 15, 1);
371 gc->setLabel(QObject::tr("EIT transport timeout (mins)"));
372 gc->setValue(5);
373 QString helpText = QObject::tr(
374 "Maximum time to spend waiting (in minutes) for listings data "
375 "on one digital TV channel before checking for new listings data "
376 "on the next channel.");
377 gc->setHelpText(helpText);
378 return gc;
379}
380
382{
383 auto *gc = new GlobalCheckBoxSetting("MasterBackendOverride");
384 gc->setLabel(QObject::tr("Master backend override"));
385 gc->setValue(true);
386 gc->setHelpText(QObject::tr("If enabled, the master backend will stream and"
387 " delete files if it finds them in a storage directory. "
388 "Useful if you are using a central storage location, like "
389 "a NFS share, and your slave backend isn't running."));
390 return gc;
391};
392
394{
395 auto *gc = new GlobalSpinBoxSetting("EITCrawIdleStart", 30, 7200, 30);
396 gc->setLabel(QObject::tr("Backend idle before EIT crawl (secs)"));
397 gc->setValue(60);
398 QString help = QObject::tr(
399 "The minimum number of seconds after a recorder becomes idle "
400 "to wait before MythTV begins collecting EIT listings data.");
401 gc->setHelpText(help);
402 return gc;
403}
404
406{
407 auto *gc = new GlobalSpinBoxSetting("EITScanPeriod", 5, 60, 5);
408 gc->setLabel(QObject::tr("EIT scan period (mins)"));
409 gc->setValue(15);
410 QString helpText = QObject::tr(
411 "Time to do EIT scanning on one capture card before moving "
412 "to the next capture card in the same input group that is "
413 "configured for EIT scanning. This can happen with multiple "
414 "satellite LNBs connected via a DiSEqC switch.");
415 gc->setHelpText(helpText);
416 return gc;
417}
418
420{
421 auto *gc = new GlobalSpinBoxSetting("EITEventChunkSize", 20, 1000, 20);
422 gc->setLabel(QObject::tr("EIT event chunk size"));
423 gc->setValue(20);
424 QString helpText = QObject::tr(
425 "Maximum number of DB inserts per ProcessEvents call. "
426 "This limits the rate at which EIT events are processed "
427 "in the backend so that there is always enough processing "
428 "capacity for the other backend tasks.");
429 gc->setHelpText(helpText);
430 return gc;
431}
432
434{
435 auto *gc = new GlobalCheckBoxSetting("EITCachePersistent");
436 gc->setLabel(QObject::tr("EIT cache persistent"));
437 gc->setValue(true);
438 QString helpText = QObject::tr(
439 "Save the content of the EIT cache in the database "
440 "and use that at the next start of the backend. "
441 "This reduces EIT event processing at a restart of the backend but at the "
442 "cost of updating the copy of the EIT cache in the database continuously.");
443 gc->setHelpText(helpText);
444 return gc;
445}
446
448{
449 auto *gc = new GlobalSpinBoxSetting("WOLbackendReconnectWaitTime", 0, 1200, 5);
450 gc->setLabel(QObject::tr("Delay between wake attempts (secs)"));
451 gc->setValue(0);
452 gc->setHelpText(QObject::tr("Length of time the frontend waits between "
453 "tries to wake up the master backend. This should be the "
454 "time your master backend needs to startup. Set to 0 to "
455 "disable."));
456 return gc;
457};
458
460{
461 auto *gc = new GlobalSpinBoxSetting("WOLbackendConnectRetry", 1, 60, 1);
462 gc->setLabel(QObject::tr("Wake attempts"));
463 gc->setHelpText(QObject::tr("Number of times the frontend will try to wake "
464 "up the master backend."));
465 gc->setValue(5);
466 return gc;
467};
468
470{
471 auto *gc = new GlobalTextEditSetting("WOLbackendCommand");
472 gc->setLabel(QObject::tr("Wake command"));
473 gc->setValue("");
474 gc->setHelpText(QObject::tr("The command used to wake up your master "
475 "backend server (e.g. wakeonlan 00:00:00:00:00:00)."));
476 return gc;
477};
478
480{
481 auto *gc = new HostTextEditSetting("SleepCommand");
482 gc->setLabel(QObject::tr("Sleep command"));
483 gc->setValue("");
484 gc->setHelpText(QObject::tr("The command used to put this slave to sleep. "
485 "If set, the master backend will use this command to put "
486 "this slave to sleep when it is not needed for recording."));
487 return gc;
488};
489
491{
492 auto *gc = new HostTextEditSetting("WakeUpCommand");
493 gc->setLabel(QObject::tr("Wake command"));
494 gc->setValue("");
495 gc->setHelpText(QObject::tr("The command used to wake up this slave "
496 "from sleep. This setting is not used on the master "
497 "backend."));
498 return gc;
499};
500
502{
503 auto *gc = new GlobalTextEditSetting("BackendStopCommand");
504 gc->setLabel(QObject::tr("Backend stop command"));
505 gc->setValue("killall mythbackend");
506 gc->setHelpText(QObject::tr("The command used to stop the backend"
507 " when running on the master backend server "
508 "(e.g. sudo /etc/init.d/mythtv-backend stop)"));
509 return gc;
510};
511
513{
514 auto *gc = new GlobalTextEditSetting("BackendStartCommand");
515 gc->setLabel(QObject::tr("Backend start command"));
516 gc->setValue("mythbackend");
517 gc->setHelpText(QObject::tr("The command used to start the backend"
518 " when running on the master backend server "
519 "(e.g. sudo /etc/init.d/mythtv-backend start)."));
520 return gc;
521};
522
524{
525 auto *gc = new GlobalSpinBoxSetting("idleTimeoutSecs", 0, 1200, 5);
526 gc->setLabel(QObject::tr("Idle shutdown timeout (secs)"));
527 gc->setValue(0);
528 gc->setHelpText(QObject::tr("The number of seconds the master backend "
529 "idles before it shuts down all other backends. Set to 0 to "
530 "disable automatic shutdown."));
531 return gc;
532};
533
535{
536 auto *gc = new GlobalSpinBoxSetting("idleWaitForRecordingTime", 0, 300, 1);
537 gc->setLabel(QObject::tr("Maximum wait for recording (mins)"));
538 gc->setValue(15);
539 gc->setHelpText(QObject::tr("The number of minutes the master backend "
540 "waits for a recording. If the backend is idle but a "
541 "recording starts within this time period, it won't "
542 "shut down."));
543 return gc;
544};
545
547{
548 auto *gc = new GlobalSpinBoxSetting("StartupSecsBeforeRecording", 0, 1200, 5);
549 gc->setLabel(QObject::tr("Startup before recording (secs)"));
550 gc->setValue(120);
551 gc->setHelpText(QObject::tr("The number of seconds the master backend "
552 "will be woken up before a recording starts."));
553 return gc;
554};
555
557{
558 auto *gc = new GlobalTextEditSetting("WakeupTimeFormat");
559 gc->setLabel(QObject::tr("Wakeup time format"));
560 gc->setValue("hh:mm yyyy-MM-dd");
561 gc->setHelpText(QObject::tr("The format of the time string passed to the "
562 "'Command to set wakeup time' as $time. See "
563 "QT::QDateTime.toString() for details. Set to 'time_t' for "
564 "seconds since epoch."));
565 return gc;
566};
567
569{
570 auto *gc = new GlobalTextEditSetting("SetWakeuptimeCommand");
571 gc->setLabel(QObject::tr("Command to set wakeup time"));
572 gc->setValue("");
573 gc->setHelpText(QObject::tr("The command used to set the wakeup time "
574 "(passed as $time) for the Master Backend"));
575 return gc;
576};
577
579{
580 auto *gc = new GlobalTextEditSetting("ServerHaltCommand");
581 gc->setLabel(QObject::tr("Server halt command"));
582 gc->setValue("sudo /sbin/halt -p");
583 gc->setHelpText(QObject::tr("The command used to halt the backends."));
584 return gc;
585};
586
588{
589 auto *gc = new GlobalTextEditSetting("preSDWUCheckCommand");
590 gc->setLabel(QObject::tr("Pre-shutdown-check command"));
591 gc->setValue("");
592 gc->setHelpText(QObject::tr("A command executed before the backend would "
593 "shutdown. The return value determines if "
594 "the backend can shutdown. 0 - yes, "
595 "1 - restart idling, "
596 "2 - reset the backend to wait for a frontend."));
597 return gc;
598};
599
601{
602 auto *gc = new GlobalCheckBoxSetting("blockSDWUwithoutClient");
603 gc->setLabel(QObject::tr("Block shutdown before client connected"));
604 gc->setValue(true);
605 gc->setHelpText(QObject::tr("If enabled, the automatic shutdown routine will "
606 "be disabled until a client connects."));
607 return gc;
608};
609
611{
612 auto *gc = new GlobalTextEditSetting("startupCommand");
613 gc->setLabel(QObject::tr("Startup command"));
614 gc->setValue("");
615 gc->setHelpText(QObject::tr("This command is executed right after starting "
616 "the BE. As a parameter '$status' is replaced by either "
617 "'auto' if the machine was started automatically or "
618 "'user' if a user switched it on."));
619 return gc;
620};
621
623{
624 auto *gc = new HostSpinBoxSetting("JobQueueMaxSimultaneousJobs", 1, 10, 1);
625 gc->setLabel(QObject::tr("Maximum simultaneous jobs on this backend"));
626 gc->setHelpText(QObject::tr("The Job Queue will be limited to running "
627 "this many simultaneous jobs on this backend."));
628 gc->setValue(1);
629 return gc;
630};
631
633{
634 auto *gc = new HostSpinBoxSetting("JobQueueCheckFrequency", 5, 300, 5);
635 gc->setLabel(QObject::tr("Job Queue check frequency (secs)"));
636 gc->setHelpText(QObject::tr("When looking for new jobs to process, the "
637 "Job Queue will wait this many seconds between checks."));
638 gc->setValue(60);
639 return gc;
640};
641
643{
644 auto *gc = new HostComboBoxSetting("JobQueueCPU");
645 gc->setLabel(QObject::tr("CPU usage"));
646 gc->addSelection(QObject::tr("Low"), "0");
647 gc->addSelection(QObject::tr("Medium"), "1");
648 gc->addSelection(QObject::tr("High"), "2");
649 gc->setHelpText(QObject::tr("This setting controls approximately how "
650 "much CPU jobs in the queue may consume. "
651 "On 'High', all available CPU time may be used, "
652 "which could cause problems on slower systems." ));
653 return gc;
654};
655
657{
658 auto *gc = new HostTimeBoxSetting("JobQueueWindowStart", "00:00");
659 gc->setLabel(QObject::tr("Job Queue start time"));
660 gc->setHelpText(QObject::tr("This setting controls the start of the "
661 "Job Queue time window, which determines when new jobs "
662 "will be started."));
663 return gc;
664};
665
667{
668 auto *gc = new HostTimeBoxSetting("JobQueueWindowEnd", "23:59");
669 gc->setLabel(QObject::tr("Job Queue end time"));
670 gc->setHelpText(QObject::tr("This setting controls the end of the "
671 "Job Queue time window, which determines when new jobs "
672 "will be started."));
673 return gc;
674};
675
677{
678 auto *gc = new GlobalCheckBoxSetting("JobsRunOnRecordHost");
679 gc->setLabel(QObject::tr("Run jobs only on original recording backend"));
680 gc->setValue(false);
681 gc->setHelpText(QObject::tr("If enabled, jobs in the queue will be required "
682 "to run on the backend that made the "
683 "original recording."));
684 return gc;
685};
686
688{
689 auto *gc = new GlobalCheckBoxSetting("AutoTranscodeBeforeAutoCommflag");
690 gc->setLabel(QObject::tr("Run transcode jobs before auto commercial "
691 "detection"));
692 gc->setValue(false);
693 gc->setHelpText(QObject::tr("If enabled, and if both auto-transcode and "
694 "commercial detection are turned ON for a "
695 "recording, transcoding will run first; "
696 "otherwise, commercial detection runs first."));
697 return gc;
698};
699
701{
702 auto *gc = new GlobalCheckBoxSetting("AutoCommflagWhileRecording");
703 gc->setLabel(QObject::tr("Start auto-commercial-detection jobs when the "
704 "recording starts"));
705 gc->setValue(false);
706 gc->setHelpText(QObject::tr("If enabled, and Auto Commercial Detection is "
707 "ON for a recording, the flagging job will be "
708 "started as soon as the recording starts. NOT "
709 "recommended on underpowered systems."));
710 return gc;
711};
712
714{
715 auto *gc = new GlobalTextEditSetting(QString("UserJob%1").arg(job_num));
716 gc->setLabel(QObject::tr("User Job #%1 command").arg(job_num));
717 gc->setValue("");
718 gc->setHelpText(QObject::tr("The command to run whenever this User Job "
719 "number is scheduled."));
720 return gc;
721};
722
724{
725 auto *gc = new GlobalTextEditSetting(QString("UserJobDesc%1")
726 .arg(job_num));
727 gc->setLabel(QObject::tr("User Job #%1 description").arg(job_num));
728 gc->setValue(QObject::tr("User Job #%1").arg(job_num));
729 gc->setHelpText(QObject::tr("The description for this User Job."));
730 return gc;
731};
732
734{
735 auto *gc = new HostCheckBoxSetting("JobAllowMetadata");
736 gc->setLabel(QObject::tr("Allow metadata lookup jobs"));
737 gc->setValue(true);
738 gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
739 "run on this backend."));
740 return gc;
741};
742
744{
745 auto *gc = new HostCheckBoxSetting("JobAllowCommFlag");
746 gc->setLabel(QObject::tr("Allow commercial-detection jobs"));
747 gc->setValue(true);
748 gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
749 "run on this backend."));
750 return gc;
751};
752
754{
755 auto *gc = new HostCheckBoxSetting("JobAllowTranscode");
756 gc->setLabel(QObject::tr("Allow transcoding jobs"));
757 gc->setValue(true);
758 gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
759 "run on this backend."));
760 return gc;
761};
762
764{
765 auto *gc = new HostCheckBoxSetting("JobAllowPreview");
766 gc->setLabel(QObject::tr("Allow preview jobs"));
767 gc->setValue(true);
768 gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
769 "run on this backend."));
770 return gc;
771};
772
774{
775 auto *gc = new GlobalTextEditSetting("JobQueueTranscodeCommand");
776 gc->setLabel(QObject::tr("Transcoder command"));
777 gc->setValue("mythtranscode");
778 gc->setHelpText(QObject::tr("The program used to transcode recordings. "
779 "The default is 'mythtranscode' if this setting is empty."));
780 return gc;
781};
782
784{
785 auto *gc = new GlobalTextEditSetting("JobQueueCommFlagCommand");
786 gc->setLabel(QObject::tr("Commercial-detection command"));
787 gc->setValue("mythcommflag");
788 gc->setHelpText(QObject::tr("The program used to detect commercials in a "
789 "recording. The default is 'mythcommflag' "
790 "if this setting is empty."));
791 return gc;
792};
793
795{
796 QString dbStr = QString("JobAllowUserJob%1").arg(job_num);
797 QString desc = gCoreContext->GetSetting(QString("UserJobDesc%1").arg(job_num));
798 QString label = QObject::tr("Allow %1 jobs").arg(desc);
799
800 auto *bc = new HostCheckBoxSetting(dbStr);
801 bc->setLabel(label);
802 bc->setValue(false);
803 // FIXME:
804 // It would be nice to disable inactive jobs,
805 // but enabling them currently requires a restart of mythtv-setup
806 // after entering the job command string. Will improve this logic later:
807 // if (QString(gCoreContext->GetSetting(QString("UserJob%1").arg(job_num)))
808 // .length() == 0)
809 // bc->setEnabled(false);
810 bc->setHelpText(QObject::tr("If enabled, allow jobs of this type to "
811 "run on this backend."));
812 return bc;
813}
814
815#if 0
816static GlobalCheckBoxSetting *UPNPShowRecordingUnderVideos()
817{
818 GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("UPnP/RecordingsUnderVideos");
819 gc->setLabel(QObject::tr("Include recordings in video list"));
820 gc->setValue(false);
821 gc->setHelpText(QObject::tr("If enabled, the master backend will include"
822 " the list of recorded shows in the list of videos. "
823 " This is mainly to accommodate UPnP players which do not"
824 " allow more than 1 video section." ));
825 return gc;
826};
827#endif
828
830{
831 auto *gc = new GlobalComboBoxSetting("UPnP/WMPSource");
832 gc->setLabel(QObject::tr("Video content to show a WMP client"));
833 gc->addSelection(QObject::tr("Recordings"),"0");
834 gc->addSelection(QObject::tr("Videos"),"1");
835 gc->setValue("0");
836 gc->setHelpText(QObject::tr("Which tree to show a Windows Media Player "
837 "client when it requests a list of videos."));
838 return gc;
839};
840
842{
843 auto *bc = new GlobalCheckBoxSetting("MythFillEnabled");
844 bc->setLabel(QObject::tr("Automatically update program listings"));
845 bc->setValue(true);
846 bc->setHelpText(QObject::tr("If enabled, the guide data program "
847 "will be run automatically."));
848 return bc;
849}
850
852{
853 auto *bs = new GlobalSpinBoxSetting("MythFillMinHour", 0, 23, 1);
854 bs->setLabel(QObject::tr("Guide data program execution start"));
855 bs->setValue(0);
856 bs->setHelpText(QObject::tr("This setting and the following one define a "
857 "time period when the guide data program is allowed "
858 "to run. For example, setting start to 11 and "
859 "end to 13 would mean that the program would only "
860 "run between 11:00 AM and 1:59 PM."));
861 return bs;
862}
863
865{
866 auto *bs = new GlobalSpinBoxSetting("MythFillMaxHour", 0, 23, 1);
867 bs->setLabel(QObject::tr("Guide data program execution end"));
868 bs->setValue(23);
869 bs->setHelpText(QObject::tr("This setting and the preceding one define a "
870 "time period when the guide data program is allowed "
871 "to run. For example, setting start to 11 and "
872 "end to 13 would mean that the program would only "
873 "run between 11:00 AM and 1:59 PM."));
874 return bs;
875}
876
878{
879 auto *bc = new GlobalCheckBoxSetting("MythFillGrabberSuggestsTime");
880 bc->setLabel(QObject::tr("Run guide data program at time suggested by the "
881 "grabber."));
882 bc->setValue(true);
883 bc->setHelpText(QObject::tr("If enabled, allow a guide data "
884 "provider to specify the next download time in order "
885 "to distribute load on their servers. Guide data program "
886 "execution start/end times are also ignored."));
887 return bc;
888}
889
891{
892 auto *be = new GlobalTextEditSetting("MythFillDatabasePath");
893 be->setLabel(QObject::tr("Guide data program"));
894 be->setValue("mythfilldatabase");
895 be->setHelpText(QObject::tr(
896 "Use 'mythfilldatabase' or the name of a custom "
897 "script that will populate the program guide info "
898 "for all your video sources."));
899 return be;
900}
901
903{
904 auto *be = new GlobalTextEditSetting("MythFillDatabaseArgs");
905 be->setLabel(QObject::tr("Guide data arguments"));
906 be->setValue("");
907 be->setHelpText(QObject::tr("Any arguments you want passed to the "
908 "guide data program."));
909 return be;
910}
911
913{
914 public:
916 {
917 setLabel(QObject::tr("Program Schedule Downloading Options"));
918
919 GlobalCheckBoxSetting* fillEnabled = MythFillEnabled();
920 addChild(fillEnabled);
921
922 fillEnabled->addTargetedChild("1", MythFillDatabasePath());
923 fillEnabled->addTargetedChild("1", MythFillDatabaseArgs());
924 fillEnabled->addTargetedChild("1", MythFillMinHour());
925 fillEnabled->addTargetedChild("1", MythFillMaxHour());
927 }
928};
929
931 : m_isMasterBackend(IsMasterBackend()),
932 m_localServerPort(LocalServerPort()),
933 m_backendServerAddr(BackendServerAddr()),
934 m_masterServerName(MasterServerName()),
935 m_ipAddressSettings(new IpAddressSettings()),
936 // These two are included for backward compatibility -
937 // used by python bindings. They could be removed later
938 m_masterServerIP(MasterServerIP()),
939 m_masterServerPort(MasterServerPort())
940{
941 //++ Host Address Backend Setup ++
942 auto* server = new GroupSetting();
943 server->setLabel(tr("Host Address Backend Setup"));
944 server->addChild(m_localServerPort);
945 server->addChild(LocalStatusPort());
946 server->addChild(LocalSecurityPin());
947 server->addChild(AllowConnFromAll());
948 //+++ IP Addresses +++
949 server->addChild(m_ipAddressSettings);
953 static_cast<void (StandardSetting::*)(const QString&)>(&StandardSetting::valueChanged),
956 static_cast<void (StandardSetting::*)(const QString&)>(&StandardSetting::valueChanged),
958 server->addChild(m_backendServerAddr);
959 //++ Master Backend ++
962 server->addChild(m_isMasterBackend);
963 server->addChild(m_masterServerName);
964 addChild(server);
965
966 //++ Locale Settings ++
967 auto* locale = new GroupSetting();
968 locale->setLabel(QObject::tr("Locale Settings"));
969 locale->addChild(TVFormat());
970 locale->addChild(VbiFormat());
971 locale->addChild(FreqTable());
972 addChild(locale);
973
974 auto* group2 = new GroupSetting();
975 group2->setLabel(QObject::tr("Miscellaneous Settings"));
976
977 auto* fm = new GroupSetting();
978 fm->setLabel(QObject::tr("File Management Settings"));
979 fm->addChild(MasterBackendOverride());
980 fm->addChild(DeletesFollowLinks());
981 fm->addChild(TruncateDeletes());
982 fm->addChild(HDRingbufferSize());
983 fm->addChild(StorageScheduler());
984 group2->addChild(fm);
985 auto* upnp = new GroupSetting();
986 upnp->setLabel(QObject::tr("UPnP Server Settings"));
987 //upnp->addChild(UPNPShowRecordingUnderVideos());
988 upnp->addChild(UPNPWmpSource());
989 group2->addChild(upnp);
990 group2->addChild(MiscStatusScript());
991 group2->addChild(DisableAutomaticBackup());
992 group2->addChild(DisableFirewireReset());
993 addChild(group2);
994
995 auto* group2a1 = new GroupSetting();
996 group2a1->setLabel(QObject::tr("EIT Scanner Options"));
997 group2a1->addChild(EITTransportTimeout());
998 group2a1->addChild(EITCrawIdleStart());
999 group2a1->addChild(EITScanPeriod());
1000 group2a1->addChild(EITEventChunkSize());
1001 group2a1->addChild(EITCachePersistent());
1002 addChild(group2a1);
1003
1004 auto* group3 = new GroupSetting();
1005 group3->setLabel(QObject::tr("Shutdown/Wakeup Options"));
1006 group3->addChild(startupCommand());
1007 group3->addChild(blockSDWUwithoutClient());
1008 group3->addChild(idleTimeoutSecs());
1009 group3->addChild(idleWaitForRecordingTime());
1010 group3->addChild(StartupSecsBeforeRecording());
1011 group3->addChild(WakeupTimeFormat());
1012 group3->addChild(SetWakeuptimeCommand());
1013 group3->addChild(ServerHaltCommand());
1014 group3->addChild(preSDWUCheckCommand());
1015 addChild(group3);
1016
1017 auto* group4 = new GroupSetting();
1018 group4->setLabel(QObject::tr("Backend Wakeup settings"));
1019
1020 auto* backend = new GroupSetting();
1021 backend->setLabel(QObject::tr("Master Backend"));
1022 backend->addChild(WOLbackendReconnectWaitTime());
1023 backend->addChild(WOLbackendConnectRetry());
1024 backend->addChild(WOLbackendCommand());
1025 group4->addChild(backend);
1026
1027 auto* slaveBackend = new GroupSetting();
1028 slaveBackend->setLabel(QObject::tr("Slave Backends"));
1029 slaveBackend->addChild(SleepCommand());
1030 slaveBackend->addChild(WakeUpCommand());
1031 group4->addChild(slaveBackend);
1032 addChild(group4);
1033
1034 auto* backendControl = new GroupSetting();
1035 backendControl->setLabel(QObject::tr("Backend Control"));
1036 backendControl->addChild(BackendStopCommand());
1037 backendControl->addChild(BackendStartCommand());
1038 addChild(backendControl);
1039
1040 auto* group5 = new GroupSetting();
1041 group5->setLabel(QObject::tr("Job Queue (Backend-Specific)"));
1042 group5->addChild(JobQueueMaxSimultaneousJobs());
1043 group5->addChild(JobQueueCheckFrequency());
1044 group5->addChild(JobQueueWindowStart());
1045 group5->addChild(JobQueueWindowEnd());
1046 group5->addChild(JobQueueCPU());
1047 group5->addChild(JobAllowMetadata());
1048 group5->addChild(JobAllowCommFlag());
1049 group5->addChild(JobAllowTranscode());
1050 group5->addChild(JobAllowPreview());
1051 group5->addChild(JobAllowUserJob(1));
1052 group5->addChild(JobAllowUserJob(2));
1053 group5->addChild(JobAllowUserJob(3));
1054 group5->addChild(JobAllowUserJob(4));
1055 addChild(group5);
1056
1057 auto* group6 = new GroupSetting();
1058 group6->setLabel(QObject::tr("Job Queue (Global)"));
1059 group6->addChild(JobsRunOnRecordHost());
1060 group6->addChild(AutoCommflagWhileRecording());
1061 group6->addChild(JobQueueCommFlagCommand());
1062 group6->addChild(JobQueueTranscodeCommand());
1063 group6->addChild(AutoTranscodeBeforeAutoCommflag());
1064 group6->addChild(SaveTranscoding());
1065 addChild(group6);
1066
1067 auto* group7 = new GroupSetting();
1068 group7->setLabel(QObject::tr("Job Queue (Job Commands)"));
1069 group7->addChild(UserJobDesc(1));
1070 group7->addChild(UserJob(1));
1071 group7->addChild(UserJobDesc(2));
1072 group7->addChild(UserJob(2));
1073 group7->addChild(UserJobDesc(3));
1074 group7->addChild(UserJob(3));
1075 group7->addChild(UserJobDesc(4));
1076 group7->addChild(UserJob(4));
1077 addChild(group7);
1078
1079 auto *mythfill = new MythFillSettings();
1080 addChild(mythfill);
1081
1082}
1083
1085{
1086 if (!m_isLoaded)
1087 return;
1088 bool ismasterchecked = m_isMasterBackend->boolValue();
1089 if (ismasterchecked)
1091 else
1093}
1094
1096{
1097 if (!m_isLoaded)
1098 return;
1099 bool addrChanged = m_backendServerAddr->haveChanged();
1100 QString currentsetting = m_backendServerAddr->getValue();
1103 {
1104 QList<QHostAddress> list = QNetworkInterface::allAddresses();
1105 QList<QHostAddress>::iterator it;
1106 for (it = list.begin(); it != list.end(); ++it)
1107 {
1108 it->setScopeId(QString());
1109 m_backendServerAddr->addSelection((*it).toString(), (*it).toString());
1110 }
1111 }
1112 else
1113 {
1118 }
1119 // Remove the blank entry that is caused by clearSelections
1120 // TODO probably not needed anymore?
1121 // m_backendServerAddr->removeSelection(QString());
1122
1123 QHostAddress addr;
1124 if (addr.setAddress(currentsetting))
1125 {
1126 // if prior setting is an ip address
1127 // it only if it is now in the list
1128 if (m_backendServerAddr->getValueIndex(currentsetting)
1129 > -1)
1130 m_backendServerAddr->setValue(currentsetting);
1131 else
1133 }
1134 else if (! currentsetting.isEmpty())
1135 {
1136 // if prior setting was not an ip address, it must
1137 // have been a dns name so add it back and select it.
1138 m_backendServerAddr->addSelection(currentsetting);
1139 m_backendServerAddr->setValue(currentsetting);
1140 }
1141 else
1142 {
1144 }
1145 m_backendServerAddr->setChanged(addrChanged);
1146}
1147
1148
1150{
1151 m_isLoaded=false;
1153
1154 // These two are included for backward compatibility - only used by python
1155 // bindings. They should be removed later
1158
1159 QString mastername = m_masterServerName->getValue();
1160 // new installation - default to master
1161 bool newInstall=false;
1162 if (mastername.isEmpty())
1163 {
1164 mastername = gCoreContext->GetHostName();
1165 newInstall=true;
1166 }
1167 bool ismaster = (mastername == gCoreContext->GetHostName());
1168 m_isMasterBackend->setValue(ismaster);
1169 m_priorMasterName = mastername;
1170 m_isLoaded=true;
1172 listenChanged();
1173 if (!newInstall)
1174 {
1178 }
1179}
1180
1182{
1183 // Setup deprecated backward compatibility settings
1185 {
1186 QString addr = m_backendServerAddr->getValue();
1187 QString ip = MythCoreContext::resolveAddress(addr);
1190 }
1191
1192 // If listen on all is specified, set up values for the
1193 // specific IPV4 and IPV6 addresses for backward
1194 // compatibilty with other things that may use them
1196 {
1197 QString bea = m_backendServerAddr->getValue();
1198 // initialize them to localhost values
1205 // the setValue calls below only set the value if it is in the list.
1208 }
1209
1211
1212 // These two are included for backward compatibility - only used by python
1213 // bindings. They should be removed later
1216}
1217
1219{
1220 delete m_masterServerIP;
1221 m_masterServerIP=nullptr;
1222 delete m_masterServerPort;
1223 m_masterServerPort=nullptr;
1224}
static GlobalSpinBoxSetting * WOLbackendReconnectWaitTime()
static GlobalCheckBoxSetting * MythFillGrabberSuggestsTime()
static GlobalTextEditSetting * MasterServerIP()
static GlobalCheckBoxSetting * MasterBackendOverride()
static HostCheckBoxSetting * JobAllowCommFlag()
static GlobalSpinBoxSetting * EITEventChunkSize()
static GlobalTextEditSetting * MythFillDatabaseArgs()
static HostCheckBoxSetting * UseLinkLocal()
static HostTimeBoxSetting * JobQueueWindowStart()
static GlobalTextEditSetting * MasterServerPort()
static HostTextEditSetting * LocalStatusPort()
static GlobalCheckBoxSetting * DisableAutomaticBackup()
static HostTimeBoxSetting * JobQueueWindowEnd()
static GlobalSpinBoxSetting * MythFillMinHour()
static GlobalTextEditSetting * WakeupTimeFormat()
static GlobalCheckBoxSetting * JobsRunOnRecordHost()
static GlobalComboBoxSetting * VbiFormat()
static HostSpinBoxSetting * JobQueueCheckFrequency()
static GlobalCheckBoxSetting * MythFillEnabled()
static GlobalSpinBoxSetting * EITTransportTimeout()
static GlobalTextEditSetting * JobQueueCommFlagCommand()
static GlobalCheckBoxSetting * AutoTranscodeBeforeAutoCommflag()
static HostCheckBoxSetting * DisableFirewireReset()
static GlobalTextEditSetting * BackendStartCommand()
static GlobalSpinBoxSetting * EITCrawIdleStart()
static GlobalSpinBoxSetting * StartupSecsBeforeRecording()
static GlobalTextEditSetting * UserJob(uint job_num)
static GlobalComboBoxSetting * TVFormat()
static GlobalCheckBoxSetting * EITCachePersistent()
static GlobalCheckBoxSetting * DeletesFollowLinks()
static GlobalCheckBoxSetting * AutoCommflagWhileRecording()
static GlobalSpinBoxSetting * WOLbackendConnectRetry()
static GlobalTextEditSetting * MasterServerName()
static HostCheckBoxSetting * JobAllowPreview()
static HostComboBoxSetting * LocalServerIP()
static HostComboBoxSetting * BackendServerAddr()
static HostTextEditSetting * LocalSecurityPin()
static GlobalTextEditSetting * UserJobDesc(uint job_num)
static GlobalTextEditSetting * JobQueueTranscodeCommand()
static GlobalComboBoxSetting * StorageScheduler()
static GlobalTextEditSetting * MythFillDatabasePath()
static GlobalCheckBoxSetting * blockSDWUwithoutClient()
static HostCheckBoxSetting * JobAllowMetadata()
static HostTextEditSetting * SleepCommand()
static GlobalSpinBoxSetting * MythFillMaxHour()
static GlobalSpinBoxSetting * idleTimeoutSecs()
static GlobalSpinBoxSetting * HDRingbufferSize()
static HostCheckBoxSetting * JobAllowUserJob(uint job_num)
static GlobalTextEditSetting * WOLbackendCommand()
static GlobalSpinBoxSetting * idleWaitForRecordingTime()
static GlobalCheckBoxSetting * SaveTranscoding()
static HostTextEditSetting * WakeUpCommand()
static GlobalTextEditSetting * SetWakeuptimeCommand()
static TransMythUICheckBoxSetting * IsMasterBackend()
static GlobalTextEditSetting * BackendStopCommand()
static HostCheckBoxSetting * AllowConnFromAll()
static GlobalTextEditSetting * ServerHaltCommand()
static HostComboBoxSetting * LocalServerIP6()
static GlobalComboBoxSetting * UPNPWmpSource()
static GlobalTextEditSetting * startupCommand()
static GlobalTextEditSetting * preSDWUCheckCommand()
static HostCheckBoxSetting * JobAllowTranscode()
static HostComboBoxSetting * JobQueueCPU()
static GlobalSpinBoxSetting * EITScanPeriod()
static HostSpinBoxSetting * JobQueueMaxSimultaneousJobs()
static GlobalComboBoxSetting * FreqTable()
static HostTextEditSetting * MiscStatusScript()
static HostCheckBoxSetting * TruncateDeletes()
static void LocalServerPortChanged(void)
void masterBackendChanged(void)
HostComboBoxSetting * m_backendServerAddr
QString m_priorMasterName
TransMythUICheckBoxSetting * m_isMasterBackend
HostTextEditSetting * LocalServerPort(void) const
GlobalTextEditSetting * m_masterServerIP
GlobalTextEditSetting * m_masterServerPort
void Load(void) override
~BackendSettings() override
void Save(void) override
HostTextEditSetting * m_localServerPort
void listenChanged(void)
IpAddressSettings * m_ipAddressSettings
GlobalTextEditSetting * m_masterServerName
static QStringList GetFormats(void)
GroupSetting()=default
HostComboBoxSetting * m_localServerIP
HostComboBoxSetting * m_localServerIP6
QString GetHostName(void)
static QString resolveAddress(const QString &host, ResolveType type=ResolveAny, bool keepscope=false)
if host is an IP address, it will be returned or resolved otherwise.
QString GetSetting(const QString &key, const QString &defaultval="")
static void ClearBackendServerPortCache()
void setValue(const QString &newValue) override
void addSelection(const QString &label, QString value=QString(), bool select=false)
void setValue(int value) override
int getValueIndex(const QString &value) const
virtual void addChild(StandardSetting *child)
virtual void Save(void)
virtual void Load(void)
void addTargetedChild(const QString &value, StandardSetting *setting)
virtual void setHelpText(const QString &str)
bool haveChanged()
Return true if the setting have changed or any of its children.
virtual void setValue(const QString &newValue)
void valueChanged(const QString &newValue)
virtual QString getValue(void) const
virtual void setLabel(QString str)
void setChanged(bool changed)
unsigned int uint
Definition: freesurround.h:24
const CHANLISTS_vec gChanLists
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.