Skip to content

Commit

Permalink
Add descriptions and infoUrls where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine Emrich committed Mar 30, 2017
1 parent 2f1c22e commit bef0903
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions downloader/ard-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ exports.channelIds = [
let runningPromise = null;

function parseShows(showData, showObj) {
let infoLine = showData.SPAN[1]._.trim();
let infoLine = showData.IMG[0].SPAN[1]._.trim();
let channels = infoLine.split('|').map((s) => s.trim());
let times = channels.pop().split(/ - | /).map((s) => s.trim());

let show = new Show(showData.B[0]);
let show = new Show(showData.IMG[0].B[0]);
show.infoUrl = 'http://programm.ard.de' + showData.$.HREF;
show.startTime = moment.tz(times[0], 'HH:mm', 'Europe/Berlin');
show.endTime = moment.tz(times[1], 'HH:mm', 'Europe/Berlin');
show.fixMidnightTime();
Expand Down Expand Up @@ -88,7 +89,7 @@ function getAllShows(xml) {
.then(data => {
let showObj = {};
for (let item of data.ROOT.LI) {
parseShows(item.A[0].IMG[0], showObj);
parseShows(item.A[0], showObj);
}
return Promise.resolve(showObj);
});
Expand Down
1 change: 1 addition & 0 deletions downloader/dw-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports.channelIds = ['deutsche_welle'];

function parseShow(showJson, channelId) {
let show = new Show(showJson.name);
show.description = showJson.programDescription;
show.channel = channelId;
show.subtitle = showJson.description;
show.startTime = moment(showJson.startDate);
Expand Down
1 change: 1 addition & 0 deletions downloader/parliament-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports.channelIds = ['parlamentsfernsehen_1', 'parlamentsfernsehen_2'];

function parseShow(showData, channelId) {
let show = new Show(showData.langtitel[0]);
show.description = showData.infos[0] || null;
show.channel = channelId;
show.startTime = moment(showData.anfangUnix * 1000);
show.endTime = moment(showData.endeUnix * 1000);
Expand Down
1 change: 1 addition & 0 deletions downloader/zdf-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function getShow(json, channelId) {

let show = new Show(broadcast.title);
show.subtitle = broadcast.subtitle;
show.description = broadcast.text;
show.channel = channelId;
show.startTime = moment(broadcast.airtimeBegin);
show.endTime = moment(broadcast.airtimeEnd);
Expand Down
2 changes: 2 additions & 0 deletions models/Show.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class Show {

clone() {
let show = new Show(this.title);
show.description = this.description;
show.channel = this.channel;
show.subtitle = this.subtitle;
show.infoUrl = this.infoUrl;
show.startTime = this.startTime;
show.endTime = this.endTime;
return show;
Expand Down

0 comments on commit bef0903

Please sign in to comment.