1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
#!usr/bin/perl
use Test::More tests => 2;
use FindBin qw/$Bin/;
# In the Debian project Reproducible Builds, the timezone isn't set correctly
# this causes Date::Manip to print out:
# ERROR: Date::Manip unable to determine Time Zone. GMT will be used. at /usr/share/perl5/Date/Manip/DM6.pm line 65.
# ERROR: Date::Manip unable to determine Time Zone. GMT will be used. at /usr/share/perl5/Date/Manip/DM6.pm line 68.
# This started in October 2023. Nothing of importance was noted in the
# libdata-manip-perl . Work around this by forcing the timezone. We only need
# this for this test file, the others aren't (currently) affected.
$ENV{'TZ'} = 'UTC';
# Test that the blurb of how to get help is printed.
my $out = `$Bin/../bin/mythtv-status --zzz 2>&1`;
my $expected = <<EOF;
Unknown option: zzz
Use --help for help.
Usage:
mythtv-status [options]
EOF
ok($out eq $expected, 'Invalid option returns help blurb')
|| diag("Output from mythtv-status:\n$out");
# Check the help output, using --help.
$out = `$Bin/../bin/mythtv-status --help 2>&1`;
$expected = <<EOF;
Usage:
mythtv-status [options]
Options:
-c, --colour
Use colour when showing the status of the encoder(s).
--date
Set the date to run as, used for debugging purposes.
-d, --description
Display the description for the scheduled recordings.
--disk-space-warn
The threshold (in percent) of used disk space that we should show
the disk space in red (if using colour) or send an email if we're in
email mode with email only on warnings.
--encoder-details
Display the input ID and channel name against the recording details.
--encoder-skip-idle
Suppress displaying idle encoders in the Encoders block.
--encoder-warn-non-idle
Display warnings if an encoder is not idle. This is the default, it
allows you to know if an encoder or the MythTV system is busy. To
disable, use --no-encoder-warn-non-idle.
-e, --episode
Display the episode (subtitle) for the scheduled recordings.
--email <address>[ --email <address> ...]
Send the output to the listed email addresses. By default the
encoder status, currently recording shows and time till next
recording is suppressed from the email.
To turn the additional blocks on you can use --encoders,
--recording-now and/or --next-recording.
By default highlight is turned on, to disable it use --nohighlight.
--email-only-on-alert
Only send an email out (if --email is present) if there is an alert
(i.e., schedule conflict or low disk space).
-?, --help
Display help.
--file <file>
Load XML from the file specified instead of querying a MythTV
backend. Handy for debugging things.
--save-file <file>
Save the XML we received from the MythTV backend. Handy for
debugging things.
--guide-days-warn <days>
Warn if the number of days of guide data present is equal to or
below this level. Default is 2 days.
-h HOST, --host=HOST
The host to check, defaults to localhost.
--highlight
Surround any items that are considered a warning with asterisks.
This helps to highlight an issue if colour mode is disabled.
--nostatus, --noencoders, --norecording-now, --noscheduled-recordings,
--noschedule-conflicts, --nonext-recording, --nototal-disk-space,
--nodisk-space, --noguide-data, --noauto-expire
Suppress displaying blocks of the output if they would normally be
displayed.
-p PORT, --port=PORT
The port to use when connecting to MythTV, defaults to 6544.
--oneliner-bullets
Insert asterisks (*) before each of the oneliners to stop some email
clients from thinking the oneliner block is a paragraph and trying
to word wrap them.
--auto-expire
Display the shows due to auto expire (output is normally
suppressed).
--auto-expire-count
How many of the auto expire shows to display, defaults to 10.
--recording-in-warn
If the "Next Recording In" time is less than this amount, display it
in red. This in seconds, and defaults to 3600 (1 hour).
--verbose
Have slightly more verbose output. This includes any warnings that
might be generated while parsing the XML.
-v, --version
Show the version of mythtv-status and then exit.
EOF
ok($out eq $expected, '--help generates help output')
|| diag("Output from mythtv-status:\n$out");
|