pax_global_header 0000666 0000000 0000000 00000000064 14456744277 0014536 g ustar 00root root 0000000 0000000 52 comment=9e1fa9fd8c252fbb399ed33929c602ffe0fde2c6
mythtv-status-1.1.0/ 0000775 0000000 0000000 00000000000 14456744277 0014411 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/COPYING 0000664 0000000 0000000 00000077217 14456744277 0015462 0 ustar 00root root 0000000 0000000
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
mythtv-status-1.1.0/ChangeLog 0000664 0000000 0000000 00000034141 14456744277 0016166 0 ustar 00root root 0000000 0000000 2023-07-23 Andrew Ruthven
Release version 1.1.0.
2023-07-16 Andrew Ruthven
Remove bashisms
Include my Makefile in the tarball, this allows using "make install" to install
mythtv-status.
Make all shell scripts much clenaer according to shellcheck.
Refresh URLs in FAQ, update libmythtv-perl package name.
Remove obsolete question/answer from FAQ as my patch for improving storage
group data was merged in 2008.
Update the "Why this tool?" section in the README.
Actually install the mythtv-update-motd man page!
Provide systemd service and timer files in tarball, hopefully useful as a
starting point for distros other than Debian.
2001-02-14 Andrew Ruthven
Release version 1.0.2.
2020-12-06 Andrew Ruthven
Minor update to systemd service file.
I noticed that if /run/motd.mythtv-status doesn't exist then
update-motd.d/50-mythtv-status exits with exit code 1 and pam_motd spits a
warning. I don't really want that to happen.
2019-01-29 Andrew Ruthven
Release version 1.0.1.
2019-01-27 Andrew Ruthven
Switching from using -w to use warnings, caused my previous method to
disable warnings when calling MythTV::Program broke.
The warning we're suppressing is:
Argument "Default" isn't numeric in bitwise and (&) at /usr/share/perl5/MythTV/Program.pm line 95.
Thanks to Göran Uddeborg for spotting this regression.
2019-01-11 Andrew Ruthven
Add support for Fedora to mythtv-update-motd based on proposed file
from Göran Uddebor.
mythtv-update-status now uses UPDATE_MOTD and UPDATE_MOTD_ARGS
to replace RUN and ARGS respectively. Both RUN and ARGS will be
used if the new variables aren't defined.
Switch from /var/run to /run.
Update the Copyright years.
Release version 1.0.0.
2018-12-31 Andrew Ruthven
Ship a systemd service file which correctly starts and stops the motd
update services. As part of this change, if you use systemd or sysvinit
to stop mythtv-status it will stop updating the motd snippet via cron.
2018-12-30 Andrew Ruthven
Modify mythtv-update-motd to look to see if /etc/update-motd.d is
present, if it is, then generate MOTD content in a compatible fashion.
On Debian derived systems we now install a snippet into /etc/update-motd.d
to cat the generated file if it is present.
2018-12-30 David Meritt
Fix the output of Next Recording to never have negative numbers.
2018-12-09 Andrew Ruthven
Traditionally I've considered any state which could cause you yo lose
recordings to be warning state. Some people don't want to be warned
if an encoder is recording, so allow that with --no-encoder-warn-non-idle.
2018-12-07 Andrew Ruthven
Tidy up conversion logic for disk sizes to fix a long running bug when
the free space is converted to a different unit than the total space.
Adjust threshold for when we switch to TB.
Add an option --highlight which uses asterisk to highlight warnings.
This is useful in emails to highlight your attention to the right place
2018-11-13 Andrew Ruthven
Show device type in encoder output (i.e: DVB).
Thanks to Eric Wilde for the suggestion and proposed patch.
Eradicate tabs from the code.
2018-11-12 Eric Wilde
Make Config::Auto an optional module.
Minor re-arrangement of output to make it more consistent.
Remove dependency on Sys::SigAction.
2017-01-26 Andrew Ruthven
Update the Copyright years.
Decode UTF-8 characters when we're getting data using MythTV::Program,
thank you Illés Solfor submitting a patch to fix Schedule Conflicts.
Release version 0.10.8.
2016-09-09 Andrew Ruthven
Fix a bug where it wasn't possible to disable skipping idle
encoders via the config file. Thanks to Karl for finding this.
2016-08-02 Andrew Ruthven
Fix a long standing bug where if the Next Recording is a week
and one day in the future, the Next Recording only shows
the hours.
2016-08-02 Andrew Ruthven
Somewhere between Date::Manip v6.0 and v6.32 the behaviour for
DateCalc has changed, so that now a DateCalc will keep on
increasing the hours field, without rolling over the days field.
Switching to an approximate mode for DateCalc which resolves this.
2015-01-10 Andrew Ruthven
Make the cron.d file for Debian use mythtv-update-motd to stop
systemd from being upset.
Release version 0.10.7.
2014-12-02 Andrew Ruthven
Add in more UTF-8 encodings as required for Perl v5.18, thanks to
Jan Schneider for reporting the UTF-8 issue.
Release versions 0.10.5 & 0.10.6.
2014-09-11 Andrew Ruthven
Spotted that if the next recording is in 30 hours, then it is
displayed as "0 Days, 3". Correct it so it'll be displayed
as "30 Hours". Also fixes an issue where "0 hours" was removed
if the hour was a multiple of 10. Thanks to Stephan Seitz for
reporting the multiple of 10 issue.
Release version 0.10.4.
2013-10-28 Andrew Ruthven
Guard against zero total disk space, this affected Werner Mahr.
Fix up processing of dates with oldstyle timestamps for in
progress recordings.
Add support to specify the date we're running mythtv-status on
so that we can test various scenarios.
2013-10-27 Andrew Ruthven
Handle the handling in POD in Perl 5.18. Force the return code
=item lines to be handled correctly.
2013-02-09 Andrew Ruthven
Update Jan's patch to be acceptable to non-US folks. ;)
Also process the timezone info for in progress recordings so the
Ends time is correct.
2013-02-09 Jan Schneider
Add support for processing the UTC time stamps for the schedule
start time as well.
2013-01-29 Andrew Ruthven
MythTV 0.26 now uses UTC in the time/date attributes in Status.
We now convert it to the local timezone.
2012-07-07 Andrew Ruthven
Switch to using the exact mode when working out the time to the
next recording. Also, if the next recording is in 1 Hour, 1 Minute
don't report it as "1 Hour, 1 Minutes". Thank you to Julian Gilbey
for the patch fixing this.
If the next recording is in $x Hours, 0 Minutes, remove the comma
as well, previously it was outputting "$x Hours,".
If the next recording is in more than 1 day, then switch to showing
it in days and hours, for example "1 Day, 2 Hours".
Hrmm, the XML protocol version was wrong for the encoder status,
so we incorrectly showed "7" instead of "Recording" for an encoder
that was in fact recording.
Release version 0.10.2.
2012-07-06 Andrew Ruthven
Correctly handle UTF-8 in the output from MythTV.
2012-06-14 Andrew Ruthven
Setting $0 stopped --help and -? from working, fix that.
Add the start of a test suite!
Release versions 0.10.0 & 0.10.1.
2012-03-04 Andrew Ruthven
It turns out that some email clients treat the oneliner block
as a paragraph that absolutely most be wrapped. Which causes
rather ugly results. Add a --oneliner-bullets option that
puts asterisks at the start of each oneliner line to make them
a bullet-ed list.
2012-01-18 Andrew Ruthven
MythTV 0.25 now has the status info in a different location, look
there.
2011-05-19 Andrew Ruthven
It seems that MythTV has changed the ProtoVer field in
0.23 to be a different version number. Update some
stanzas to use current version numbers.
2011-05-15 Andrew Ruthven
My method of trying to ensure that we don't have long lived
processes hanging around didn't work. Now we fork a child
to perform the query.
2011-03-03 Andrew Ruthven
It turns out that $SIG{ALRM} doesn't always work with LWP::UserAgent
as you'd expect. I've certainly noticed mythtv-status hanging
during cron jobs on a regular basis, and this could well explain
it.
Release version 0.9.6.
2010-12-01 Andrew Ruthven
Make sure that Date::Manip is running in 5.x compatibility mode.
Release version 0.9.5.
2010-09-16 Andrew Ruthven
Add support for extra recording state.
Be ready to switch to TB earlier.
2010-06-13 Andrew Ruthven
Allow skipping idle encoders when showing the encoder status and
make that the default. Thanks to Ron Kellam for the suggestion.
It seems that Date::Manip::DateCalc in some versions require that
you parse in a ref for the error ref, passing in undef causes it
to not perform the date calculation. Parse in a ref, even if we
don't actually check it. Thanks to Ron Kellam for doing some
leg work on tracking this issue down.
Release version 0.9.4.
2010-04-29 Andrew Ruthven
Handle the case where the disk space units returned from the server
are different. i.e., total is in GB and used is in MB.
Fix my redirection of STDERR.
Release version 0.9.4.
2009-05-22 Andrew Ruthven
Only move /var/run/motd.new if it exists.
Release version 0.9.3.
2009-04-11 Andrew Ruthven
Show the encoder details for "Recording Now".
Pass on that charset that MythTV gave us in any emails we send and
set a sensible encoding.
2009-03-31 Andrew Ruthven
Add support for the newer encoder statuses.
2009-02-20 Andrew Ruthven
Allow using a YAML file for setting most of the command line flags.
2008-08-01 Andrew Ruthven
Automatically convert the disk space units to more human readable
forms if it is many GB.
2008-07-30 Andrew Ruthven
Suppress the errors from XML::LibXML.
2008-07-11 Andrew Ruthven
Relicense under the GPL v3.
Release version 0.9.0.
2008-07-06 Andrew Ruthven
Fix a couple of minor typos in the argument passing, and the help
screen. Thank you Mike Holden for reporting these.
2008-06-19 Andrew Ruthven
Just extend the copyright time ranges to include 2008.
Release version 0.8.1.
2008-06-18 Andrew Ruthven
Modify the auto expire logic to reduce the amount of needless work
that is done. Thank you Tom Metro for point this out.
Release version 0.8.0.
2008-05-28 Andrew Ruthven
It turns out that secondary backends don't return total disk space,
handle that in a nicer manner. Thank you Steve Gunther for letting
me know.
2008-05-23 Andrew Ruthven
Add a timeout for the HTTP request to the backend.
2008-04-19 Andrew Ruthven
Add a molly-guard check
2008-04-11 Andrew Ruthven
Provide helper scripts that'll return true if the MythTV backend
is:
* recording a show now,
* will be recording one within the next hour (or is currently
recording)
2008-03-11 Andrew Ruthven
Be less stressed about the XML protocol, let XPath matching do
the validation for us.
Release version 0.7.3.
2008-03-07 Andrew Ruthven
The MythTV protocol on release-0-21-fixes has been increased to 39.
Release version 0.7.2.
2008-01-24 Andrew Ruthven
Release version 0.7.1.
2008-01-22 Andrew Ruthven
Change the version boundaries for the disk space blocks to reflect
current SVN.
The backend returns the disk usage in MB, not GB.
Optionally show the input ID and channel number for recordings.
2008-01-20 Andrew Ruthven
Show the shows that will be deleted by the auto expirer, and their
order.
Release version 0.7.0
2007-12-26 Andrew Ruthven
Release version 0.6.2
2007-12-25 Andrew Ruthven
Conflicts should show the channel name as well.
2007-12-13 Andrew Ruthven
Warn if there isn't enough guide data present.
Show the channel name next to program details.
Release version 0.6.1
2007-12-12 Andrew Ruthven
Release version 0.6.0
2007-12-08 Andrew Ruthven
Allow using my new xmlVer attribute in the XML.
If using my XML patches against MythTV show the disk space details.
2007-12-07 Andrew Ruthven
Better suppress warnings from the MythTV Perl API if we can't access
the database.
2007-12-06 Andrew Ruthven
Be more paranoid about handling error conditions in the
substitution code.
Handle the case where there is no next recording scheduled
in a nicer fashion.
Release version 0.5.3.
2007-12-02 Andrew Ruthven
Allow sending emails only if there is low disk space or recording
conflicts. (0.6)
2007-11-28 Andrew Ruthven
Be more wary about processing what the backend has sent us.
This includes cleaning up some invalid UTF-8 characters.
Add support for reading XML from a file.
Be a bit more forgiving on the XML we're receiving.
Release version 0.5.2.
Show how much disk space is used - currently only total. (0.6)
Rename "Time till next recording" to "Next Recording In". (0.6)
Put all the one liners together in the output and make them line
up nicely. (0.6)
2007-11-23 Andrew Ruthven
Don't set the background when changing the colour.
Make the new debconf prompt lintian clean and say how to specify
multiple email addresses.
Release version 0.5.1.
2007-11-21 Andrew Ruthven
Now the results can be sent via email with the subject set correctly.
With an option to only send out email if schedule conflicts are
detected.
Release version 0.5.
2007-11-20 Andrew Ruthven
Allow suppressing blocks of output.
Add a semi-FAQ.
2007-11-18 Andrew Ruthven
Add support for showing the version of the script.
Now we show any schedule conflicts, or if the MythTV Perl API isn't
usable, a warning. (This is because we need to be able to read
the mysql.txt file and connect to the database to use the API, ick.)
Display the amount of time until the next recording.
2007-11-17 Andrew Ruthven
Add support for printing colour in the encoder status display.
2007-11-16 Francois Marier
Many fixes to the Debian packaging to make lintian happy.
Fixes to the Makefile for supporting Debian sponsoring.
Check if the initscript exists before running it
2007-11-16 Andrew Ruthven
Add additional encoder states and logic for displaying the
connected state of encoders.
Release version 0.3.
Changes to the Makefile required by new packaging.
Tweaks to the Debian packaging.
Optionally display programs description and/or subtitle.
Release version 0.4.
2007-11-15 Andrew Ruthven
Fix up publishing the tar ball.
Release version 0.2.
2007-11-05 Andrew Ruthven
Add an example when recording.
Work the Debian packaging
2007-10-31 Andrew Ruthven
Expand out MOTD in the documentation.
Add a section to the perldoc which describes what is in the output.
2007-10-27 Andrew Ruthven
Debian packaging:
- Convert the perldoc to a man page, and install it.
- Ignore the build files/directories.
Remove the bit about how to get the GPLv2 from the perldoc.
Add perldoc.
Release version 0.1.
2007-10-22 Andrew Ruthven
Add Debian directory
Add a README file.
Check for the Debian settings and use them.
Add license.
Update the MOTD.
Rename to what we'll use when installing it.
Pull out the XML generated timestamp and allow one line output.
mythtv-status-1.1.0/FAQ 0000664 0000000 0000000 00000001575 14456744277 0014753 0 ustar 00root root 0000000 0000000 Some sometimes asked questions...
Q) Why not just run mythtv-status from your .profile (or similar)?
A) Simple reason, speed. When I first wrote mythtv-status I was running it
out of my .profile, bit it slowed down logging in by about 2-3 seconds.
Which was just enough to be annoying.
That is why I decided to update the MOTD instead. This way how long the
script takes to run doesn't matter, you never have to run it
interactively.
I've had some reports that running mythtv-status from a .profile is okay
on faster machines (I have a PIII 800...).
Q) What provides the perl API?
A) It comes from the MythTV git repository:
https://github.com/MythTV/mythtv/tree/master/mythtv/bindings/perl
If you are using Christian Marillat's Debian packages then it is called
libmythtv-perl (apt-get install libmythtv-perl). Christian's packages are
available at:
http://www.deb-multimedia.org
mythtv-status-1.1.0/INSTALL 0000664 0000000 0000000 00000001566 14456744277 0015452 0 ustar 00root root 0000000 0000000 Installing MythTV Status
========================
Dependencies
------------
You will need to have the following Perl modules installed:
LWP::Simple
XML::LibXML
Date::Manip
MIME::Entity
Sys::SigAction
Config::Auto
YAML
MythTV - The MythTV Perl API
If you have installed this package using Debian then they should already be
present.
For Fedora, the required package names are (they are all available via yum):
perl-libwww-perl
perl-XML-LibXML
perl-DateManip
perl-MIME-tools
perl-Sys-SigAction
perl-Config-Auto.noarch
perl-YAML.noarch
perl-MythTV
MOTD
----
To update the message of the day you will probably want to modify
bin/mythtv-update-motd to work with the location of your /etc/motd
file (on Debian it might be symlinked into /run), and then run that
script on a regular basis from cron.
mythtv-status-1.1.0/Makefile 0000775 0000000 0000000 00000007010 14456744277 0016052 0 ustar 00root root 0000000 0000000 #!/usr/bin/make -f
BINDIR=$(DESTDIR)/usr/bin
LIBEXECDIR=$(DESTDIR)/usr/libexec/mythtv-status
MANDIR=$(DESTDIR)/usr/man
SYSTEMDDIR=$(DESTDIR)/lib/systemd/system
package=mythtv-status
releases=sid
release=sid
# These variables are used by Andrew in a git checkout for packaging and releasing.
ifneq ("$(wildcard .git)", "")
build=dpkg-buildpackage -rfakeroot -i'(.git|.gitignore|testing)*' -I.git -I.gitignore -Itesting -tc -kC603FC4E600F1CECD1C8D97C4B53D931E4D3E863 --changes-option=-S --changes-option=-sa
ifeq ($(version),)
version=$(shell git tag -l | grep '^[0-9]' | sort -t"." -k 1,1 -k 2,2 -k 3,3 -n | tail -1)
endif
deb_version=$(shell git tag -l | grep ^debian-$(release)-[[:digit:]] | sed 's/debian-$(release)-//' | sort -t"." -k 1,1 -k 2,2 -k 3,3 -n | tail -1 | sed 's/@/~/')
deb=$(package)_$(deb_version)_all.deb
orig_tarball=../$(package)_$(version).orig.tar.gz
tarball=../build/tarball/$(package)-$(version).tar.gz
tarball_dir=../$(package)_tarballs
DEBS=$(foreach release, $(releases), ../build/$(release)/$(deb))
RELEASE_FILES=$(orig_tarball) ../build/tarball/mythtv-status-${version}.tar.gz $(DEBS)
endif
TEST_VERBOSE=0
TEST_FILES=t/*.t
all: test
dist: test release
release: $(RELEASE_FILES)
$(orig_tarball): $(tarball)
@rm -f $@
@ln -s `basename \`pwd\``/$< $@
@ln -sf `basename \`pwd\``/$<.asc $@.asc
$(tarball):
@mkdir -p $(@D)
@git archive --format=tar --prefix=$(package)-$(version)/ $(version) `git ls-tree --name-only $(version) | egrep -v "(.gitignore|debian|testing)"` | gzip > $(tarball)
@gpg -sb --armour $(tarball)
../build/$(release)/$(deb): $(orig_tarball)
@echo Building $(release)
@ssh -t build-$(release)-amd64 "cd `pwd`; $(build)"
@ssh build-$(release)-amd64 "cd `pwd`/..; /usr/bin/lintian -i -I $(package)_$(version)*.changes" || true
#@ssh build-$(release)-amd64 "cd `pwd`/..; /usr/bin/linda -i $(package)_$(version)*.changes" || true
@mkdir -p ../build/$(release)
@cp ../$(deb) \
../$(package)_$(deb_version)_*.changes \
../$(package)_$(deb_version)_*.buildinfo \
../$(package)_$(deb_version).dsc \
../$(package)_$(version).orig.tar.?z \
../$(package)_$(deb_version).debian.tar.?z \
../build/$(release)
publish: $(RELEASE_FILES)
for release in $(releases); do reprepro includedsc $$release ../build/$$release/$(package)_$(deb_version).dsc; done
for release in $(releases); do reprepro includedeb $$release ../build/$$release/$(package)_$(deb_version)_all.deb; done
@cp $(tarball) $(tarball_dir)
@chmod o+r $(tarball_dir)/*-$(version).*
@ln -sf `basename $(tarball)` $(tarball_dir)/$(package)-latest.tar.gz
upload: $(RELEASE_FILES)
for release in $(releases); do cd ../build/$$release; dput $(package)_$(deb_version)*.changes; done
install:
install -d $(BINDIR)
install -d $(LIBEXECDIR)
install -d $(MANDIR)/man1
install -d $(MANDIR)/man8
install -d $(SYSTEMDDIR)
install -m 775 bin/mythtv-status $(BINDIR)
install -m 775 bin/mythtv_recording_now $(BINDIR)
install -m 775 bin/mythtv_recording_soon $(BINDIR)
install -m 775 bin/health-check $(LIBEXECDIR)
pod2man bin/mythtv-status > $(MANDIR)/man1/mythtv-status.1
install -m 644 man/mythtv-update-motd.8 $(MANDIR)/man8
install -m 644 man/mythtv_recording_now.1 $(MANDIR)/man1
install -m 644 man/mythtv_recording_soon.1 $(MANDIR)/man1
install -m 644 systemd/* $(SYSTEMDDIR)
test:
PERL_DL_NONLAZY=1 perl "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE))" $(TEST_FILES)
clean:
@rm -rf build
clean_pkg:
@rm -f ../$(package)*.changes ../$(package)*.dsc ../$(package)*.tar.gz ../$(package)*.deb
.PHONY: release clean install test dist
mythtv-status-1.1.0/README 0000664 0000000 0000000 00000004560 14456744277 0015276 0 ustar 00root root 0000000 0000000 mythtv-status
=============
This script will display the current status of your MythTV system at the
command line. It can optionally append it to the system message of the
day (MOTD) on a regular basis.
Sample output looks like:
-- Begin --
MythTV status for localhost
===========================
Status...........: Wed Dec 12 2007, 12:00 PM
Total Disk Space.: Total space is 102,350 GB, with 73,410 GB used (71.7%)
Next Recording In: 5 Hours, 59 Minutes
Encoders:
cerberus (9) - Idle
cerberus (12) - Idle
Scheduled Recordings:
2007-12-12 18:00:00 - 3 News
2007-12-12 20:00:00 - Scrubs
2007-12-13 18:00:00 - 3 News
2007-12-13 20:30:00 - McLeod's Daughters
2007-12-13 22:05:00 - 30 Rock
-- End --
And when recording (and with a storage group running low on space):
-- Begin --
MythTV status for localhost
===========================
Status...........: Wed Dec 12 2007, 6:30 PM
Total Disk Space.: Total space is 102,350 GB, with 73,410 GB used (71.7%)
Encoders:
cerberus (9) - Recording
cerberus (12) - Idle
Recording Now:
3 News (Ends: 2007-12-12 19:00:00)
Scheduled Recordings:
2007-12-12 20:00:00 - Scrubs
2007-12-13 18:00:00 - 3 News
2007-12-13 20:30:00 - McLeod's Daughters
2007-12-13 22:05:00 - 30 Rock
Disk Space:
Total space for group 2 is 20,746 GB, with 20,101 GB used (96.9%)
-- End --
Why this tool?
--------------
Well, as you can see below Grey's Anatomy was being recorded at 1:30 PM. My
wife (at the time) and I sat down to watch one of these episodes (yes they
were repeats, we'd only just discovered Grey's Anatomy so repeats are good)
and one of them was very jumpy. It was pretty obvious the server was under
load. My wife was a little annoyed when I admitted that I was probably
compiling a new kernel at the time.
-- Begin Original Output --
MythTV status for localhost
===========================
Status: Mon Oct 15 2007, 8:41 AM
Encoders:
cerberus (9) - Idle
cerberus (12) - Idle
Scheduled Recordings:
2007-10-15 13:30:00 - Grey's Anatomy
2007-10-15 18:00:00 - 3 News
2007-10-15 20:30:00 - Mythbusters
2007-10-15 22:00:00 - Flight Of The Conchords
2007-10-16 13:30:00 - Grey's Anatomy
2007-10-16 18:00:00 - 3 News
-- End Original Output --
I wrote this script to notify me when I login about any work that MythTV
might be wanting to do in the next little while (or currently) so we
wouldn't have any repeats of the Grey's Anatomy incident. This was
remarkably successful.
mythtv-status-1.1.0/THANKS 0000664 0000000 0000000 00000003467 14456744277 0015336 0 ustar 00root root 0000000 0000000 I'd like to thank the following people:
- Susanne Ruthven - My wife (at the time), without whom this programme
wouldn't have happened.
- Francois Marier - For getting the Debian packaging into shape and for
sponsoring it into Debian and heaps of feature requests!
- Criggie - For suggesting I add colour to the output, and making me
add a --version option.
- Sam Vilain - For getting the colour output to work nicely!
- Claude Boucker - For letting me know the Fedora 7 packages required.
- Brad MerManouelian & Glen Dragon
- For sending me samples of multi-storage area XML so I
could add the Diskspace block.
- Ryan Steffes - For suggesting the Auto Expire block.
- Marc Tousignant - For bug reports and suggesting outputting the encoder
details for recordings.
- Steve Gunther - For trying to use mythtv-status against a secondary
backend.
- Tom Metro - For a whole bunch of feedback.
- Jan Schneider - For feedback on the email charset and encoding.
- Steve Gunther - Doing some home work on the OSD declutter changes.
- Julian Gilbey - Fixing up some errors in reporting the next scheduled
recording.
- Göran Uddeborg - Reporting the DateCalc behaviour chaneg and various other
fixes.
- Illés Sol - UTF-8 character handling from MythTV::Program.
- Eric Wilde - Sending in a stack of his little improvements.
- The Debian translators
- Especially the Portuguese folks - you rock!
- All the MythTV developers for working on a great bit of software
And everyone else who has sent me such great feedback, thank you! And to
everyone else that I've failed to mention here...
mythtv-status-1.1.0/bin/ 0000775 0000000 0000000 00000000000 14456744277 0015161 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/bin/health-check 0000775 0000000 0000000 00000001215 14456744277 0017426 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright (c) 2007-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Run mythtv-status to perform a health check of the MythTV system.
. /etc/default/mythtv-status
if [ "$EMAIL" = "" ] || [ "$EMAIL" = "none" ]
then
exit
fi
/usr/bin/mythtv-status --host "$HOST" --email "$EMAIL" "$EMAIL_ARGS"
# Keep things happy by always having a return code of 0.
exit 0
mythtv-status-1.1.0/bin/mythtv-status 0000775 0000000 0000000 00000137153 14456744277 0017775 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
# Copyright (c) 2007-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Display the current status of a MythTV system.
# While I would love to enable the 6.xx interface for Date::Manip we may
# still need to run on platforms that only have version 5.x. So we'll
# turn on backwards compatible mode for now.
{
no warnings 'once';
$Date::Manip::Backend = 'DM5';
}
use warnings;
use LWP::UserAgent;
use XML::LibXML;
use Date::Manip;
use Date::Manip::Date;
use Getopt::Long;
use Text::Wrap;
use POSIX qw/strftime :sys_wait_h :signal_h/;
use MIME::Entity;
use Pod::Usage;
use Encode;
# Try and load a config file first, and then allow the command line
# to override what is in the config file.
my $c;
if (eval("{ local \$SIG{__DIE__}; require Config::Auto; }")) {
$c = eval {
Config::Auto::parse("mythtv-status.yml", format => 'yaml')
};
if ($@) {
# Die on any issues loading the config file, apart from it not existing.
if ($@ =~ /^No config file found/) {
$c->{'config_file_loaded'} = 0;
} else {
die $@;
}
} else {
$c->{'config_file_loaded'} = 1;
}
}
# Some sane defaults.
$c->{'host'} ||= "localhost";
$c->{'port'} ||= "6544";
$c->{'colour'} ||= 0;
$c->{'highlight'} ||= -1;
$c->{'episode'} ||= 0;
$c->{'description'} ||= 0;
$c->{'encoder_details'} ||= 0;
$c->{'encoder_skip_idle'} //= 1;
$c->{'encoder_warn_non_idle'} //= 1;
$c->{'email_only_on_alert'} ||= 0;
my $help = 0;
my $verbose = 0;
$c->{'disk_space_warn'} ||= 95; # Percent to warn at.
$c->{'guide_days_warn'} ||= 2; # How many days we require.
$c->{'auto_expire_count'} ||= 10; # How many auto expire shows to display.
$c->{'recording_in_warn'} ||= 60 * 60; # When is the next recording considered critical? (seconds)
$c->{'save_file'} ||= undef; # File to save the XML from the BE to.
$c->{'xml_file'} ||= undef; # Load the BE XML from this file.
# We allow a hack for MS Outlook which normally recognises the
# oneliners block as a paragraph and wraps it. If it sees "bullets"
# it believes it is a bulleted list and leaves it alone.
$c->{'oneliner_bullets'} ||= 0;
# What units we have available for converting diskspaces. The order is
# important, the largest unit should come first.
#
# Allowed keys:
# unit - SI unit to use
# threshold - Any value greater than threshold uses this unit
# make_integer - Strip off anything after the decimal point
# make_integer_threshold - Anything over this value will have the
# decimal point removed if make_integer is set to 1. This test is applied
# after the size has been converted, so the value should be in the 'new'
# unit.
#
my @size_thresholds = (
{
'unit' => 'TB',
'threshold' => 1024 * 1024,
'conversion' => 1024 * 1024,
'make_integer' => 1,
'make_integer_threshold' => 500,
},
{
'unit' => 'GB',
'threshold' => 50 * 1024, # 50GB seems like a good threshold.
'conversion' => 1024,
'make_integer' => 1,
'make_integer_threshold' => 500,
},
{
'unit' => 'MB',
},
);
my $return_code_only = 0;
my $VERSION = '1.1.0';
# Some display blocks are disabled by default:
$c->{'display'}{'Shows due to Auto Expire'} = 0;
GetOptions(
'c|colour|color!' => \$c->{'colour'},
'd|description!' => \$c->{'description'},
'e|episode!' => \$c->{'episode'},
'encoder-details!' => \$c->{'encoder_details'},
'h|host=s' => \$c->{'host'},
'highlight!' => \$c->{'highlight'},
'p|port=i' => \$c->{'port'},
'v|version' => \&print_version,
'email=s@' => \@{ $c->{'email'} },
'email-only-on-conflict|email-only-on-alert|email-only-on-alerts'
=> \$c->{'email_only_on_alert'},
'disk-space-warn=i' => \$c->{'disk_space_warn'},
'guide-days-warn=i' => \$c->{'guide_days_warn'},
'auto-expire-count=i' => \$c->{'auto_expire_count'},
'recording-in-warn=i' => \$c->{'recording_in_warn'},
'encoder-skip-idle!' => \$c->{'encoder_skip_idle'},
'encoder-warn-non-idle!' => \$c->{'encoder_warn_non_idle'},
'oneliner-bullets!' => \$c->{'oneliner_bullets'},
'status!' => \$c->{'display'}{'Status as of'},
'encoders!' => \$c->{'display'}{'Encoders'},
'recording-now!' => \$c->{'display'}{'Recording Now'},
'scheduled-recordings!' => \$c->{'display'}{'Scheduled Recordings'},
'schedule-conflicts!' => \$c->{'display'}{'Schedule Conflicts'},
'next-recording!' => \$c->{'display'}{'Next Recording In'},
'total-disk-space!' => \$c->{'display'}{'Total Disk Space'},
'disk-space!' => \$c->{'display'}{'Disk Space'},
'guide-data!' => \$c->{'display'}{'Guide Data'},
'auto-expire!' => \$c->{'display'}{'Shows due to Auto Expire'},
'return-code-only' => \$return_code_only,
'file=s' => \$c->{'xml_file'},
's|save-file=s' => \$c->{'save_file'},
'date=s' => \$c->{'date'},
'verbose' => \$verbose,
'help|?' => \$help,
) || pod2usage("\nUse --help for help.\n");
pod2usage(verbose => 1)
if $help;
$0 = "mythtv-status - parent";
# Get the email address into a format we can use.
@{ $c->{'email'} } = split(',', join(',', @{ $c->{'email'} }));
# Default settings for emails but let the user override us.
if (scalar(@{ $c->{'email'} }) > 0) {
# Disable these blocks
for my $block ('Encoders', 'Recording Now', 'Next Recording In') {
if (! defined $c->{'display'}{$block}) {
$c->{'display'}{$block} = 0;
}
}
# Enable highlight
if ($c->{'highlight'} == -1) {
$c->{'highlight'} = 1;
}
}
# Possibly use some colour or highlighting, but not no colour in emails.
my $safe = '';
my $warn = '';
my $warn_to_normal = '';
my $safe_to_normal = '';
if ($c->{'colour'} && scalar(@{ $c->{'email'} }) == 0) {
$safe = "\033[0;32m";
$warn = "\033[1;31m";
$safe_to_normal = "\033[0m";
$warn_to_normal = "\033[0m";
}
if ($c->{'highlight'} > 0) {
$warn .= '*';
$warn_to_normal = "*$warn_to_normal";
}
# Is a warning present?
my $warn_present = 0;
# Allow setting some defaults for the output blocks.
my %defaults = (
'schedule' => {
'attrs' => [ qw/title startTime NODE_TEXT subTitle channelName:.\/Channel[@channelName] chanNum:.\/Channel[@chanId] inputId:.\/Channel[@inputId]/ ],
'template' => "__startTime__"
. " - __title__"
. ($c->{'episode'} ? " - __subTitle__" : '')
. " (__channelName__)"
. ($c->{'encoder_details'} ? " - Enc: __inputId__, Chan: __chanNum__" : '')
. ($c->{'description'} ? "\n__NODE_TEXT__" : ''),
'filter' => {
# Only show recordings for today and tomorrow.
'startTime' => sub {
my $date = substr(ParseDate($_[0]), 0, 8);
return ! (($date cmp $today) == 0
|| ($date cmp $tomorrow) == 0) }
},
'rewrite' => {
'&startTime' => sub { return process_iso_date($_[0]); }
}
}
);
# The time of the next scheduled recording.
my $next_time = 'Never';
# Are there any alerts that should be notified via email?
my @alerts = ();
# The blocks of output which we might generate.
#
# Generally, these blocks of output are generated in the order that they
# appear below. However, if a block has the tag "format", who's value is
# "one line" it will appear at the start of the output, on a single line,
# all one liners grouped together.
my @blocks = (
# All the one liners together
{
'name' => 'One Liners',
'type' => 'sub',
'template' => '',
'sub' => sub { return 'Place holder' },
},
# Date/Time from server
{
'name' => 'Status as of',
'type' => 'xpath',
'xpath' => "//Status",
'attrs' => [ qw/ISODate time date/ ],
'optional_attrs' => [ qw/ISODate/ ],
'template' => "__date__",
'format' => 'one line',
'rewrite' => {
'&date' => sub {
my ($value, $vars) = @_;
if (defined $vars->{ISODate} && $vars->{ISODate} =~ /Z$/) {
return process_iso_date($vars->{ISODate});
} else {
return $vars->{date} . ", " . $vars->{time};
}
},
},
},
# Info about the encoders before TV OSD Declutter (Changeset 20037).
{
'name' => 'Encoders',
'type' => 'xpath',
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ "<= 43" ],
'attrs' => [ qw/hostname id state connected/ ],
'template' => "__hostname__ (__id__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
'^0$' => "Idle",
'^1$' => "Watching LiveTV",
'^2$' => "Watching Pre-recorded",
'^3$' => "Watching Recording",
'^4$' => "Recording",
},
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
},
'subs' => {
'state_colour' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe;
} else {
return $warn;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn;
} else {
return '';
}
}
},
'state_normal' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} else {
return $warn_to_normal;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn_to_normal;
} else {
return '';
}
}
},
},
},
# Info about the encoders after TV OSD Declutter (Changeset 20037).
{
'name' => 'Encoders',
'type' => 'xpath',
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ ">= 44", "< 58" ],
'attrs' => [ qw/hostname id state connected/ ],
'template' => "__hostname__ (__id__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
'^-1$' => "${warn}Error${warn_to_normal}",
'^0$' => "${safe}Idle${safe_to_normal}",
'^1$' => "${warn}Watching LiveTV${warn_to_normal}",
'^2$' => "${warn}Watching Pre-recorded${warn_to_normal}",
'^3$' => "${warn}Watching DVD${warn_to_normal}",
'^4$' => "${warn}Watching Video${warn_to_normal}",
'^5$' => "${warn}Watching Recording${warn_to_normal}",
'^6$' => "${warn}Recording${warn_to_normal}",
},
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
},
'subs' => {
'state_colour' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe;
} else {
return $warn;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn;
} else {
return '';
}
}
},
'state_normal' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} else {
return $warn_to_normal;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn_to_normal;
} else {
return '';
}
}
},
},
},
# Info about the encoders after adding Blu-ray (Changeset 25058).
# The protocol version is from svn commit 25362 but is the closest commit
# for mythtv/libs/libmythdb/mythversion.h.
{
'name' => 'Encoders',
'type' => 'xpath',
'xpath' => "//Status/Encoders/Encoder",
'protocol_version' => [ ">= 58" ],
'attrs' => [ qw/hostname id state devlabel connected/ ],
'template' => "__hostname__ (__id____devtype__) - __state_colour____state____state_normal____connected__",
'rewrite' => {
'/connected/' => { '1' => '', '0' => "${warn}(Disconnected)${warn_to_normal}" },
'/state/' => {
'^-1$' => "${warn}Error${warn_to_normal}",
'^0$' => "${safe}Idle${safe_to_normal}",
'^1$' => "${warn}Watching LiveTV${warn_to_normal}",
'^2$' => "${warn}Watching Pre-recorded${warn_to_normal}",
'^3$' => "${warn}Watching DVD${warn_to_normal}",
'^4$' => "${warn}Watching Blu-ray${warn_to_normal}",
'^5$' => "${warn}Watching Video${warn_to_normal}",
'^6$' => "${warn}Watching Recording${warn_to_normal}",
'^7$' => "${warn}Recording${warn_to_normal}",
},
},
'filter' => {
'state' => sub { return $c->{'encoder_skip_idle'} && $_[0] == 0 },
},
'subs' => {
'devtype' => sub {
if ($_[0]->{'devlabel'} =~ /\[ (.+) :/) { ", $1" }
else { '' }
},
'state_colour' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe;
} else {
return $warn;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn;
} else {
return '';
}
}
},
'state_normal' => sub {
if ($c->{'encoder_warn_non_idle'}) {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} else {
return $warn_to_normal;
}
} else {
if ($_[0]->{'state'} eq '0') {
return $safe_to_normal;
} elsif ($_[0]->{'state'} eq '-1') {
return $warn_to_normal;
} else {
return '';
}
}
},
},
},
# What programs (if any) are being recorded right now?
{
'name' => 'Recording Now',
'type' => 'xpath',
'xpath' => "//Status/Encoders/Encoder/Program",
'hide' => 'after',
'attrs' => [ qw/title endTime channelName:.\/Channel[@channelName]
encoderId:.\/Recording[@encoderId]
chanNum:.\/Channel[@chanNum]/ ],
'template' => "__title__ (__channelName__)"
. ($c->{'encoder_details'} ? ", Enc: __encoderId__, Chan: __chanNum__" : '')
. ", Ends: __endTime__",
'rewrite' => {
'&endTime' => sub {
my ($value, $vars) = @_;
if ($value =~ /Z$/) {
$value = process_iso_date($value, { date => 0 });
} else {
$value =~ s/.*T//;
}
return $value;
},
},
'subs' => {
'find_next' => sub {
$warn_present ||= 1;
$next_time = $c->{'date'} || 'now';
},
},
},
# The upcoming recordings.
{
'name' => 'Scheduled Recordings',
'type' => 'xpath',
'xpath' => '//Status/Scheduled/Program',
'defaults' => 'schedule',
'hide' => 'after',
'subs' => {
'find_next' => sub {
my $vars = shift;
return
if defined $next_time && $next_time eq 'now';
my $date = ParseDate($vars->{'startTime'});
if ($next_time eq 'Never' || Date_Cmp($date, $next_time) < 0) {
$next_time = $date
};
},
},
},
# Conflicts
{
'name' => 'Schedule Conflicts',
'type' => 'sub',
'defaults' => 'schedule',
'sub' => \&process_conflicts
},
# Auto Expire
{
'name' => 'Shows due to Auto Expire',
'type' => 'sub',
'defaults' => 'schedule',
'sub' => \&process_auto_expire,
'filter' => {}, # Over ride the default filter from 'schedule'.
},
# Diskspace, before storage groups
{
'name' => 'Total Disk Space',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Storage',
'protocol_version' => [ "<= 31" ],
'attrs' => [ qw/_total_total _total_used/ ],
'commify' => [ qw/si__total_total si__total_used/ ],
'human_readable_sizes' => [ qw/_total_total _total_used/ ],
'template' => "Total space is __si__total_total__ __si__total_total_unit__, with __si__total_used__ __si__total_used_unit__ used (__percent__)",
'format' => 'one line',
'optional' => 1,
'subs' => {
'percent' => sub {
calc_disk_space_percentage($_[0]->{'_total_used'}, $_[0]->{'_total_total'})
},
},
},
# Diskspace, with storage groups
{
'name' => 'Total Disk Space',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Storage',
'protocol_version' => [ ">= 32" ],
'xml_version' => [ "== 0" ],
'attrs' => [ qw/drive_total_total drive_total_used/ ],
'commify' => [ qw/si_drive_total_total si_drive_total_used/ ],
'human_readable_sizes' => [ qw/drive_total_total drive_total_used/ ],
'template' => "Total space is __si_drive_total_total__ __si_drive_total_total_unit__, with __si_drive_total_used__ __si_drive_total_used_unit__ used (__percent__)",
'format' => 'one line',
'optional' => 1,
'subs' => {
'percent' => sub {
calc_disk_space_percentage($_[0]->{'drive_total_used'}, $_[0]->{'drive_total_total'})
},
},
},
# Diskspace, with storage groups and sensible XML layout.
{
'name' => 'Total Disk Space',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Storage/Group[@id="total"]',
'protocol_version' => [ ">= 39" ],
'attrs' => [ qw/total used/ ],
'commify' => [ qw/si_total used/ ],
'human_readable_sizes' => [ qw/total used/ ],
'template' => "Total space is __si_total__ __si_total_unit__, with __si_used__ __si_used_unit__ used (__percent__)",
'format' => 'one line',
'optional' => 1,
'subs' => {
'percent' => sub {
calc_disk_space_percentage($_[0]->{'used'}, $_[0]->{'total'})
},
},
},
# Diskspace, with storage groups and sensible XML layout.
{
'name' => 'Disk Space',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Storage/Group',
'protocol_version' => [ ">= 39" ],
'attrs' => [ qw/id total used/ ],
'commify' => [ qw/si_total used/ ],
'human_readable_sizes' => [ qw/total used/ ],
'template' => "Total space for group __id__ is __si_total__ __si_total_unit__, with __si_used__ __si_used_unit__ used (__percent__)",
'filter' => {
'id' => sub { return $_[0] eq 'total' },
'used' => sub {
return ! (
(defined $c->{'display'}{'Disk Space'} && $c->{'display'}{'Disk Space'})
|| ($_[1]->{'used'} / $_[1]->{'total'}) * 100 > $c->{'disk_space_warn'})
},
},
'subs' => {
'percent' => sub {
calc_disk_space_percentage($_[0]->{'used'}, $_[0]->{'total'})
},
},
},
# How many hours till the next recording.
{
'name' => 'Next Recording In',
'type' => 'sub',
'format' => 'one line',
'template' => '__next_time__',
'rewrite' => {
'&next_time' => sub {
return $next_time
if $next_time eq 'Never' || $next_time eq 'now';
my $err;
my $delta = DateCalc($c->{'date'} || 'now', $next_time, \$err, 1);
my $seconds = Delta_Format($delta, 'approx', 0, '%sh');
my $remsec = $seconds; # Remaining seconds
my $str = '';
# Days
if ($remsec > 24 * 3600) {
$str = sprintf("%d Days, ", $remsec / 24 / 3600);
$remsec = $remsec % (24 * 3600);
}
# Hours
if ($remsec > 3600) {
$str .= sprintf("%d Hours, ", $remsec / 3600);
$remsec = $remsec % 3600;
}
# Minutes
if ($remsec > 60) {
$str .= sprintf("%d Minutes", $remsec / 60);
}
# Clean up the string.
$str =~ s/, $//;
$str =~ s/\b1 (Day|Hour|Minute)s/1 $1/g;
if ($seconds <= $c->{'recording_in_warn'}) {
$warn_present ||= 1;
$str = "$warn$str$warn_to_normal";
}
return $str;
},
},
'filter' => {
'next_time' => sub { return $_[0] eq 'now' }
},
'sub' => sub {
return substitute_vars($_[0], { 'next_time' => $next_time });
},
},
# Check how much Guide data we have
{
'name' => 'Guide Data',
'format' => 'one line',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Guide[@guideDays]',
'attrs' => [qw/guideDays status guideThru/],
'template' => 'There is __guideDays__ days worth of data, through to __guideThru__',
'filter' => {
'guideDays' => sub {
if ($_[0] > $c->{'guide_days_warn'}) {
return
(defined $c->{'display'}{'Guide Data'} && ! $c->{'display'}{'Guide Data'}) || 1;
} else {
$warn_present ||= 1;
push @alerts, "GUIDE DATA";
return 0;
}
},
},
'rewrite' => {
'&guideDays' => sub {
if ($_[0] <= $c->{'guide_days_warn'}) {
$warn_present ||= 1;
return "$warn$_[0]$warn_to_normal";
} else {
return "$safe$_[0]$safe_to_normal";
}
},
'/guideThru/' => { 'T\d+:\d+:\d+' => ' ' },
'&guideThru' => sub {
if ($_[1]->{'guideDays'} <= $c->{'guide_days_warn'}) {
$warn_present ||= 1;
return "$warn$_[0]$warn_to_normal";
} else {
return "$safe$_[0]$safe_to_normal";
}
},
},
},
{
'name' => 'Guide Data',
'format' => 'one line',
'type' => 'xpath',
'xpath' => '//Status/MachineInfo/Guide[@status=""]',
'template' => "${warn}No guide data!${warn_to_normal}",
},
);
###
### Set some useful variables
###
our $today = substr(ParseDate('today'), 0, 8);
our $tomorrow = substr(ParseDate('tomorrow'), 0, 8);
if ($c->{'date'}) {
$today = substr(ParseDate($c->{'date'}), 0, 8);
$tomorrow = substr(DateCalc($c->{'date'}, ParseDateDelta('1 day')), 0, 8);
}
if ($verbose) {
print "Today: $today\n";
print "Tomorrow: $tomorrow\n";
print "Config::Auto module: " . (defined $INC{'Config/Auto.pm'} ? 'Loaded' : 'Not Loaded') . "\n";
print "Config file loaded: " . ($c->{'config_file_loaded'} ? 'Yes' : 'No') . "\n";
}
# If we're in return code only mode then we disable all blocks
# except for those explicitly enabled.
if ($return_code_only) {
warn "In return-code-only mode, disabling all blocks by default.\n"
if $verbose;
for my $block (@blocks) {
$c->{'display'}{ $block->{'name'} } ||= 0;
}
}
# A couple of global variables
my ($xml, $charset, $myth);
my %version;
my $exit_value = 0;
my $title = "MythTV status for $c->{'host'}";
my $output = "$title\n";
$output .= '=' x length($title) . "\n";
for my $block (@blocks) {
$block->{'format'} ||= 'multi line';
$block->{'optional'} ||= 0;
warn "Considering: $block->{'name'}\n"
if $verbose;
my $hide = undef;
if (defined $c->{'display'}{ $block->{'name'} }
&& $c->{'display'}{ $block->{'name'} } == 0) {
if (defined $block->{'hide'} && lc($block->{'hide'}) eq 'after') {
$hide = 1;
} else {
next;
}
}
warn " Going to process: $block->{'name'}\n"
if $verbose;
# We might need to set some defaults.
if (defined $block->{'defaults'}) {
for my $field (keys %{ $defaults{ $block->{'defaults'} } }) {
$block->{$field} ||= $defaults{ $block->{'defaults'} }{$field};
}
}
my $result = undef;
$warn_present = 0;
if ($block->{'type'} eq 'xpath') {
($xml, $charset) = load_xml()
unless defined $xml;
$result = process_xml($block, $xml);
} elsif ($block->{'type'} eq 'sub') {
$result = &{ $block->{'sub'} }($block)
if defined $block->{'sub'};
}
if (defined $result && $result ne '' && ! defined $hide) {
$exit_value ||= $warn_present;
if ($block->{'format'} eq 'one line') {
push @oneliners, [ $block->{'name'}, $result ];
} else {
$output .= "$block->{'name'}:\n";
$output .= $result . "\n\n";
}
}
}
# Deal with the one liners.
if (scalar(@oneliners) > 0) {
# Find the longest header
my $length = 0;
for $line (@oneliners) {
if (length($line->[0]) > $length) {
$length = length($line->[0]);
}
}
# Put the one liners together, with leading dots to the colon.
# We allow a hack for MS Outlook which normally recognises the
# oneliners block as a paragrap and wraps it. If it sees "bullets"
# it believes it is a bulleted list and leaves it alone.
my $oneliners = "";
for $line (@oneliners) {
$oneliners .= ($c->{'oneliner_bullets'} ? '* ' : '' )
. "$line->[0]"
. ('.' x ($length - length($line->[0]))) . ": $line->[1]\n";
}
# What a hacky way of putting the one liners where I want them...
$output =~ s/^One Liners:\nPlace holder\n/$oneliners/m;
}
# Either print the status out, or email it.
if ($return_code_only) {
exit $exit_value;
} elsif (scalar(@{ $c->{'email'} }) == 0) {
if ($charset =~ /utf(-)?8/i) {
$output = encode('UTF-8', $output);
}
print "\n$output";
} else {
if ((! $c->{'email_only_on_alert'}) ||
($c->{'email_only_on_alert'} && scalar(@alerts) > 0)) {
my $suffix = undef;
if (@alerts == 1) {
$suffix = $alerts[0];
} elsif (@alerts > 1) {
$suffix = "MULTIPLE WARNINGS";
}
my $mail = MIME::Entity->build(
To => $c->{'email'},
Subject => encode('UTF-8', $title . (defined $suffix ? " - $suffix" : '')),
Charset => $charset,
Encoding=> "quoted-printable",
Data => encode('UTF-8', $output),
);
$mail->send('sendmail');
}
}
exit $exit_value;
# Fetch the XML status from the backend.
sub load_xml {
my $status = '';
my $charset = '';
if (defined $c->{'xml_file'}) {
open (IN, "< $c->{'xml_file'}")
|| die "Failed to open $c->{'xml_file'} for reading: $!\n";
$status = join("", );
$charset = 'UTF-8';
close IN;
} else {
my $content_type;
# In MythTV 0.25 the path changed from /xml to /Status/GetStatus
for my $path ('Status/GetStatus', 'xml') {
my $url = "http://$c->{'host'}:$c->{'port'}/$path";
($content_type, $status) = xml_fetch($url);
last
if defined $status;
}
die "Nothing was received from the MythTV Backend.\n"
unless defined $status;
($charset) = ($content_type =~ /charset="(\S+?)"/);
}
if (defined $c->{'save_file'}) {
open(OUT, "> $c->{'save_file'}")
|| die "Failed to open " . $c->{'save_file'} . " for writing: $!\n";
print OUT $status;
close OUT;
}
# Parse the XML
my $parser = XML::LibXML->new();
# Some XML data seems to have badness in it, including non-existant
# UTF-8 characters. We'll try and recover.
$parser->recover(1);
$parser->recover_silently(1)
unless $verbose;
clean_xml(\$status);
# Try and hide any error messages that XML::LibXML insists on printing out.
open my $olderr, ">&STDERR";
open(STDERR, "> /dev/null") || die "Can't redirect stderr to /dev/null: $!";
my $xml = eval { $parser->parse_string( $status ) };
close (STDERR);
open (STDERR, ">&", $olderr);
if ($@) {
die "Failed to parse XML: $@\n";
}
# Pick out the XML version.
my $items = $xml->documentElement->find('//Status');
$version{'xml'} = @{ $items }[0]->getAttribute('xmlVer') || 0;
$version{'protocol'} = @{ $items }[0]->getAttribute('protoVer');
warn "Loaded XML from " . ($c->{'xml_file'} || $c->{'host'}) . "\n"
if $verbose;
return ($xml, $charset);
}
# Prep the Perl MythTV API if available.
sub load_perl_api {
my $myth = undef;
eval { require MythTV };
if ($@) {
print $@
if $verbose;
} else {
# Surpress warnings from DBI. I tried unsetting $^W but that is ignored.
local($SIG{__WARN__}) = sub { if ($verbose) { print shift } };
eval { $myth = new MythTV() };
if ($@) {
if ($verbose) {
warn "Failed to load Perl API\n";
print $@;
return undef;
}
} elsif ($verbose) {
warn "Loaded Perl API\n";
}
}
return $myth;
}
# We are sometimes passed dodgy XML from MythTV, make some attempts to clean
# it.
sub clean_xml {
my ($xml) = shift;
# Deal to invalid Unicode.
for my $bad ("", "") {
if ($$xml =~ s/$bad/?/g) {
warn "Found and replaced: $bad\n"
if $verbose;
}
}
}
sub process_xml {
my ($block, $xml) = @_;
# Only work on this block if we have received the appropriate version of
# the XML.
for my $vers (qw/protocol xml/) {
if (defined $block->{"${vers}_version"}) {
my $result = undef;
# All the version checks must pass.
for my $check (@{ $block->{"${vers}_version"} }) {
my $res = eval ( "$version{$vers} $check" );
if (! defined $result || $res != 1) {
$result = $res;
}
}
return
unless defined $result && $result ne '';
warn "We have the correct $vers version for $block->{'name'}\n"
if $verbose;
}
}
my $items = $xml->documentElement->find($block->{'xpath'});
# Don't do any work on this block if there is nothing for it.
return undef
if (scalar(@$items) == 0);
my @lines;
for my $item (@{ $items }) {
my %vars;
for my $key (@{ $block->{'attrs'} }) {
if ($key =~ /(.*?):(.*)/) {
my $subitem = $item->findnodes($2);
$vars{$1} = @{ $subitem }[0]->getAttribute($1)
if defined @{ $subitem }[0];
} else {
$vars{$key} = $key eq 'NODE_TEXT' ? $item->string_value : $item->getAttribute($key);
}
}
my $str = substitute_vars($block, \%vars);
push @lines, $str
if defined $str;
}
return join("\n", @lines);
}
sub process_conflicts {
my ($block) = @_;
$myth ||= load_perl_api();
return "Unable to access MythTV Perl API. Try with --verbose to find out why."
unless defined $myth;
my @lines;
# This isn't defined in the 0.20 version of the API. It is in 0.21svn.
my $recstatus_conflict = 7;
my %rows = $myth->backend_rows('QUERY_GETALLPENDING', 2);
foreach my $row (@{$rows{'rows'}}) {
my $show;
{
# MythTV::Program currently has a slightly broken line with a numeric
# comparision.
local($^W) = 0;
$show = new MythTV::Program(@$row);
}
if ($show->{'recstatus'} == $recstatus_conflict) {
my %vars = (
'title' => $show->{'title'},
'startTime' => strftime("%FT%T", localtime($show->{'starttime'})),
'NODE_TEXT' => $show->{'description'},
'subTitle' => $show->{'subtitle'},
'channelName' => $show->{'channame'},
'inputId' => $show->{'inputid'},
'chanNum' => $show->{'channum'},
);
my $str = substitute_vars($block, \%vars);
push @lines, decode('UTF-8', $str)
if defined $str;
}
}
if (scalar(@lines) == 1) {
push @alerts, "CONFLICT";
} elsif (scalar(@lines) > 1) {
push @alerts, "CONFLICTS";
}
return join("\n", @lines);
}
sub process_auto_expire {
my ($block) = @_;
$myth ||= load_perl_api();
return "Unable to access MythTV Perl API. Try with --verbose to find out why."
unless defined $myth;
my @lines;
# This isn't defined in the 0.20 version of the API. It is in 0.21svn.
my %rows = $myth->backend_rows('QUERY_RECORDINGS Delete', 2);
# Returned in date order, desc. So reverse it to make the oldest
# ones come first.
foreach my $row (reverse @{$rows{'rows'}}) {
my $show;
{
# MythTV::Program currently has a slightly broken line with a numeric
# comparision.
local($^W) = 0;
$show = new MythTV::Program(@$row);
}
# Who cares about LiveTV recordings?
next if $show->{'progflags'} eq 'LiveTV';
my %vars = (
'title' => $show->{'parentid'} || 'Unknown',
'startTime' => strftime("%FT%T", localtime($show->{'starttime'})),
'NODE_TEXT' => $show->{'description'},
'subTitle' => $show->{'subtitle'},
'channelName' => $show->{'callsign'},
'inputId' => $show->{'inputid'},
'chanNum' => $show->{'chanid'},
);
my $str = substitute_vars($block, \%vars);
push @lines, decode('UTF-8', $str)
if defined $str;
# Don't do more work than is required.
last if --$c->{'auto_expire_count'} <= 0;
}
return join("\n", @lines);
}
# If either date or time are set to 0, then we don't display that bit of
# info. For example:
# process_iso_date($date, { date => 0 })
# Will only show the time.
sub process_iso_date {
my $date = shift;
my $options = shift;
$options->{'date'} //= 1;
$options->{'time'} //= 1;
# 2012-10-17T23:50:08Z
my $d = new Date::Manip::Date;
$d->parse($date);
# Work out our local timezone. The Date::Manip::Date
# docs say that convert will default to the local timezone,
# this appears to be lies.
my $dmb = $d->base();
my ($tz) = $dmb->_now('tz',1);
$d->convert($tz);
# Sample of what MythTV uses:
# Thu 18 Oct 2012, 10:20
my $format = '';
$format .= '%Y-%m-%d' if $options->{'date'};
$format .= ' ' if $options->{'date'} && $options->{'time'};
$format .= '%X' if $options->{'time'};
return $d->printf($format);
}
sub substitute_vars {
my $block = shift;
my $vars = shift;
my %commify = map { $_ => 1 } @{ $block->{'commify'} }
if defined $block->{'commify'};
my $template = $block->{'template'};
my $skip = undef;
my ($key, $value);
# Convert disk spaces into more suitable units.
if (defined $block->{'human_readable_sizes'}) {
for my $key (@{ $block->{'human_readable_sizes'}}) {
for my $unit (@size_thresholds) {
if (defined $vars->{$key} && defined $unit->{'threshold'}) {
if ($vars->{$key} > $unit->{'threshold'}) {
$vars->{"si_$key"} = sprintf("%.1f", $vars->{$key} / $unit->{'conversion'});
$vars->{"si_$key"} =~ s/\.0//;
$vars->{"si_${key}_unit"} = $unit->{'unit'};
if ($unit->{'make_integer'} &&
(! defined $unit->{'make_integer_threshold'}
|| $vars->{"si_$key"} > $unit->{'make_integer_threshold'})) {
$vars->{"si_$key"} =~ s/\.[0-9]+//;
}
last;
}
} else {
$vars->{"si_${key}"} = $vars->{$key};
$vars->{"si_${key}_unit"} = $unit->{'unit'};
}
}
}
}
while (($key, $value) = (each %{ $vars })) {
if (! defined $value) {
if ($block->{'optional'}) {
warn "Unable to find any value for $key while at $block->{'name'}, marked as optional, skipping block.\n"
if $verbose;
return undef;
} else {
warn "Unable to find any value for $key while looking at $block->{'name'}\n"
if $verbose || ! grep /^$key$/, @{$block->{'optional_attrs'}};
next;
}
}
$value = wrap(' ', ' ', $value)
if $key eq 'NODE_TEXT';
$value =~ s/\s+$//;
$value = 'Unknown'
if $value eq '';
$skip = 1
if defined $block->{'filter'}{$key} &&
&{ $block->{'filter'}{$key} }($value, $vars);
if (defined $block->{'rewrite'}{"/$key/"}) {
my ($search, $replace);
while (($search, $replace) = each %{ $block->{'rewrite'}{"/$key/"} } ) {
$value =~ s/$search/$replace/g;
}
}
if (defined $block->{'rewrite'}{"&$key"}) {
$value = &{ $block->{'rewrite'}{"&$key"} }($value, $vars);
}
$value = commify($value)
if defined $commify{$key};
$template =~ s/__${key}__/$value/g;
}
my ($name, $sub);
while (($name, $sub) = each %{ $block->{'subs'} }) {
$value = &$sub($vars);
$template =~ s/__${name}__/$value/g
if defined $value;
}
return defined $skip ? undef : $template;
}
# Work out the disk space percentage, possibly setting a flag that we should
# raise an alert.
sub calc_disk_space_percentage {
my ($used, $total) = @_;
if (! (defined $used && defined $total) ){
warn "Something is wrong calculating the disk space percentage.\n";
return 'unknown';
}
# Guard against zero disk space.
$total = normalise_disk_space($total);
if ($total == 0) {
warn "Total disk space is 0 MB, I can't use that to calculate a percentage!\n";
return 'unknown';
}
my $percent = int((normalise_disk_space($used) / $total * 100) + 0.5);
if ($percent >= $c->{'disk_space_warn'}) {
$exit_value ||= 1;
push @alerts, "DISK SPACE";
return "$warn$percent\%$warn_to_normal";
} else {
return "$safe$percent\%$safe_to_normal";
}
}
# Make sure that the disk space is in a common unit.
# Currently that is MB.
sub normalise_disk_space {
if ($_[0] =~ /^[.0-9]+$/) {
return $_[0];
} elsif ($_[0] =~ /^([.0-9]+) (\w+)$/) {
my $space = $1;
my $unit = $2;
if ($unit eq 'B') {
return $space / (1024 * 1024);
} elsif ($unit eq 'KB') {
return $space / 1024;
} elsif ($unit eq 'MB') {
return $space;
} elsif ($unit eq 'GB') {
return $space * 1024;
} elsif ($unit eq 'TB') {
return $space * 1024 * 1024;
}
warn "Unknown unit for disk space: $unit. Please let the author of mythtv-status know.\n";
return $space;
}
warn "Unrecognised format for disk space: $_[0]. Please let the author of mythtv-status know.\n";
return $_[0];
}
# Perform the fetch from the MythTV Backend in a child process.
sub xml_fetch {
my ($url) = @_;
$| = 1;
my $pid = pipe_from_fork('CHILD');
if ($pid) {
# parent
my $content_type;
my $status;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm(10);
$content_type = ;
while () {
$status .= $_;
}
alarm(0);
};
# The child didn't get back to us in time, kill them off
# and forget what they sent us.
if ($@) {
$status = undef;
my $result;
warn "Our child has stopped talking to us, kill it off.\n";
do {
kill 9, $pid;
$result = waitpid($pid, WNOHANG);
} while $result > 0;
die "Unknown error during retrieval of status from the MythTV backend.\n";
}
$| = 0;
if (defined $content_type && $content_type =~ /utf(-)?8/i) {
$status = decode('UTF-8', $status);
}
return ($content_type, $status);
} else {
# child
$0 = "mythtv-status - child";
my $ua = LWP::UserAgent->new;
$ua->timeout(30);
$ua->env_proxy;
my $response = ua_request_with_timeout($ua, $url);
die "Sorry, failed to fetch $url: Connection to MythTV timed out.\n"
unless defined $response;
# If we get a page doesn't exist, then just ignore it, we need to try
# fetching the status page from a few different locations.
if ($response->code == 404) {
exit 1;
}
die "Sorry, failed to fetch $url: " . $response->status_line . "\n"
unless $response->is_success;
my $content = $response->decoded_content;
if ($response->header('Content-Type') =~ /utf(-)?8/i) {
$content = encode('UTF-8', $content);
}
print $response->header('Content-Type') . "\n";
print $content . "\n";
exit 0;
}
}
# simulate open(FOO, "-|")
sub pipe_from_fork ($) {
my $parent = shift;
$SIG{CHLD} = 'IGNORE';
pipe $parent, my $child or die;
my $pid = fork();
die "fork() failed: $!" unless defined $pid;
if ($pid) {
close $child;
} else {
close $parent;
open(STDOUT, ">&=" . fileno($child)) or die;
}
$pid;
}
# Takes a LWP::UserAgent and an HTTP::Request. Returns the result of the
# HTTP::Request. Handles hung servers as well as timeouts. Based on:
# http://stackoverflow.com/questions/73308/true-timeout-on-lwpuseragent-\
# request-method
sub ua_request_with_timeout {
my ($ua, $url) = @_;
my ($req_timeout);
# Pick up LWP's request timeout setting.
$req_timeout = $ua->timeout();
# If Sys::SigAction is available, we can use it to get whatever timeout
# is set for LWP and use that to enforce a maximum timeout per request
# in case of server deadlock.
if (eval("{ local \$SIG{__DIE__}; require Sys::SigAction; }")) {
our $resp = undef;
if (Sys::SigAction::timeout_call( $req_timeout,
sub {$resp = $ua->get($url);})) {
return undef;
} else {
return $resp;
}
}
# Otherwise, we roll a hard six with a SIGALRM for the timeout.
else {
my $resp = undef;
our $req_has_timedout = 0;
my ($newaction, $oldaction);
# Create a new SIGALRM handler to set the timed out flag if the
# backend request is not answered before the interval has elapsed.
# Note that die ends the request within the eval (below). It is
# caught by eval, allowing the code herein to continue and check
# for a timeout.
$newaction = POSIX::SigAction->new(
sub { $req_has_timedout = 1; die "Backend request timeout"; },
POSIX::SigSet->new(SIGALRM) );
# Replace the current SIGALRM handler with our new one, saving the
# old one for restoration, later on. If this fails, we just issue
# the request directly and hope for the best.
$oldaction = POSIX::SigAction->new();
if (!sigaction(SIGALRM, $newaction, $oldaction)) {
warn "Error setting SIGALRM handler: ".$!."\n" if $verbose;
return $ua->get($url);
}
# Within an eval, set the timer and request a response from the
# backend. If the timer pops, the SIGALRM routine will set a flag
# and kill the request. The eval will catch it and we'll get on
# with our lives.
eval {
alarm($req_timeout);
$resp = $ua->get($url);
alarm(0);
};
# Cancel the SIGALRM, if the eval failed for any reason. Reset the
# SIGALRM handler back to its original state.
alarm(0);
if (!sigaction(SIGALRM, $oldaction )) {
warn "Error resetting SIGALRM handler: ".$!."\n" if $verbose;
};
# If the request has timed out, return a HTTP 408 (timeout) response
# or maybe just undef. Otherwise, return the backend's response.
if ($req_has_timedout) {
warn "Backend request timed out (".$req_timeout." secs)\n" if $verbose;
# return HTTP::Response->new(408);
return undef;
} else {
return $resp;
}
}
}
# Beautify numbers by sticking commas in.
sub commify {
my ($num) = shift;
$num = reverse $num;
$num =~ s<(\d\d\d)(?=\d)(?!\d*\.)><$1,>g;
return reverse $num;
}
sub print_version {
print "mythtv-status, version $VERSION.\n";
print "Written by Andrew Ruthven \n";
print "\n";
exit;
}
=head1 NAME
mythtv-status - Display the status of a MythTV backend
=head1 SYNOPSIS
mythtv-status [options]
=head1 DESCRIPTION
This script queries a MythTV backend and reports on the status of it,
any upcoming recordings and any which are happening right now.
The intention is to warn you if there is a program being recorded or
about to be recorded.
=head1 OPTIONS
=over
=item B<-c, --colour>
Use colour when showing the status of the encoder(s).
=item B<--date>
Set the date to run as, used for debugging purposes.
=item B<-d, --description>
Display the description for the scheduled recordings.
=item B<--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.
=item B<--encoder-details>
Display the input ID and channel name against the recording details.
=item B<--encoder-skip-idle>
Suppress displaying idle encoders in the Encoders block.
=item B<--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
B<--no-encoder-warn-non-idle>.
=item B<-e, --episode>
Display the episode (subtitle) for the scheduled recordings.
=item B<< --email [ --email ...] >>
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 B<--encoders>, B<--recording-now>
and/or B<--next-recording>.
By default highlight is turned on, to disable it use B<--nohighlight>.
=item B<--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).
=item B<-?, --help>
Display help.
=item B<< --file >>
Load XML from the file specified instead of querying a MythTV backend.
Handy for debugging things.
=item B<< --save-file >>
Save the XML we received from the MythTV backend.
Handy for debugging things.
=item B<< --guide-days-warn >>
Warn if the number of days of guide data present is equal to or below
this level. Default is 2 days.
=item B<-h HOST, --host=HOST>
The host to check, defaults to localhost.
=item B<--highlight>
Surround any items that are considered a warning with asterisks. This helps
to highlight an issue if colour mode is disabled.
=item B<--nostatus>, B<--noencoders>, B<--norecording-now>, B<--noscheduled-recordings>, B<--noschedule-conflicts>, B<--nonext-recording>, B<--nototal-disk-space>, B<--nodisk-space>, B<--noguide-data>, B<--noauto-expire>
Suppress displaying blocks of the output if they would normally be displayed.
=item B<-p PORT, --port=PORT>
The port to use when connecting to MythTV, defaults to 6544.
=item B<--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.
=item B<--auto-expire>
Display the shows due to auto expire (output is normally suppressed).
=item B<--auto-expire-count>
How many of the auto expire shows to display, defaults to 10.
=item B<--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).
=item B<--verbose>
Have slightly more verbose output. This includes any warnings that might
be generated while parsing the XML.
=item B<-v, --version>
Show the version of mythtv-status and then exit.
=back
=head1 OUTPUT
The output of this script is broken up into several chunks they are:
=over
=item Status
Some general info about the backend, currently just the timestamp of when
this program was run.
=item Guide Data
The number of days of guide data is present. By default it is only shown
if the number of days is below the warning level. To show it regardless
of the warning level use --guide-data.
=item Encoders
Each encoder that the backend knows about are listed, with the hostname
they are on, the encoder ID (in brackets) and the current status.
=item Recording Now
Any programs which are being recorded right now.
=item Scheduled Recordings
Up to 10 programs which are scheduled to be recorded today and tomorrow.
=item Schedule Conflicts
Any upcoming schedule conflicts (not just limited to today or tomorrow).
=item Shows due to Auto Expire
The shows which will be deleted and the order they'll be deleted if the
auto expirer kicks in.
=item Total Disk Space
The amount of disk space in total, and used by MythTV.
=item Next Recording In
If there are no recordings currently happening, then the amount of time until
the next recording is displayed.
=item Disk Space
Details about each storage group that MythTV knows about. By default this
only shows storage groups that are above the warning level. Use
B<--disk-space> to turn on display of all storage groups.
=back
=head1 RETURN CODES
mythtv-status provides some return codes.
=over
=item 0Z<>
Standard return code
=item 1Z<>
A warning is generated
=back
=head1 AUTHOR
Andrew Ruthven, andrew@etc.gen.nz
=head1 LICENSE
Copyright (c) 2007-2023 Andrew Ruthven
This code is hereby licensed for public consumption under the GNU GPL v3.
=cut
mythtv-status-1.1.0/bin/mythtv-update-motd 0000775 0000000 0000000 00000005120 14456744277 0020661 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright (c) 2007-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Run mythtv-status to update the MOTD.
NAME=mythtv-update-motd
# Debian style
[ -r /etc/default/mythtv-status ] && . /etc/default/mythtv-status
# Fedora style
[ -r /etc/sysconfig/mythtv-status ] && . /etc/sysconfig/mythtv-status
# Support the old RUN variable
[ "$UPDATE_MOTD" = "" ] && UPDATE_MOTD=$RUN
if [ "$UPDATE_MOTD" != "yes" ] || [ -f /var/lib/mythtv-status/motd_update_disabled ]
then
exit
fi
WORKFILE=/run/motd
TEMPFILE=/run/motd.mythtv-status
if [ -d /etc/update-motd.d ]
then
# We want to generate file which only contains the MythTV Status
# as a snippet in /etc/update-motd.d will cat this file.
#
# Current (as of 2019-01-1) Debian and Ubuntu releases use this
# method.
WORKFILE=/run/motd.mythtv-status
TEMPFILE=${WORKFILE}.new
else
# We are going to generate an motd file to be used for the system,
# with the previous content first, then the MythTV Status.
STUBFILE=/run/motd.orig
if [ -f /etc/os-release ]
then
DISTRO=$(awk -F= '$1 == "ID" { print $2 }' /etc/os-release)
else
DISTRO='unknown'
fi
if [ "$DISTRO" = 'fedora' ]
then
WORKFILE=/etc/motd
STUBFILE=/etc/motd.stub
TEMPFILE=/etc/motd.mythtv-status
fi
# Just incase someone has removed their motd file.
[ -f $WORKFILE ] || touch $WORKFILE
# Keep the original content around.
[ -f $STUBFILE ] || cp $WORKFILE $STUBFILE
# If the tempfile is less than 15 minutes old, object, otherwise
# we'll assume that something went wrong and remove it.
if [ -f $TEMPFILE ]; then
AGE=$(stat -c "%Z" $TEMPFILE);
THRESHOLD=$(( $(date +'%s') - 900 ))
if [ $AGE -gt $THRESHOLD ]
then
echo "I think another $NAME is running."
exit 1
fi
fi
# Have whatever the system motd contains before the MythTV content
cp $STUBFILE $TEMPFILE
fi
# Support the old ARGS variable
[ "$UPDATE_MOTD_ARGS" = "" ] && UPDATE_MOTD_ARGS=$ARGS
ret=0
mythtv-status $UPDATE_MOTD_ARGS -h $HOST >> $TEMPFILE || ret=$?
if [ $ret -eq 0 ] || [ $ret -eq 1 ]; then
if [ ! -f $TEMPFILE ]; then
echo My temporary file has gone away, failed.
exit 1
else
mv $TEMPFILE $WORKFILE
fi
else
# Something else went wrong, remove the temp file.
rm -f $TEMPFILE
exit 1
fi
# Local Variables:
# sh-basic-offset: 2
# End:
mythtv-status-1.1.0/bin/mythtv_recording_now 0000775 0000000 0000000 00000001256 14456744277 0021365 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright (c) 2008-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Return an exit code of 0 if the MythTV backend is currently recording
# a show.
# Where Debian stores the config info.
if [ -f /etc/default/mythtv-status ]
then
. /etc/default/mythtv-status
fi
/usr/bin/mythtv-status -h "${HOST:=localhost}" --return-code-only --recording-now
if [ $? -eq 1 ]
then
exit 0
else
exit 1
fi
mythtv-status-1.1.0/bin/mythtv_recording_soon 0000775 0000000 0000000 00000001540 14456744277 0021534 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright (c) 2008-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Return an exit code of 0 if the MythTV backend is currently recording
# a show or will be recording a show soon (in the next hour).
# Where Debian stores the config info.
if [ -f /etc/default/mythtv-status ]
then
. /etc/default/mythtv-status
fi
if [ "x$1" != "x" ]
then
ARGS="--recording-in-warn $1"
else
ARGS="--recording-in-warn 600"
fi
/usr/bin/mythtv-status -h "${HOST:=localhost}" --return-code-only \
--recording-now --next-recording $ARGS
if [ $? -eq 1 ]
then
exit 0
else
exit 1
fi
mythtv-status-1.1.0/man/ 0000775 0000000 0000000 00000000000 14456744277 0015164 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/man/mythtv-update-motd.8 0000664 0000000 0000000 00000003566 14456744277 0021043 0 ustar 00root root 0000000 0000000 .\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH MYTHTV-UPDATE-MOTD 8 "2018-12-31"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
mythtv-update-motd \- update the MOTD with a MythTV backend status
.SH SYNOPSIS
.B mythtv-update-motd
.SH DESCRIPTION
Update the system MOTD with the status of a MythTV backend. It is
typically run from cron.
.SH CONFIGURATION
The configuration file for this script is
.I /etc/default/mythtv-status
options of interest:
.TP
.B HOST
The host to check, by default this is localhost.
.TP
.B UPDATE_MOTD
Should this script run? Set to yes to enable, anything else to disable.
.TP
.B UPDATE_MOTD_ARGS
Any additional arguments you'd like to have run if the MOTD is updated by this
script.
.PP
.PD 0
You can also disable this script from running by creating a file
called
.IR /var/lib/mythtv-status/motd_update_disabled .
If you run either:
.IP
systemctl stop mythtv-status
.PP
or
.IP
/etc/init.d/mythtv-status stop
.PP
this will be done for you, and will remove the most recent motd snippet.
.PD
.SH OPTIONS
None
.SH "EXIT STATUS"
.TP
.B 0
Updated MOTD with MythTV status
.TP
.B 1
Failed to update MOTD with MythTV status
.SH FILES
.B /etc/default/mythtv-status
Config file
.SH SEE ALSO
.BR mythtv-status (1),
.SH AUTHOR
mythtv-update-motd and this manpage were written by Andrew Ruthven
.
mythtv-status-1.1.0/man/mythtv_recording_now.1 0000664 0000000 0000000 00000002471 14456744277 0021524 0 ustar 00root root 0000000 0000000 .\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH MYTHTV-RECORDING-NOW 1 "2008-04-19"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
mythtv_recording_now \- test whether a MythTV backend is recording now
.SH SYNOPSIS
.B mythtv_recording_now
.SH DESCRIPTION
.B mythtv_recording_now
checks to see if a MythTV backend is recording now.
It checks the host which is configured in
.I /etc/default/mythtv-status
with the HOST setting.
.SH OPTIONS
None
.SH "EXIT STATUS"
.TP
.B 0
MythTV backend is recording
.TP
.B 1
MythTV backend is not recording
.SH FILES
.B /etc/default/mythtv-status
Config file
.SH SEE ALSO
.BR mythtv-status (1),
.BR mythtv_recording_soon (1).
.SH AUTHOR
mythtv_recording_now and this manpage were written by Andrew Ruthven
.
mythtv-status-1.1.0/man/mythtv_recording_soon.1 0000664 0000000 0000000 00000003034 14456744277 0021673 0 ustar 00root root 0000000 0000000 .\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH MYTHTV-RECORDING-SOON 1 "2008-04-19"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
mythtv_recording_soon \- test whether a MythTV backend will be recording soon
.SH SYNOPSIS
.B mythtv_recording_soon
[
.I time in seconds
]
.SH DESCRIPTION
.B mythtv_recording_soon
checks to see if a MythTV backend is currently recording, or will be recording
soon. It checks the host which is configured in
.I /etc/default/mythtv-status
with the HOST setting.
.PP
.I time in seconds
is how long "soon" is considered to be. It defaults to 600 (10 minutes).
.SH OPTIONS
None
.SH "EXIT STATUS"
.TP
.B 0
MythTV backend is recording now, or will be recording soon
.TP
.B 1
MythTV backend is not recording now and won't be recording soon
.SH FILES
.B /etc/default/mythtv-status
Config file
.SH SEE ALSO
.BR mythtv-status (1),
.BR mythtv_recording_now (1).
.SH AUTHOR
mythtv_recording_soon and this manpage were written by Andrew Ruthven
.
mythtv-status-1.1.0/molly-guard/ 0000775 0000000 0000000 00000000000 14456744277 0016645 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/molly-guard/40-mythtv-recording-soon 0000775 0000000 0000000 00000001630 14456744277 0023275 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Copyright (c) 2008-2023 Andrew Ruthven
# This code is hereby licensed for public consumption under the GNU GPL v3.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ME=molly-guard
if [ ! -f /usr/bin/mythtv_recording_soon ]; then
echo "I: $ME: I can't find /usr/bin/mythtv_recording_soon, skipping check" >&2
exit 0
fi
HOST="$(hostname --short)"
sigh()
{
echo "Good thing I asked; I won't $MOLLYGUARD_CMD $HOST ..." >&2
exit 1
}
if /usr/bin/mythtv_recording_soon; then
trap 'echo;sigh' 1 2 3 10 12 15
printf "MythTV is either recording now, or will be soon. Type YES to %s: " "$MOLLYGUARD_CMD"
read CONFIRM || :
[ "$(echo "$CONFIRM" | tr 'A-Z' 'a-z')" = "yes" ] || sigh
trap - 1 2 3 10 12 15
fi
exit 0
mythtv-status-1.1.0/systemd/ 0000775 0000000 0000000 00000000000 14456744277 0016101 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/systemd/mythtv-status.service 0000664 0000000 0000000 00000000665 14456744277 0022346 0 ustar 00root root 0000000 0000000 [Unit]
Description=MythTV Status
After=network.target mythtv-backend.service
Wants=mythtv-backend.service
Documentation=man:mythtv-status
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/sh -c "rm -f /var/lib/mythtv-status/motd_update_disabled"
ExecStart=/usr/sbin/mythtv-update-motd
ExecStop=/bin/sh -c "touch /var/lib/mythtv-status/motd_update_disabled; rm -f /run/motd.mythtv-status";
[Install]
WantedBy=multi-user.target
mythtv-status-1.1.0/systemd/mythtv-status_health-check.service 0000664 0000000 0000000 00000000253 14456744277 0024737 0 ustar 00root root 0000000 0000000 [Unit]
Description=Daily mythtv-status health check of MythTV
Documentation=man:mythtv-status(1)
[Service]
Type=oneshot
ExecStart=/usr/libexec/mythtv-status/health-check
mythtv-status-1.1.0/systemd/mythtv-status_health-check.timer 0000664 0000000 0000000 00000000255 14456744277 0024421 0 ustar 00root root 0000000 0000000 [Unit]
Description=Daily mythtv-status health check of MythTV
Documentation=man:mythtv-status(1)
[Timer]
OnCalendar=Daily
OnBootSec=15min
[Install]
WantedBy=timers.target
mythtv-status-1.1.0/systemd/mythtv-status_update-motd.service 0000664 0000000 0000000 00000000224 14456744277 0024640 0 ustar 00root root 0000000 0000000 [Unit]
Description=mythtv-status MOTD update
Documentation=man:mythtv-update-motd(8)
[Service]
Type=oneshot
ExecStart=/usr/sbin/mythtv-update-motd
mythtv-status-1.1.0/systemd/mythtv-status_update-motd.timer 0000664 0000000 0000000 00000000254 14456744277 0024323 0 ustar 00root root 0000000 0000000 [Unit]
Description=mythtv-status MOTD update
Documentation=man:mythtv-update-motd(8)
[Timer]
OnCalendar=*-*-* *:00,15,30,45
OnBootSec=60
[Install]
WantedBy=timers.target
mythtv-status-1.1.0/t/ 0000775 0000000 0000000 00000000000 14456744277 0014654 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/t/01-test-help.t 0000664 0000000 0000000 00000007547 14456744277 0017201 0 ustar 00root root 0000000 0000000 #!usr/bin/perl
use Test::More tests => 2;
use FindBin qw/$Bin/;
# Test that the blurb of how to get help is printed.
my $out = `$Bin/../bin/mythtv-status --zzz 2>&1`;
my $expected = <&1`;
$expected = <[ --email ...]
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
Load XML from the file specified instead of querying a MythTV
backend. Handy for debugging things.
--save-file
Save the XML we received from the MythTV backend. Handy for
debugging things.
--guide-days-warn
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');
mythtv-status-1.1.0/t/05-v0.20-clean.t 0000664 0000000 0000000 00000011741 14456744277 0017114 0 ustar 00root root 0000000 0000000 #!usr/bin/perl -w
use strict;
use Test::More tests => 42;
use FindBin qw/$Bin/;
my $xml = "$Bin/xml/single-filesytem-0.20.2.xml";
# Test that the blurb of how to get help is printed.
my $out = `$Bin/../bin/mythtv-status --file $xml 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present');
like($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Ends: 19:00:00$/m, 'Recording now is present (the news)');
# Test that the status isn't present if --nostatus is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --nostatus 2>&1`;
like($out, qr/MythTV status for localhost/, 'Header is present');
unlike($out, qr/^Status as of\.*:/m, 'Status line is not present');
like($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Ends: 19:00:00$/m, 'Recording now is present (the news)');
# Test that the disk space isn't present if --nototal-disk-space is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --nototal-disk-space 2>&1`;
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present');
unlike($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is not present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Ends: 19:00:00$/m, 'Recording now is present (the news)');
# Test that the encoders details aren't present if --noencoders is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --noencoders 2>&1`;
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present');
like($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
unlike($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is not present');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Ends: 19:00:00$/m, 'Recording now is present (the news)');
# Test that the recording now details aren't present if --norecording-now is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --norecording-now 2>&1`;
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present');
like($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
unlike($out, qr/^Recording Now:\s+3 News \(TV3\) Ends: 19:00:00$/m, 'Recording now is not present');
# Test that the encoder details for a recording are present if --encoder-details is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --encoder-details 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present');
like($out, qr/^Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Enc: 9, Chan: 3, Ends: 19:00:00$/m, 'Recording now is present (the news) with encoder details');
# Test that the encoder details for a recording are present if --encoder-details is passed.
$out = `$Bin/../bin/mythtv-status --file $xml --oneliner-bullets 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^\* Status as of\.*: Thu Nov 29 2007, 6:43 PM$/m, 'Status line is present (with bullet)');
like($out, qr/^\* Total Disk Space: Total space is 100 GB, with 72\.2 GB used \(72%\)$/m, 'Total disk space is present (with bullet)');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present');
like($out, qr/^Encoders:\s+cerberus \(9\) - Recording$/m, 'Encoder is present, and recording');
like($out, qr/^Recording Now:\s+3 News \(TV3\), Ends: 19:00:00$/m, 'Recording now is present (the news)');
mythtv-status-1.1.0/t/10-v0.20-guide-data-warning.t 0000664 0000000 0000000 00000002136 14456744277 0021473 0 ustar 00root root 0000000 0000000 #!usr/bin/perl -w
use strict;
use Test::More tests => 6;
use FindBin qw/$Bin/;
my $xml = "$Bin/xml/guide-data-1-day-0.20.xml";
# Test that the guide data warning is present.
my $out = `$Bin/../bin/mythtv-status --file $xml 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/^Guide Data\.*: There is 1 days worth of data, through to 2007-12-30/m, 'Guide data warning is present');
# If --noguide-data is passed in, then the guide data warning should be suppressed.
$out = `$Bin/../bin/mythtv-status --file $xml --noguide-data 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present (turned off)');
# If --guide-days-warn is set to something different, like 0, then the guide data warning should be suppressed.
$out = `$Bin/../bin/mythtv-status --file $xml --guide-days-warn 0 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
unlike($out, qr/^Guide Data\.*:/m, 'Guide data warning is not present (warning level changed)');
mythtv-status-1.1.0/t/15-unicode.t 0000664 0000000 0000000 00000000756 14456744277 0016722 0 ustar 00root root 0000000 0000000 #!usr/bin/perl -w
use strict;
use Test::More tests => 3;
use FindBin qw/$Bin/;
my $xml = "$Bin/xml/wide-character.xml";
# Test that the guide data warning is present.
my $out = `$Bin/../bin/mythtv-status -d --file $xml --date '2012-07-07 22:12' 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
unlike($out, qr/Wide character in print/m, 'No warning about wide characters');
like($out, qr/measurements – with/,' Description contains wide character');
mythtv-status-1.1.0/t/20-next-recording-has-hours.t 0000664 0000000 0000000 00000001167 14456744277 0022124 0 ustar 00root root 0000000 0000000 #!usr/bin/perl -w
# There was bug which converted:
# Next Recording In: 10 Hours, 42 Minutes
# To:
# Next Recording In: 142 Minutes
# Due to the regex for "0 Hours" being a bit enthusastic.
use strict;
use Test::More tests => 2;
use FindBin qw/$Bin/;
my $xml = "$Bin/xml/bug729400-wrong-recording-date.xml";
# Test that the guide data warning is present.
my $out = `$Bin/../bin/mythtv-status -d --file $xml --date '2013-12-09T21:02:12Z' 2>&1`;
#diag($out);
like($out, qr/MythTV status for localhost/, 'Header is present');
like($out, qr/Next Recording In: 10 Hours, 42 Minutes/, 'Next recording has hours as required');
mythtv-status-1.1.0/t/xml/ 0000775 0000000 0000000 00000000000 14456744277 0015454 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/t/xml/bug729400-wrong-recording-date.xml 0000664 0000000 0000000 00000034643 14456744277 0023472 0 ustar 00root root 0000000 0000000
Cass heißt eine Siedlung in den Bergen West Virginias, die aussieht, als wäre die Uhr hundert Jahre zurückgedreht, in eine Zeit, in der die Bewohner noch im nahegelegenen Sägewerk zur Arbeit gingen. Das Sägewerk ist längst Geschichte, es wurde vor einem halben Jahrhundert Opfer eines Feuers. Aber der Ort ist erhalten geblieben und unterdessen ein nationales Kulturgut, ebenso wie die Waldeisenbahn, die von Eisenbahnfreunden und dem Staat West Virginia bereits vor vier Jahrzehnten gerettet wurde. Dazu gehört auch die größte Flotte von Waldbahnlokomotiven in den Vereinigten Staaten. Produziert in HD
Wie schon die ehemalige Strecke Reutlingen-Lichtenstein auf die Schwäbische Alb hinauf, sollte auch die Strecken Engstingen - Münsingen und etwas später Münsingen - Schelkingen stillgelegt werden. Dem beherzten Eingreifen engagierter Eisenbahnfreunde und dem Zusammenspiel von Kommunen und Landkreis, von verschiedenen Nahverkehrsunternehmen und Vereinen und - nicht zu vergessen - dem Land Baden-Württemberg ist es zu verdanken, dass seit 2004 zwischen Gammertingen und Schelkingen eine der schönsten touristischen Attraktionen zum Leben erweckt wurde, die Schwäbische Albbahn. Produziert in HD
80 Prozent des in Deutschland gekauften Käses ist foliengereifter Käse in Scheiben. 250 Gramm Gouda für weniger als 1,30 Euro. Da fragt man sich: Wie geht das so günstig? Schließlich müssen Hersteller und Handel auch daran verdienen. Leidet darunter die Qualität? Und hat das noch etwas mit glücklichen Kühen auf der grünen Wiese zu tun? "Galileo" war in der größten Molkerei Europas und hat es sich angesehen.
Im Alltag begegnen uns ständig Dinge, mit denen wir zwar regelmäßig zu tun haben, aber die wir eigentlich gar nicht benennen können. Wissen Sie, wie diese weiße Haut bei Mandarinen heißt, die wir immer wegschälen? "Galileo" lüftet das Geheimnis von Dingen ohne Namen und verrät, was dahinter steckt - und zwar auf dem Weihnachtsmarkt.
Eisenbahn-Romantik berichtet vom Mekka der Modellbahnen: von der Nürnberger Spielwarenmesse 2013. Seit den 50er Jahren präsentieren Firmen aus aller Welt in der Lebkuchenstadt jährlich ihre Neuheiten. Leider nur für Fachleute und nicht fürs eisenbahninteressierte Publikum. Die Messeleitung hat sogar eigens eine Trendbeauftragte beschäftigt; ein neuer Trend ist das Steuern von Modelleisenbahnen per i-phone, aber auch jede Menge neue Fahrzeuge und Zubehör werden zu sehen sein. Das Eisenbahn-Romantik-Team sucht für Sie aus der Fülle der Neuheiten das Interessanteste heraus. Produziert in HD
Heute gibt es kaum noch einen Kino- oder Fernsehfilm, der ohne Spezialeffekte auskommt. Oftmals besticht ein Film durch seine grafische Darbietung. Auch bei "Galileo" werden digitale Techniken verwendet, um so eine neue Realität zu schaffen. Doch wann war der Special Effect geboren? Und woher kommt er? Die Zeitreise beginnt bereits 1896, also vor 117 Jahren.
Wenn die Sonne lacht und es überall grünt und blüht, schlägt ihre Stunde, dann haben Park- und Gartenbahnen Hochsaison. Bei den Parkbahnen sitzen Lokführer und Passagiere je nach Spurweite auf oder in den Fahrzeugen - und spielen "Eisenbahnfahren", wie auf der großen Bahn. Während bei der Parkeisenbahn das Fahrvergnügen im Vordergrund steht, ist es bei den Gartenbahnen eher der Betrieb der Bahnen. Sie sind zur Personenbeförderung nicht geeignet. Wenn sie allerdings durch Blumenbeete rattern, über Bächlein und kleine Hügel hinauf, dann lacht auch hier das Eisenbahnerherz. Produziert in HD
Es waren einmal fünf Freunde aus dem schwäbischen Winnenden, die sich mit ihrem Modellbahnhobby zusammengetan haben. Ihre Anlage wuchs, ebenso ihre Begeisterung, und das seit bald 50 Jahren. 2003 wurde das Modellbahnerglück allerdings jäh unterbrochen, ja es gingen buchstäblich die Lichter aus. Die Private Modellbahner Vereinigung Winnenden, PMW, musste ihr angestammtes Domizil in der Ziegelei verlassen und ihre Anlage komplett abbauen. Doch diese Wunden sind längst verheilt. Seit nunmehr neun Jahren rattern die Züge im neuen Domizil auf rund 4.000 Meter Gleis wieder durch die schwäbische Märchenwelt der PMWler. Produziert in HD
El Tren a las nubes - der Zug in die Wolken bringt seine Passagiere in die überwältigende Landschaft der argentinischen Puna. Seine 16-stündige Reise beginnt in der Provinzhauptstadt Salta auf 1.600 Metern und führt hinauf in die Andenkordilleren. Höhepunkt der Bahnfahrt ist der Umkehrpunkt hinter dem Viadukt Polvorilla auf 4.200 Meter Höhe. Über die drittgrößten Salzseen der Welt, die Salinas Grandes, gelangt man in die Quebrada de Humahuaca, eine gewaltige Schlucht, die aufgrund ihrer farbenprächtigen Felsformationen auf der Liste der Unesco-Weltkulturerbe steht. Produziert in HD
Spielzeugträume aus Weißblech
Such nach Metadaten erfolgreich.Wer einen Blick hinter die Kulissen einer der größten Fast-Food-Ketten weltweit werfen will, kommt um kritische Fragen nicht herum. Was ist das Erfolgsrezept von McDonalds? Unter welchen Bedingungen wird hier gearbeitet? Der Konzern stellt sich bei "Galileo" den Fragen rund um die Themen Qualitätssicherung, Erfolg und Imageveränderungen.
mythtv-status-1.1.0/t/xml/guide-data-1-day-0.20.xml 0000664 0000000 0000000 00000034353 14456744277 0021500 0 ustar 00root root 0000000 0000000
3 News
Grace's pride won't let her admit it was her poor credit rating that led to the bank's refusal to extend their overdraft. She has to learn to work with Kate when they're taken hostage by a distraught
Named Best New Comedy by American TV Guide
3 News
A gripping drama series starring Emmy Award-winners James Spader and William Shatner along with a stellar support cast including Rhona Mitra
The teams must create a 60-second promotional video for new Microsoft software, with execs from the technology giant as the final judges. With only two people left on each team, the stakes are high.
3 News
Grand Designs
3 News
Two friends take the property-coaching route to riches; and a young couple mortgages their home to the hilt and goes without, to make their fortune.
Two teams take on the challenge to construct a super fast monster machine at least 5 metres long and weighing at least 5.5 tonnes.
Classic car nuts, the Beasts of Bodmin, take on Essex forklift trio, The Powerlifters in one of the hardest challenges to date: making cars that can clamber over boulders.
A collection of favourite clips from the engineering entertainment show that pits teams of madcap mechanics against each other.
Adam and Jamie try to beat a heat-detecting alarm sensor, attempt to crack a door guarded by fingerprint technology and crack a safe only opened by an underwater explosion.
Jamie and Adam play with high-speed wind and find out whether the wind in a hurricane can get strong enough to blow a piece of straw through a palm tree trunk and blow the feathers off a chicken.
Jamie and Adam try to prove that a cable snapping at high tension can slice a person in half, while the others explore the theory that pottery contains sounds that can be played back like a record.
mythtv-status-1.1.0/t/xml/single-filesytem-0.20.2.xml 0000664 0000000 0000000 00000034353 14456744277 0022203 0 ustar 00root root 0000000 0000000
3 News
Grace's pride won't let her admit it was her poor credit rating that led to the bank's refusal to extend their overdraft. She has to learn to work with Kate when they're taken hostage by a distraught
Named Best New Comedy by American TV Guide
3 News
A gripping drama series starring Emmy Award-winners James Spader and William Shatner along with a stellar support cast including Rhona Mitra
The teams must create a 60-second promotional video for new Microsoft software, with execs from the technology giant as the final judges. With only two people left on each team, the stakes are high.
3 News
Grand Designs
3 News
Two friends take the property-coaching route to riches; and a young couple mortgages their home to the hilt and goes without, to make their fortune.
Two teams take on the challenge to construct a super fast monster machine at least 5 metres long and weighing at least 5.5 tonnes.
Classic car nuts, the Beasts of Bodmin, take on Essex forklift trio, The Powerlifters in one of the hardest challenges to date: making cars that can clamber over boulders.
A collection of favourite clips from the engineering entertainment show that pits teams of madcap mechanics against each other.
Adam and Jamie try to beat a heat-detecting alarm sensor, attempt to crack a door guarded by fingerprint technology and crack a safe only opened by an underwater explosion.
Jamie and Adam play with high-speed wind and find out whether the wind in a hurricane can get strong enough to blow a piece of straw through a palm tree trunk and blow the feathers off a chicken.
Jamie and Adam try to prove that a cable snapping at high tension can slice a person in half, while the others explore the theory that pottery contains sounds that can be played back like a record.
mythtv-status-1.1.0/t/xml/wide-character.xml 0000664 0000000 0000000 00000003307 14456744277 0021063 0 ustar 00root root 0000000 0000000
The couples begin their first room renovation and Mark challenges them to build a wall to his exact measurements – with a prize that will turn the competition upside down.
mythtv-status-1.1.0/update-motd.d/ 0000775 0000000 0000000 00000000000 14456744277 0017056 5 ustar 00root root 0000000 0000000 mythtv-status-1.1.0/update-motd.d/50-mythtv-status 0000775 0000000 0000000 00000000306 14456744277 0022101 0 ustar 00root root 0000000 0000000 #!/bin/sh
# See:
# man mythtv-update-motd
# on how to disable this service if you don't want it to run.
if [ -f /run/motd.mythtv-status ]; then
cat /run/motd.mythtv-status
else
exit 0
fi