TV_GRAB...TVGUIDE(1p)
π TV_GRAB...TVGUIDE(1p) π
okay bestie, sit down, hydrate, because we're about to talk about tv_grab_uk_tvguide, the little icon that grabs TV listings for the UK from the TVGuide website. this page is from the User Contributed Perl Documentation collection, and it's giving "cult classic that only three people know about but they're all obsessed". π«Ά
β¨ NAME β¨
tv_grab_uk_tvguide β grab TV listings for the UK from the TVGuide website. literally what it says on the tin, no cap. π
πΈ SYNOPSIS πΈ
tv_grab_uk_tvguide --usage
tv_grab_uk_tvguide --version
tv_grab_uk_tvguide --configure [--config-file FILE] [--gui OPTION] [--method N]
[--makeignorelist FILE] [--useignorelist FILE] [--debug]
tv_grab_uk_tvguide [--config-file FILE] [--output FILE] [--days N]
[--offset N] [--nodetailspage] [--legacychannels]
[--quiet] [--debug]
tv_grab_uk_tvguide --list-channels [--output FILE] [--method N] [--debug]
π¦ DESCRIPTION π¦
so what does this do? it outputs TV listings in XMLTV format for a whole bunch of channels available in the UK. the data comes from tvguide.co.uk β that's the source, periodt. π
but first, first: you have to run tv_grab_uk_tvguide --configure to pick which channels you actually want. no channel choosing, no listings. that's the vibe check. π
then, once you've done that, running tv_grab_uk_tvguide with no arguments gets you programme listings in XML format for the channels you chose, for the available days including today. chef's kiss. πβ¨
π OPTIONS π
the full menu, no skips, no cuts:
--configureβ prompts you for which channels to fetch the schedule for, and writes the configuration file. this is your "pick your faves" moment. π--config-file FILEβ sets the name of the configuration file. the default is~/.xmltv/tv_grab_uk_tvguide.conf. this is the file written by--configureand read when grabbing. so it's both the diary and the diary reader, iconic behaviour honestly.--gui OPTIONβ use this to enable a graphical interface.OPTIONmay be'Tk'. other allowed values ofOPTIONare'Term'for normal terminal output (default), and'TermNoProgressBar'to disable the use ofTerm::ProgressBar. (may not work on Windows OS. π)--days Nβ grabNdays. the default is 5 days.--offset Nβ startNdays in the future. the default is to start from today.--nodetailspageβ only fetch summary information for each programme. (there's a whole discussion below, keep reading. π)--legacychannelsβ channel ids were made compliant with the XMLTV specification in December 2020. use--legacychannelsto output channel ids in the previous format (i.e. number only). retro era, respect. π°οΈ--output FILEβ write toFILErather than standard output.--method Nβ this program has three methods for fetching the list of channels available. the preferred method can be overridden with an option of either--method 1or--method 2to use one of the two alternative methods.
if no --method parameter is supplied, then the various methods will be tried in sequence until a channels list is obtained. a parameter of --method 0 will run the preferred method only.
normally you should omit this parameter. fr fr, just leave it alone. π§
--makeignorelist FILEβ the source channel list contains many channels which have no programme listings available. by using a local file of channel ids, these can be filtered out during the configure process. this option creates a list of channel ids which can be excluded from your config file.
makeignorelistcan take over an hour to run, but you only need run it infrequently (not every time you run--configure). π plan accordingly.
--useignorelist FILEβ specify the file containing a list of channel ids to be removed during the configure stage.
this may be the file just created with --makeignorelist (e.g. --configure --makeignorelist myfile --useignorelist myfile).
--quietβ suppress the progress messages normally written to the console. shhh. π€«--debugβ provide more information on progress to standard error to help in debugging.--list-channelsβ output a list (in xmltv format) of all channels that can be fetched. the whole roster. π--versionβ show the version of the grabber.--usageβ print a help message and exit.
π INSTALLATION π
the file tv_grab_uk_tvguide.map.conf has two purposes. two!! multi-talented. π
Purpose one: you can map the channel ids used by the site into something more meaningful to your PVR. e.g.
map==74==BBC 1
will change "74" to "BBC 1" in the output XML.
Note: the lines are of the form "map=={channel id}=={my name}".
Purpose two: to likewise translate genre names. so if your PVR doesn't have a category for "Science Fiction" but uses "Sci-fi" instead, then you can specify
cat==Science Fiction==Sci-fi
and the output XML will have "Sci-fi".
IMPORTANT: the downloaded "tv_grab_uk_tvguide.map.conf" contains example lines to illustrate the format β you should edit this file to suit your own purposes! bestie, do not ship the example file as-is, that's not the move. π¨
π ERROR HANDLING π
if the grabber fails to download data for some channel on a specific day, it will print an error message to STDERR and then continue with the other channels and days. it does not give up, it simply carries on, main character energy. πͺ
the grabber will exit with a status code of 1 to indicate that the data is incomplete. so if you see a 1, you know the tea is only half-brewed. π΅
π ENVIRONMENT VARIABLES π
the environment variable HOME can be set to change where configuration files are stored. all configuration is stored in $HOME/.xmltv/.
on Windows, it might be necessary to set HOME to a path without spaces in it. windows girlies, watch out for the spaces. π
π SUPPORTED CHANNELS π
for information on supported channels, see http://tvguide.co.uk/
β XMLTV VALIDATION β
tv_validate_grabber may report an error similar to:
"Line 5 Invalid channel-id BBC 1"
this is because ValidateFile.pm insists the channel-id adheres to RFC2838 despite the xmltv.dtd only saying "preferably" not "SHOULD". (having channel ids of the form "bbc1.bbc.co.uk" will be rejected by many PVRs since they require the data to match their own list.)
it may also report:
"tv_sort failed on the concatenated data. Probably due to overlapping data between days."
Both these errors can be ignored. yes, both. breathe. π§ββοΈ
πΈ USING --nodetailspage πΈ
this option may be useful if you have problems accessing the tvguide website: it will considerably speed up your grabbing, but at the expense of data richness. the details page has a better list of actors, as well as director's names, film classifications, and background images.
more significantly, the details page includes programme duration and programme end time. if you don't include the details page then your output programmes will not have stop times. although stop times are an optional XMLTV element, many downstream programs expect them and break without them. π so like, optional in theory, load-bearing in practice.
fortunately, these can be added by piping your xml file through the tv_sort filter: this will add stop times to all programmes except for the last programme on every channel. for example:
tv_grab_uk_tvguide --days 3 --nodetailspage | tv_sort --by-channel --output myprogrammes.xml
NOTE: as at January 2022 it seems the actor/director names and film classification is no longer present in the website, although it may be there for some channels(?). therefore you may find the--nodetailspageoption useful to significantly reduce your run time. however, the details page does include background image(s) of the programme, which is not present in your xml file when using--nodetailspage.
π¦ BE KIND π¦
if using the details page from the website then your grabbing might benefit from a more targeted strategy, rather than blithely getting all days for all channels. be strategic, be chic. π
since the published schedule rarely changes, a strategy of grabbing the next 3 days plus the 1 newest day would give you any new programmes as well as any last minute changes. simply fetch "--offset 0 --days 3" and concatenate it with a separate fetch of "--offset 7 --days 1".
for example:
( tv_grab_uk_tvguide --days 3 --offset 0 --output temp.xml ) && (
tv_grab_uk_tvguide --days 1 --offset 7 | tv_cat --output
myprogrammes.xml temp.xml - ) && ( rm -f temp.xml )
a similar strategy could be employed when using --nodetailspage if you have a lot of channels:
( tv_grab_uk_tvguide --days 3 --offset 0 --nodetailspage | tv_sort
--by-channel >temp.xml ) && ( tv_grab_uk_tvguide --days 1 --offset
7 --nodetailspage | tv_sort --by-channel | tv_cat --output
myprogrammes.xml temp.xml - ) && ( rm -f temp.xml )
this avoids overloading the TVGuide website, and significantly reduces your runtime with minimal impact on your viewing schedule.
TVGuide provide this data for free, so let's not abuse their generosity. π«Ά be the kind of user the internet deserves.
π DISCLAIMER π
the TVGuide website's license for these data does not allow non-personal use.
certainly, any commercial use of listings data obtained by using this grabber will breach copyright law, but if you are just using the data for your own personal use then you are probably fine.
by using this grabber you aver you are using the listings data for your own personal use only and you absolve the author(s) from any liability under copyright law or otherwise. read it, mean it, live it. π
π§ AUTHOR π§
Geoff Westcott. this documentation and parts of the code based on various other tv_grabbers from the XMLTV-project.
π SEE ALSO π
xmltv(5).
and that's the whole page, bestie!! β¨ this doc shipped with perl v5.36.0 and is dated 2023-02-24 β so it's not exactly fresh out the group chat, but it still eats. go forth and grab your listings responsibly. π ππ
π¦ where this page comes from
- debian bookworm: xmltv-util 1.2.1-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms