XMLTVGrabbers
Contents
Using XMLTV grabbers
The XMLTVProject includes two major classes of tools.
- Grabbers -- These tools obtain data in XMLTV format.
- Filters -- These tools modify data in XMLTV format
In this post, we're going to focus on the Grabbers.
NOTE FOR WINDOWS USERS
The xmltv tools are command line tools. Of course you can put them in batch files too (and most folks do!). For now, open a COMMAND PROMPT and get started!
A pre-compiled perl distribution is included in an XMLTV.EXE file. This includes most grabbers and filters! To use it simply download the release file from the XMLTV releases or the ALPHA EXE. Save the file in a directory (safer one without spaces... say c:\xmltv) then use it!
To use xmltv.exe simply prefix the xmltv tool with xmltv.exe (or just xmltv). for example:
cd \xmltv xmltv tv_grab_na_dd --configure
WARNING: The first time you run xmltv.exe it will take a long time, this is normal.
CONFIGURING A GRABBER
The Grabbers are very consistent in how to use them. That said, a few are different (tv_grab_zz_sdjson_sqlite comes to mind), so read the messages, just don't hit enter! The Grabbers tend to provide useful defaults for most questions.
The first step is the CONFIGURE step.
grabber --configure
Then answer the questions! yes, it's that easy. You only need to do this once, or when things change. no need to put it in your grabber script.
Once that's done and you're ready to go!
GRABBING LISTINGS
This is even easier, as everything is already configured! The below command will output 7 days to tv.xml
grabber --days 7 --output tv.xml
Leave off --days and you're get that grabber's default value. Leave off --outout and the outout will be written to STDOUT (in case you want to pipe to a filter!)
That's it! It really is easy.
First use example
This example uses a grabber against [Schedules Direct's] JSON service. An account is needed (free 7 day trial, no CC needed, so make sure it works for you before paying!). If you're not using windows, leave off the xmltv command.
C:\Users\robert\batch>xmltv tv_grab_zz_sdjson --configure Timezone is -0500 Cache file for lineups, schedules and programs. Cache file: [C:\Users\robert/.xmltv/tv_grab_zz_sdjson.cache] <enter> for default If you are migrating from a different grabber selecting an alternate channel ID format can make the migration easier. Select channel ID format: 0: Default Format (eg: I12345.json.schedulesdirect.org) 1: tv_grab_na_dd Format (eg: I12345.labs.zap2it.com) 2: MythTV Internal DD Grabber Format (eg: 12345) Select one: [0,1,2 (default=0)] <enter> for default As the JSON data only includes the previously shown date normally the XML output should only have the date. However some programs such as older versions of MythTV also need a time. Select previously shown format: 0: Date Only 1: Date And Time Select one: [0,1 (default=0)] <enter> for default Schedules Direct username. Username: SD username Schedules Direct password. Password: SD password ** POST https://json.schedulesdirect.org/20141201/token ==> 200 OK (1s) ** GET https://json.schedulesdirect.org/20141201/status ==> 200 OK ** GET https://json.schedulesdirect.org/20141201/lineups ==> 400 Bad Request (1s) This step configures the lineups enabled for your Schedules Direct account. It impacts all other configurations and programs using the JSON API with your account. A maximum of 4 lineups can by added to your account. In a later step you will choose which lineups or channels to actually use for this configuration. Current lineups enabled for your Schedules Direct account: #. Lineup ID | Name | Location | Transport (none) Edit account lineups: [add (default=add)] <enter> for default Lineup ID or Country (ISO-3166-1 alpha 3 such as USA or CAN): USA ** GET https://json.schedulesdirect.org/20141201/available ==> 200 OK (1s) Zip Code: 75104 ** GET https://json.schedulesdirect.org/20141201/headends?country=USA&postalcode=75104 ==> 200 OK (1s) #. Lineup ID | Name | Location | Transport 1. USA-0000001-CUSTOM | ChannelsDVR TV-Everywhere | National | IPTV 2. USA-AFN-X | AFN Satellite | National | Satellite 3. USA-AMZPV-X | Amazon Prime Video | National | IPTV 4. USA-DISH623-X | DISH Dallas/Ft. Worth | Dallas | Satellite 5. USA-DITV-X | DIRECTV | National | Satellite 6. USA-DITV623-X | DIRECTV Dallas | Dallas | Satellite 7. USA-DNOW623-X | DIRECTV STREAM Dallas | Dallas | IPTV 8. USA-DTVNOW-X | DIRECTV STREAM | National | IPTV 9. USA-ECHOST-X | DISH Network | National | Satellite 10. USA-FRNDLY-X | frndly | National | IPTV 11. USA-FUBO623-X | FuboTV Dallas | Dallas | IPTV 12. USA-FUBOTV-DEFAULT | fuboTV | None | IPTV 13. USA-FUBOTV-X | fuboTV | None | IPTV 14. USA-GLRYSTR-X | GLORYSTAR | National | Satellite 15. USA-GNSTR-X | US Streaming (Extended) | National | IPTV 16. USA-HULU623-X | Hulu Dallas | Dallas | IPTV 17. USA-HULUTV-X | Hulu | National | IPTV 18. USA-IMDBTV-X | FREEVEE | National | IPTV 19. USA-PEACOCK-X | Peacock | National | IPTV 20. USA-PHILO-X | Philo | National | IPTV 21. USA-PLUTOTV-X | Pluto TV | National | IPTV 22. USA-SAMSUNG-X | Samsung TV Plus | National | IPTV 23. USA-SLINGTV-X | Sling TV | National | IPTV 24. USA-SLNG623-X | Sling TV Dallas | Dallas | IPTV 25. USA-SMSG623-X | Samsung TV Plus Dallas | Dallas | IPTV 26. USA-TUBISTR-X | TUBI TV | National | IPTV 27. USA-TX42822-X | Charter Spectrum North TX | Dallas | Cable 28. USA-TX42822-L | Charter Spectrum North TX | Dallas | Cable 29. USA-TX66409-X | AT&T U-verse TV | Dallas | Cable 30. USA-VIZIO-X | Vizio | National | IPTV 31. USA-XFINSTR-X | Xfinity Stream | National | IPTV 32. USA-XUMOTV-X | Xumo TV | National | IPTV 33. USA-YOUTUBE-X | You Tube TV | National | IPTV 34. USA-YTBE623-X | You Tube Dallas | Dallas | IPTV 35. USA-OTA-75104 | Antenna | 75104 | Antenna Add lineup (0 = none): [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 (default=0)] 35 ** PUT https://json.schedulesdirect.org/20141201/lineups/USA-OTA-75104 ==> 200 OK (1s) ** GET https://json.schedulesdirect.org/20141201/lineups ==> 200 OK (1s) This step configures the lineups enabled for your Schedules Direct account. It impacts all other configurations and programs using the JSON API with your account. A maximum of 4 lineups can by added to your account. In a later step you will choose which lineups or channels to actually use for this configuration. Current lineups enabled for your Schedules Direct account: #. Lineup ID | Name | Location | Transport 1. USA-OTA-75104 | Local Broadcast Listings | 75104 | Antenna Edit account lineups: [continue,add,delete (default=continue)] <enter> for default Choose whether you want to include complete lineups or individual channels for this configuration. Select mode: [lineups,channels (default=lineups)] <enter> for default ** GET https://json.schedulesdirect.org/20141201/lineups ==> 200 OK (1s) Choose lineups to use for this configuration. USA-OTA-75104 [yes,no,all,none (default=no)] yes C:\Users\robert\batch>xmltv tv_grab_zz_sdjson --days 1 --output tv.xml Timezone is -0500 Initializing... ** POST https://json.schedulesdirect.org/20141201/token ==> 200 OK (1s) ** GET https://json.schedulesdirect.org/20141201/status ==> 200 OK (1s) Updating lineups... Indexing channels... Updating schedules... ** POST https://json.schedulesdirect.org/20141201/schedules/md5 ==> 200 OK (7s) ** POST https://json.schedulesdirect.org/20141201/schedules ==> 200 OK (1s) Updating programs... Removing old cache entries... Writing output... Done
C:\Users\robert\batch>more tv.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv source-info-url="http://www.schedulesdirect.org" source-info-name="Schedules Direct" generator-info-name="tv_grab_zz_sdjson 1.4.0_033">
<channel id="I100147.json.schedulesdirect.org">
<display-name>KFWD-DT4</display-name>
<display-name>KFWDDT4</display-name>
<display-name>52_4</display-name>
</channel>
<channel id="I100561.json.schedulesdirect.org">
<display-name>KHFD-LD7</display-name>
<display-name>KHFDLD7</display-name>
<display-name>16_7</display-name>
</channel>
<channel id="I100815.json.schedulesdirect.org">
<display-name>KODF-LD5</display-name>
<display-name>KODFLD5</display-name>
<display-name>26_5</display-name>
<icon src="https://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s67676_dark_360w_270h.png" width="360" height="270" />
</channel>
<channel id="I101911.json.schedulesdirect.org">
<display-name>KFWD-DT5</display-name>
<display-name>KFWDDT5</display-name>
<display-name>52_5</display-name>
<icon src="https://schedulesdirect-api20141201-logos.s3.dualstack.us-east-1.amazonaws.com/stationLogos/s16604_dark_360w_270h.png" width="360" height="270" />
</channel>
'''Q to QUIT more```
C:\Users\robert\batch>