booksnew/tools/getsrss.js
2015-07-15 14:15:01 +01:00

107 lines
2.2 KiB
JavaScript

var brand,pid, title, short_synopsis, maintitle, subtitle;
function getJSONfeed(feedurl,feedid){
var xmlhttp= WScript.createobject("Msxml2.XMLHTTP.3.0");
xmlhttp.open( "GET", feedurl, false);
xmlhttp.send();
var rssJSON_Data = eval ("(" + xmlhttp.responseText +")");
brand = rssJSON_Data.schedule.service.title
WScript.Echo(brand);
var broadcasts = rssJSON_Data.schedule.day.broadcasts;
for (var i = 0; i < broadcasts.length; i++)
{
if (broadcasts[i].programme.pid == feedid){
p = broadcasts[i].programme.pid;
title = broadcasts[i].programme.title;
short_synopsis = broadcasts[i].programme.short_synopsis;
maintitle = broadcasts[i].programme.display_titles.title;
subtitle = broadcasts[i].programme.display_titles.subtitle;
}
}
}
function iTunes(){
var iTunesApp = WScript.CreateObject("iTunes.Application");
var mainLibrary = iTunesApp.LibraryPlaylist;
}
function GatherRSS(){
feedurl = "http://www.bbc.co.uk/6music/programmes/schedules/today.json";
// feedurl = "http://www.bbc.co.uk/radio3/programmes/schedules/today.xml"
feedid = "b00j3hkg"; // marc
// feedid = "b00j3hxw"; // radio 6 - sixmusic plays it again
// feedid = "b00j15yw"; // radio 3 classical collection
// feedid = "b00j15z6"; // radio 3 performance on 3
getJSONfeed(feedurl,feedid);
}
WScript.Echo("RSS Updater");
GatherRSS();
var d = new Date();
//now.format("m/dd/yy").toString;
//var workDate = d.getFullYear().tostring + (d.getMonth()+1).tostring + d.getDate().tostring;
var workDate = d.getFullYear().toString()+ (d.getMonth()+1).toString() + d.getDate().toString();
WScript.Echo(workDate);
brand,pid, title, short_synopsis, maintitle, subtitle
var detailsJSONObject = {"feedid": "", "brand": "", "pid": "", "title": "", "short_synopsis":"", "maintitle:":"", "subtitle":"", "gfxdir":"","mp3file":""};
detailsJSONObject.feedid = feedid;
detailsJSONObject.brand = brand;
detailsJSONObject.pid = pid;
detailsJSONObject.title = title;
detailsJSONObject.short_synopsis = short_synopsis;
detailsJSONObject.maintitle = maintitle;
detailsJSONObject.subtitle = subtitle;
detailsJSONObject.gfxdir = "c:\\tools\\gfx";
detailsJSONObject.mp3file = "c:\\tools\\gfx";
WScript.Echo(detailsJSONObject.gfxdir);