Parser for XMLTV format and SchedulesDirect data
For a long time now, I’ve been a paying customer of SchedulesDirect, and by that token their parent company Zap2it (now a Tribune Media Services company).
Recently, I’ve started publishing my own personal Electronic Programming Guide (EPG) here on BCmoney MobileTV in an accessible format:
BC$ EPG
One of the secondary goals of my MobileTV project has always been to be able to provide all XMLTV users a venue to easily access and conveniently plan/schedule their TV viewing via the web, on a variety devices (i.e. mobiles/tablets/desktop computers).
Soon I’ll be adding in a User Management feature that allows you to signup for SchedulesDirect and synch your account through BC$, and most importantly, protect your EPG and viewing data by your username and password (this is required to meet the SchedulesDirect usage terms and privacy policy).
I found that GET requests are not supported so technically the Tribune Web Service must still be following the SOAP 1.1 not SOAP 1.2 standard which specifies both GET and POST are acceptable as long as the SOAP request enveloppe is passed via URL.
Since that is not supported, you have to use POST and it also has to have the BASIC authentication information included in the header in the exact pattern:
Authorization: BASIC xxxxxxxxxxxxxxxxxxxxxxxxx
where:
xxxxxxxxxxxxxxxxxxxx = base64encoded(username:password)
Don’t forget the semicolon as a string in between the username and password (like I did at first)!
Before any programming, try debugging using a SOAP tool… it DEFINITELY helps save sanitiy. I got it working using SOAP UI: http://soapui.org/
You need to do the following in SOAP UI:
- File –> New SoapUI Project
- Name it “SchedulesDirect” or something the like…
- Paste in the WSDL location “http://docs.tms.tribune.com/tech/tmsdatadirect/schedulesdirect/tvDataDelivery.wsdl”
- Check “Create TestSuite” and “TestCase”
- Expand the project, Under “xtvdBinding” there should be a “download” Web Service call stub, expand that and open Request 1
- Click the little “Auth” tab at the bottom of the Request window (easy to miss… look down next to “Headers” and “Attachments” tabs)
- Enter your SchedulesDirect username and password, then click the little green “Run” arrow at the top left of the Request window
With the initial testing out of the way as a “sanity check” on your SchedulesDirect account, you can now get started on the coding.
TMS Direct Download script
In the meantime, here’s a modified version of “tmsfetch.php” which was initially provided by SchedulesDirect as one of the official examples:
<?php
$username='username';
$password='password';
$wsdl_url='http://docs.tms.tribune.com/tech/tmsdatadirect/schedulesdirect/tvDataDelivery.wsdl';
$start=gmdate("Y-m-dTH:i:sZ",time()); //today
$stop =gmdate("Y-m-dTH:i:sZ",time()+3600*24); //tomorrow (now + 24hrs)
$client = new SoapClient($wsdl_url, array('exceptions' => 0,
'user_agent' => "php/".$_SERVER[SCRIPT_NAME],
'login' => strtolower($username),
'password' => $password));
$data = $client->download($start,$stop);
print_r($data);
?>
-or-
Conclusion
This script provides a basic way of downloading TV data in Tribune Media Services (TMS) format. It can even provide a translation into XMLTV format (which is slightly different than TMS, but conveys all the same data); however, it won’t help much with the display of the data on the front-end. For that, I would suggest looking into one of the approved applications for actually viewing your XMLTV listings in the familiar grid/list styled EPG. While most of the software there is designed to run on the desktop, I would highlight XSLTV for web-based applications. There is not yet a mobile-friendly XMLTV application but stay tuned for my new jQuery plugin (not yet available), which should hopefully be compatible with jQuery Mobile.
Related articles
- Email Reader (dustycodes.wordpress.com)
- I feel the need…the need for JSON parsing correctness and speed! (whereswalden.com)
- Facebook’s Timeline is nothing but a LAZY and BLUNT marketing data parser (gubatron.com)
- Why is JSON so popular? Developers want out of the syntax business (mongolab.com)
- Facebook Graph API with Drupal Feeds (darrenmothersele.com)
- 36 New APIs: Cloud-Based Video Encoding, Fotomoto, RealGravity (programmableweb.com)

