Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

Parser for XMLTV format and SchedulesDirect data

Posted by bcmoney on September 25, 2011 in JavaScript, PHP, Web Services, XML with 2 Comments


No Gravatar
EPG

Image via Wikipedia

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.

 

  1. TheOnlyOakleyJune 4, 2013 - 10:12 am #1

    Yeah Apple and Google could use this basic TV Guide lookup service to integrate better to your existing TV subscription for customers of their devices. It just doesn’t make financial sense to switch to Apple TV or Google TV yet until they can really determine what type of content will be interesting to you amongst the things you already pay for access to. Otherwise its just useless hardware with not much more to offer than what a laptop screen extended to a TV as a second monitor can. Their idea is clearly to lock clients into the continued requirement to use Apple (or Google) devices and services to get access to the content they previously bought, and pay over-and-over again for access to whats already owned.

    Reply
  2. Rey BlancheOctober 7, 2013 - 5:56 am #2

    Magnificent posts from you, man. I have found it easy to understand your tech talks stuff and you are just extremely magnificent at getting information across. I actually like what you have acquired and shared with the readers here, really like what you’re saying and the way in which you say it.

    You make it entertaining and you still care enough for your readers to keep technical stuff sensible. I cant wait to read much more from you. This is actually a terrific site.

    Reply
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.

  • Archives

  • Switch to our mobile site