Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Grabber for Schedules Direct self-hosted data
tree: 2cb34ae17a

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
tv_grab_na_sd.pl

README

This (beta) grabber uses the new Schedules Direct API for downloading
schedule information directly from Schedules Direct.

You must have www-mechanize installed for this script to function correctly.
$ sudo apt-get install libwww-mechanize-perl
if you're on Ubuntu.

tv_grab_na_sd.pl v0.01 2012-04-09
Usage: tv_grab_na_sd.pl [switches]

This script supports the following command line arguments.

--debug         Enable debug mode. Prints additional information
                to assist in troubleshooting any issues.

--username      Login credentials.
--password      Login credentials. NOTE: These will be visible in "ps".

--zipcode       When obtaining the channel list from Schedules Direct
                you can supply your 5-digit zip code or
                6-character postal code to get a list of cable TV
                providers in your area, otherwise you'll be
                prompted.  If you're specifying a Canadian postal
                code, then use six consecutive characters, no
                embedded spaces.

--help          This screen.

Bug reports to grabber@schedulesdirect.org  Include the .conf file and the
complete output when the script is run with --debug

When the script is run for the first time, if you don't pass --username
--password and --zipcode as command-line parameters, you'll be prompted for
your Schedules Direct account information.

Once your account has been validated, the script will download the list of
headends in your zip code / postal code. Type the number of the headend you
will be using. If you change your mind, type the same number to remove the
headend from the queue.

When the headend selection phase is complete, the script will exit, and will
inform you to re-run the script to begin the download process.

When the script is run with a valid tv_grab_na_sd.conf file, it will
download to the current directory.

In the following examples we are using zip code 60030, headend IL57303.

Each headend file will contain metadata in the following format:
Name:Comcast Lake Forest/Waukegan|Location:Lake Forest|headend:IL57303|devicetype:|Version:2|Date:2012-03-20

This tells us the name and location of the headend, the headend ID
(IL57303), the device type (in this case "blank", or analog coax), the
version number of this headend ("2", meaning that there has been at least
one change to this lineup since it was created), and the date of the change.

Applications may use the Version number and Date parameters to inform the
user of lineup updates.

In this example
Name:Comcast Lake Forest/Waukegan|Location:Lake Forest|headend:IL57303|devicetype:X|Version:3|Date:2012-04-02
the "X" device type (Digital Set Top Box) is at version 3, and it was updated on 2012-04-02.

Other than metadata, each line will contain:
channel:002 callsign:WBBM stationid:11299 http://localhost/schedulesdirect//process.php?command=get&p1=schedule&p2=11299

This tells us that channel 2, callsign "WBBM", stationid 11299 has a URL of
http://localhost/schedulesdirect//process.php?command=get&p1=schedule&p2=11299

The URL is generated by the server; do not cache the URL.

The grabber will download all schedules. If you do not want the grabber to
download a channel, put a "#" as the first character, or delete the line.

Lineup management is now the responsibility of the application. If a
provider has a custom lineup type, such as a digital terminal adapter, then
it is up to the application to allow the user to create a lineup called
"DTA" and specify which channels are in that lineup, possibly using the
information obtained from the "X" lineup and performing local re-mapping of
channel numbers.

Each channel will have 14 days of data.

The schedule file for a channel will be in the format stationid_txt.gz
This file is in JSON format.

File 11299_sched.txt.gz contains:
#Schedule
{
   "subject_to_blackout" : false,
   "educational" : false,
   "joined_in_progress" : false,
   "left_in_progress" : false,
   "net_syn_source" : "0",
   "part_num" : "0",
   "sex_rating" : false,
   "cc" : true,
   "stereo" : true,
   "new" : false,
   "cable_in_the_classroom" : false,
   "duration" : "00:30:00",
   "dialog_rating" : false,
   "num_parts" : "0",
   "enhanced" : true,
   "dolby" : "",
   "live_tape_delay" : "",
   "hdtv" : false,
   "premiere_finale" : "",
   "tv_rating" : "",
   "prog_id" : "EP014198720014",
   "fv_rating" : true,
   "net_syn_type" : "",
   "violence_rating" : false,
   "letterbox" : false,
   "lang_rating" : false,
   "air_date" : "2012-04-03",
   "dvs" : false,
   "air_time" : "00:00:00",
   "3d" : false,
   "time_approximate" : false
}

(etc) for all schedule entries, then:

#ProgramDetails
{
   "reduced_descr1" : "From Tulsa, Okla.",
   "reduced_descr3" : "From Tulsa, Okla.",
   "made_for_tv" : false,
   "descr_500" : "",
   "reduced_descr2" : "From Tulsa, Okla.",
   "reduced_title2" : "Auto Racing",
   "reduced_title4" : "Auto Rac'g",
   "modified" : "2012-04-03 08:41:57",
   "descr" : "From Tulsa, Okla.",
   "color_code" : "Color",
   "epi_title" : "Lucas Oil Chili Bowl Nationals",
   "title" : "Auto Racing",
   "md5" : "VfN+D44r4HvxKDLlBknSog",
   "alt_title" : "",
   "orig_air_date" : "2012-04-14",
   "descr2" : "From Tulsa, Okla.",
   "descr2_reduced" : "From Tulsa, Okla.",
   "descr_lang_id" : "English",
   "reduced_title1" : "Auto Racing",
   "source_type" : "Network",
   "prog_id" : "EP000004469512",
   "reduced_title3" : "Auto Racing",
   "alt_syn_epi_num" : "",
   "show_type" : "Series",
   "syn_epi_num" : ""
}

Each schedule file will contain a single ProgramDetails object, even if that
particular program is shown multiple times in the 14 day time period.
Something went wrong with that request. Please try again.