Leave a Reply
No trackbacks yet.
Posts with similar tags
Posts in similar categories
BC$ = Behavior, Content, Money
The goal of the BC$ project is to raise awareness and make changes with respect to the three pillars of information freedom - Behavior (pursuit of interests and passions), Content (sharing/exchanging ideas in various formats), Money (fairness and accessibility) - bringing to light the fact that:
1. We regularly hand over our browser histories, search histories and daily online activities to companies that want our money, or, to benefit from our use of their services with lucrative ad deals or sales of personal information.
2. We create and/or consume interesting content on their services, but we aren't adequately rewarded for our creative efforts or loyalty.
3. We pay money to be connected online (and possibly also over mobile), yet we lose both time and money by allowing companies to market to us with unsolicited advertisements, irrelevant product offers and unfairly structured service pricing plans.

iFrames, love them or hate them they are all over the web.
When used properly...
Well, I've decided to give this one away in the title, since the good folks over at Ch...
With the real, true and unbiased news inevitably moving online towards the so-called "Alternative Media" (which really is almost reaching the point where it is not alternative so much as the first go-to source), its a good idea to start replicating some of the most useful elements from Television, Print and Radio (aka. the rest...
Image via Wikipedia
Title: BCmoney MobileTV turns 1 YEAR OLD!!!
Location: Worldwide
Description: It is the 1-year anniversary of the Public Beta launch of BCmoney MobileTV.
Technically speaking, the official 1-year birthday of the founding of BCmoney as a business on December 17th, 2007 already passed; however the actual public beta launch of the BCmoney MobileTV...
BCmoney MobileTV was invited to present in Toronto at the year-ending MobileMonday event for 2008 (June 9th, 2008 at DuneDain Media).
The presentation, will be split into two halves. The first half will serve as an introduction to the Japanese Mobile Ecosystem with a focus on Mobile TV, while the second half will contrast the Japanese...
The ALPHA version of SkipSearch has been released!!!
SkipSearch is a proprietary front-end to OpenRecommender, an open source recommendation engine. Its primary features include:
Easy-to-use Interface with hover-intent to reduce clicks, audio controls & shortcuts
Lightweight HTML5 / CSS3 layout
Mobile-friendly, responsive design
Schema.org properties and support for RDFa/Microformats
Import data from multiple accounts (Google/Yahoo/Microsoft/Twitter/Facebook/LinkedIN/Last.FM/StumbleUpon and other social media account integration)
Export functionality...
It is with great humility and gratitude that I announce that I have finished in the Top 10 of the Mintchip Challenge with my proposed application and idea that "A digital currency can be used for P2P barter and micropayments".
You can see the full list of finalists in the Mintchip Challenge here:
http://ideas.mintchipchallenge.com/
There were really some...
Here's an explanation of what we have today, followed by a Use-Case for my idea...
TODAY:
1. Person A is a farmer who has worked hard all season and is ready for harvest of their crops. For simplicity's sake, let's call him the "Seller", since the next step will be to sell their produce. For that they...
Since the February confirmation of the Facebook IPO, Facebook has continued to stagnate in user-base yet as an organization it holds no punches as it attempts to grow internationally, and its stock price continues to soar as Class A shares finally open up to the average person (major investment firms had first dibs at the...
The Royal Canadian Mint(RCM) has sponsored the MintChip Challenge 2012 in an effort to attract developers to the idea of developing software for the MintChip and giving away their best financial application ideas, basically, for free (on the long-shot that you are one of the few who win).
Starting April 1st, 2012, they began mailing out...
Popcorn.js is an incredibly useful framework for adding timing-based events and/to Semantic metadata to rich content.
According to Mozilla: "Popcorn makes video work like the web. We create tools and programs to help developers and authors create interactive pages that supplement video and audio with rich web content, allowing your creations to live and grow online."
With...
Social media has taken over the web (for now) and the name of the game is sharing, something legislation like SOPA and PIPA just didn't seem to understand. Rather than figuring out a new economic model based on the reality of sharing on the web, that rewards this type of activity (which is essentially just...
iScroll 4 is the latest version and release of an excellent content slider-type JavaScript component by Matteo Spinelli. While one may argue that content sliders are a dime a dozen, iScroll differs in the fact that it has full support for all the main WebKit for iOS gestures including pinch/zoom, pull-up/pull-down, smooth scrolling and screen...
This is a post to announce the ALPHA release of OpenRecommender, version 1.0.
Have you ever wondered if there was a better way to find information on the web? Before today, there has been lots of ways from targeted search to surfing aimlessly, or from social sharing via SNS platforms like Facebook or Google+ to required...