Error processing SSI file
Error processing SSI file

Home » Development Area » Listings Grabber » API Index » API Contents

Summary

Each grabber created is automatically registered with the system. Creating a grabber means it will appear in the Add New list.

var g = new Grabber( "test grabber", "GBR" );

When the user selects to run a javascript grabber the grabber event onRun is called. From here the grabber can use the full list of APIs.

Below is a simple example of a grabber that adds a new channel and then adds a few programmes into the channel. It also has a simple use of the progress bar and a system function.

g.onRun = function( lp )
{
lp.writeLog( "Hello from " + this.name + " grabber, data files are located in " + this.dataFolder + "\r\n\r\n" );

var ch = new CustomChannel;
ch.name = "My Test Channel"
ch.epg = "123"
ch.categoryName = "Sports"
ch.logoURL = "http://www.digiguide.com/i/nav/banner_gradient.gif"
lp.addChannel( ch );


var p = new CustomProgramme;
var dt = new Date;
var dtOAD = new Date( 1980, 10, 10 );
for( var n = 0; n < 10 && !lp.hasCancelBeenPressed(); n++ )
{
lp.setProgress( "Adding programmes", n, 10 );
system.sleep( 1000 );

p.reset();
p.channelName = ch.name;
p.name = "New Test " + n;
p.episodeTitle = "Episode title";
p.startUTC = dt
p.duration = 60;
p.description = "Description";
p.directors = "Dan, Russ, Martin";
p.cast = "Martin, Dan, Russ";
p.certificate = "15";
p.qualifiers = "stereo";
p.keywords = "western, sci-fi";
p.category = "film";
p.year = 1982;
p.rating = 5
p.originalAirDate = dtOAD;
p.runTimeMins = 125;
p.grabberName = this.name;
lp.addProgramme( p );

dt.setTime( dt.getTime() + 60*60*1000 );
}
return true;
}

View the API Index

(Last updated: September 25, 2007 16:10:34)

Error processing SSI file