diff --git a/scripts/fahrplan_download.js b/scripts/fahrplan_download.js index 71a60748f..dce899354 100755 --- a/scripts/fahrplan_download.js +++ b/scripts/fahrplan_download.js @@ -141,7 +141,8 @@ function Spider() { this.see('/schedule/' + conference_id + '/index.de.html'); } -var normalizePath = function(path, from) { +/* link to download location */ +function normalizePath(path, from) { from = from || 'https://cccv.pentabarf.org/'; var uri = URL.parse(URL.resolve('https://cccv.pentabarf.org/', path)); if (uri.hostname !== 'cccv.pentabarf.org') @@ -149,11 +150,12 @@ var normalizePath = function(path, from) { return uri.pathname; }; -var manglePath = function(path) { +/* link rewriting for xhtml files */ +function manglePath(path) { var m; - if ((m = path.match(/^\/schedule\/\d+\/(.+)$/))) + if ((m = path.match(/^\/schedule\/\d+\/(.+)$/))) { return baseDir + '/' + m[1]; - else if ((m = path.match(/^\/(xml|ical|xcal)\/(schedule|conference)\/\d+/))) { + } else if ((m = path.match(/^\/(xml|ical|xcal)\/(schedule|conference)\/\d+/))) { var ext; switch(m[1]) { case 'ical': @@ -166,6 +168,10 @@ var manglePath = function(path) { ext = m[1]; } return baseDir + '/schedule.' + ext; + } else if ((m = path.match(/datenspuren\.de\/fahrplan\/(.*)$/))) { + var f = m[1]; + f = f.replace(/day_(.+)\.html/, 'day/$1.html'); + return '/fahrplan/' + f; } else if (path.indexOf('://') >= 0) return path; else