tv_grep (1)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
tv_grep - Filter programmes and channels from an XMLTV listings file.SYNOPSIS
"tv_grep [--help] [--output FILE] [--ignore-case|-i] (EXPR | REGEXP) [FILE...]"DESCRIPTION
ReadsSimple usage is tv_grep
For more advanced searches, you can specify a Boolean expression (which loosely follows the style of find(1)). There are many tests for matching programme content against a regular expression, a few for matching channels and programmes on those channels, and a few special tests.
OPTIONS
--output--ignore-case, -i treat all regular expression matches as case insensitive.
EXPRESSIONS
PROGRAMME CONTENT TESTS
The tests for programme content match against particular attributes or
subelements of the <programme> element in the Some elements may or may not have content - they may just be empty. The regular expression '' (the empty string) matches any element, even one with empty content, while a nonempty regular expression matches only those with content.
For example, --desc Racing matches a programme if the programme has at least one <desc> element whose content contains 'Racing'. --stop '' (the second argument is the empty string) matches a programme if the programme gives a stop time.
There are some elements where only yes/no matching is possible, where you cannot give a regexp to query the element's content. For these the second '' argument is mandatory. For example --previously-shown '' will match programmes which have that element, but a test of --previously-shown foo will give an error because querying the content of previously-shown is not implemented. The additional empty-string argument is to leave room for future expansion.
The content tests are generated from the
--audio ''
--category
--channel
--clumpidx
--country
--credits ''
--date
--desc
--episode-num ''
--icon ''
--keyword
--language
--last-chance
--length ''
--new
--orig-language
--pdc-start
--premiere
--previously-shown ''
--rating ''
--showview
--star-rating ''
--start
--stop
--sub-title
--subtitles ''
--title
--url
--video ''
--videoplus
--vps-start
While every attribute and subelement of <programme> elements is included in the above list, for some of them it is normally more convenient to use the special tests described below.
CHANNEL TESTS
There are two tests for channels. These filter both <programme> and
<channel> elements: if a channel is filtered out then all programmes
on that channel are too.
--channel-name
--channel-id
TIME TESTS
Normally you don't want to test time strings with a regular
expression but rather compare them with some other time. There are
two tests for this.
--on-after
--on-before
Another way of thinking about these two tests is that --on-after now gives 'all programmes you could possibly still watch, although perhaps only catching the end'. --on-before now gives 'all programmes you could possibly have seen, even if only the start'.
--eval
LOGICAL OPERATORS
--not
Of these, 'not' binds tightest, affecting the following predicate only. 'and' is next, and 'or' binds loosest.
SEE ALSO
xmltv(5), perl(1), (3).AUTHOR
Ed Avis, ed@membled.comBUGS
The --on-after test cannot be totally accurate when the input data did not give a stop time for a programme. In this case we assume the stop time is equal to the start time. This filters out more programmes than if the stop time were given. There will be a warning if this happens more than once on any single channel. It could be worthwhile to filter the listings data through tv_sort(1) beforehand to add stop times.Similar remarks apply to --on-before: if the stop time is missing we assume it is equal to the start time, and this can mean leaving in a programme which, if it had a stop time, would be removed.
The assumption of
The simple usage is the only way to match against all a programme's content because some things (like <credits>) do not have programme content tests defined. It actually works by stringifying the whole programme and regexp matching that, which means that it could give wrong results for regular expressions containing quote characters or some punctuation symbols. This is not particularly likely to happen in practice.
Some listings sources generate timeslots containing two or more programmes in succession. This is represented in