Browse Source

Derive the filename from the caption.

parisminton 7 years ago
parent
commit
493ad872ac
2 changed files with 4 additions and 3 deletions
  1. 2 1
      client/index.js
  2. 2 2
      client/video.js

+ 2 - 1
client/index.js View File

116
 }
116
 }
117
 
117
 
118
 function poll(id) {
118
 function poll(id) {
119
+  var identifier = preview.caption().replace(/\s+/g, '_').replace(/\'|\"|\.|\?|\!/g, '').toLowerCase().slice(0, 20);
119
 
120
 
120
   setTimeout(function(){
121
   setTimeout(function(){
121
     $.ajax({
122
     $.ajax({
124
       dataType: "json",
125
       dataType: "json",
125
       success: function(result){
126
       success: function(result){
126
         if (result && result.status && result.status === "ready" && result.url) {
127
         if (result && result.status && result.status === "ready" && result.url) {
127
-          video.update(result.url, preview.theme().name);
128
+          video.update(result.url, identifier);
128
           setClass("rendered");
129
           setClass("rendered");
129
         } else if (result.status === "error") {
130
         } else if (result.status === "error") {
130
           error(result.error);
131
           error(result.error);

+ 2 - 2
client/video.js View File

15
 
15
 
16
 function update(url, name) {
16
 function update(url, name) {
17
 
17
 
18
-  var timestamp = d3.timeFormat(" - %Y-%m-%d at %-I.%M%p")(new Date).toLowerCase(),
19
-      filename = (name || "Audiogram") + timestamp + ".mp4";
18
+  var timestamp = d3.timeFormat("%m%d%y_AG_")(new Date).toLowerCase(),
19
+      filename = timestamp + (name || "Audiogram") + ".mp4";
20
 
20
 
21
   d3.select("#download")
21
   d3.select("#download")
22
     .attr("download", filename)
22
     .attr("download", filename)