Interactive interface for browsing global, full-resolution satellite imagery
WV-423: Wget now done in a similar fashion to curl
Mike McGann4730afc38ada
diff --git a/etc/ant/js.build.xml b/etc/ant/js.build.xmlindex 0038a1105..f25f44bb0 100644--- a/etc/ant/js.build.xml+++ b/etc/ant/js.build.xml@@ -149,8 +149,7 @@<file name="js/Worldview/DataDownload/MapController.js"/><file name="js/Worldview/DataDownload/SelectionListPanel.js"/><file name="js/Worldview/DataDownload/DownloadListPanel.js"/>- <file name="js/Worldview/DataDownload/WgetPage.js"/>- <file name="js/Worldview/DataDownload/CurlPage.js"/>+ <file name="js/Worldview/DataDownload/BulkDownloadPage.js"/><file name="js/Worldview/Widget/Map.js"/><file name="js/Worldview/Widget/Palette.js"/>diff --git a/src/index.html b/src/index.htmlindex 33cbb60fa..ab5e8d108 100644--- a/src/index.html+++ b/src/index.html@@ -215,8 +215,7 @@<!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/MapController.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/SelectionListPanel.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/DownloadListPanel.js"></script>- <!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/WgetPage.js"></script>- <!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/CurlPage.js"></script>+ <!-- link.dev --> <script type="text/javascript" src="js/Worldview/DataDownload/BulkDownloadPage.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Map.js"></script><!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Palette.js"></script>diff --git a/src/js/Worldview/DataDownload/CurlPage.js b/src/js/Worldview/DataDownload/BulkDownloadPage.jssimilarity index 76%rename from src/js/Worldview/DataDownload/CurlPage.jsrename to src/js/Worldview/DataDownload/BulkDownloadPage.jsindex 8d258bd30..41f228acb 100644--- a/src/js/Worldview/DataDownload/CurlPage.js+++ b/src/js/Worldview/DataDownload/BulkDownloadPage.js@@ -10,19 +10,24 @@*/Worldview.namespace("DataDownload");-Worldview.DataDownload.CurlPage = (function() {+Worldview.DataDownload.BulkDownloadPage = (function() {var ns = {};- ns.show = function(selection) {- var page = window.open('pages/curl.html', 'Worldview_' + new Date());+ var pages = {+ wget: "pages/wget.html",+ curl: "pages/curl.html"+ };++ ns.show = function(selection, type) {+ var page = window.open(pages[type], 'Worldview_' + new Date());page.onload = function() {- fillPage(page, selection);+ fillPage(page, selection, type);};};- var fillPage = function(page, selection) {- var commands = [];+ var fillPage = function(page, selection, type) {+ var downloadLinks = [];var hosts = {};var indirectLinks = [];$.each(selection, function(index, product) {@@ -40,7 +45,12 @@ Worldview.DataDownload.CurlPage = (function() {link.href + "</a></li>");return;}- commands.push("curl --remote-name " + netrc + link.href);+ if ( type === "curl" ) {+ downloadLinks.push("curl --remote-name " + netrc ++ link.href);+ } else {+ downloadLinks.push(link.href);+ }if ( granule.urs ) {// Get the hostname from the URL, the text between// the double slash and the first slash after that@@ -52,8 +62,8 @@ Worldview.DataDownload.CurlPage = (function() {});});});- page.document.getElementById("commands").innerHTML =- "<pre>" + commands.join("\n") + "</pre>";+ page.document.getElementById("links").innerHTML =+ "<pre>" + downloadLinks.join("\n") + "</pre>";var netrcEntries = [];$.each(hosts, function(host, value) {diff --git a/src/js/Worldview/DataDownload/DownloadListPanel.js b/src/js/Worldview/DataDownload/DownloadListPanel.jsindex 1ac20493b..4c3254508 100644--- a/src/js/Worldview/DataDownload/DownloadListPanel.js+++ b/src/js/Worldview/DataDownload/DownloadListPanel.js@@ -268,11 +268,11 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {};var showWgetPage = function() {- Worldview.DataDownload.WgetPage.show(selection);+ Worldview.DataDownload.BulkDownloadPage.show(selection, "wget");};var showCurlPage = function() {- Worldview.DataDownload.CurlPage.show(selection);+ Worldview.DataDownload.BulkDownloadPage.show(selection, "curl");};return self;diff --git a/src/pages/curl.html b/src/pages/curl.htmlindex fafe0c0ab..87a319568 100644--- a/src/pages/curl.html+++ b/src/pages/curl.html@@ -8,7 +8,7 @@<body><div id='page'><h3>Download Commands</h3>- <div id="commands"></div>+ <div id="links"></div><div id="netrc-header">Some download links require a URS account. Use the followingnetrc entries and follow the instructions below.diff --git a/src/pages/wget.html b/src/pages/wget.htmlindex e33c736f6..33f329b6d 100644--- a/src/pages/wget.html+++ b/src/pages/wget.html@@ -1,117 +1,54 @@<!doctype html>-<html>+<html id="BulkDownload"><head>- <title>wget.html</title>- <style>- body {- background-color: rgb(25, 28, 32);- }- h3 {- margin-top: 0;- }- h4 {- margin-bottom: 0- }- #page {- background-color: #ffffff;- margin: 20px;- padding: 20px;- border-radius: 5px;- }- pre {- background-color: #eeeeee;- padding: 5px;- border: 1px dashed #dddddd;- }- .label {- margin-top: 10px;- font-style: italic;- color: #808080;- }- </style>--<script>-var productText = function(product) {- var html = [];- html.push("<h4>" + product.name + "</h4>");- if ( product.noBulkDownload ) {- html.push("<p>" +- "These granules are not available for bulk download. " +- "Please visit each link and download manually." +- "</p>");- }- for ( var i = 0; i < product.list.length; i++ ) {- var item = product.list[i];- // Don't print twice if the item and product names are the same.- if ( item.label !== product.name ) {- html.push("<div class='label'>" + item.label + "</div>");- }- for ( var j = 0; j < item.links.length; j++ ) {- var link = item.links[j];- if ( !product.noBulkDownload ) {- html.push(- "<div>" +- "<a href='" + link.href + "'>" + link.href + "</a>" +- "</div>"- );- } else {- html.push(- "<div class='label'>" +- link.href +- "</div>"- );- }- }- }- return html.join("\n");-};--window.onload = function() {- var div = document.getElementById("list");- if ( div.innerHTML !== "" ) {- return;- }- var html = [];- var storage = localStorage.wget;- if ( !storage ) {- return;- }- var selection = JSON.parse(storage);- for ( var product in selection ) {- html.push(productText(selection[product]));- }- div.innerHTML = html.join("\n");-};-</script>-+ <title>EOSDIS Worldview - Download Links</title>+ <link type="text/css" href="../css/bulkDownload.css" rel="Stylesheet" /></head>+<body><div id='page'>- <div id='instructions'>- <h3>Using <code>wget</code> to Bulk Download Your Data</h3>- 1) Save this HTML page as <code>wget.html</code> to your- local computer <b>using your browser's "Web Page, Complete"- format</b>.<br/>+ <h3>Download Links</h3>+ <div id="links"></div>+ <div id="netrc-header">+ Some download links require a URS account. Use the following+ netrc entries and follow the instructions below.+ </div>+ <div id="netrc"></div>+ <h3>Using <code>wget</code> to Bulk Download Your Data</h3>+ <div id="netrc-instructions">+ <p>+ Add the netrc entries listed above to the following file:+ <ul>+ <li>Windows: <code>_netrc</code> file found in your home+ folder.+ </li>+ <li>+ Mac or Linux: <code>.netrc</code> file found in your+ home directory.+ </li>+ </ul>+ Replace <code>URS_USER</code> with your URS user name and+ <code>URS_PASSWORD</code> with your URS password. If this file does+ not exist, create a new one. Ensure that your are the only+ one that can read this file.+ </p>+ </div>++ <p>+ 1) Copy the links above and paste into a text document+ save it as "links.txt"<br/>2) Execute the following command to download all of your- requested files:- <pre>-wget --input-file=wget.html --force-html</pre>- Due to the way Safari saves web pages, this feature is not- supported in that web browser.<br/><br/>- <b>Note:</b> If User Registration System (URS) credentials are required,- create a file (only readable by you) called- <code>urs.credentials</code> with the following:- <pre>-user=<i>urs_user</i>-password=<i>urs_password</i></pre>- where <i>urs_user</i> is your URS user name and- <i>urs_password</i> is your URS password. To download,- use the following command instead of step 2 above:+ requested files:<pre>-wget --input-file=wget.html --force-html --config=urs.credentials</pre><br/>+wget --input-file=links.txt</pre>+ </p>+ <div id="indirect-instructions">+ Some items that you have selected do not directly link to a+ data file. Visit the following links and manually download each+ data file:+ </div>+ <div id="indirect"></div>- <div id='list'></div></div></body></html>-