Listocracy
Introduction
Trying to find television listing data has been a long process. Currently there are no free and open solutions for finding television listing data in the United States. Schedules Direct offers open formated television listings for only $20 a year. We fully support that (more legit) option if your project needs something a little more concrete.
Requirements
listocracy is a set of PHP functions that can find a list of television providers based on a zip code, and then produce an array of television listing data. listocracy's only requirement is that PHP needs to have the Curl extension installed.
Functions
mixed get_providers( zipcode )
This function takes any five digit zip of postal code. It then returns an array of available television providers with the provider id and the provider name. With an invalid zip code this function returns false.
array get_listing_grid( provider_id )
When passed a provider (which can be found by the previous function) it will return an array of the formated television listing data. Currently there is information available for the next three hours only. Each channel is broken up into a channel array with information specific to the actual channel and a shows array where each show's information is contained.
Array ( [channel] => Array ( [number] => 4 [icon] => nbc_affiliate.gif [id] => 11705 [name] => WNBC ) [shows] => Array ( [0] => Array ( [desc] => [genre] => Soap [title] => Days of our Lives [length] => 60 [time] => 1201204800 ) [1] => Array ( [desc] => [genre] => Reality [title] => Judge Joe Brown [length] => 30 [time] => 1201205700 ) [2] => Array ( [desc] => [genre] => Reality [title] => Judge Joe Brown [length] => 30 [time] => 1201206150 ) )
Issues
As of 0.1.0 the basic functionality is there. Currently there needs to be some better error checking. While times are output as a Unix timestamp, they may not be accurate depending on the time zone of the zip code, and the time zone of the server the script is on. Please report any of these in the isssues tab.
Todo
Grid data is only available for three hours in the future. Extra information about the show including if HD is avaible or whether the episode is new is available but not currently exported.