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,6 +116,7 @@ function submitted() {
116 116
 }
117 117
 
118 118
 function poll(id) {
119
+  var identifier = preview.caption().replace(/\s+/g, '_').replace(/\'|\"|\.|\?|\!/g, '').toLowerCase().slice(0, 20);
119 120
 
120 121
   setTimeout(function(){
121 122
     $.ajax({
@@ -124,7 +125,7 @@ function poll(id) {
124 125
       dataType: "json",
125 126
       success: function(result){
126 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 129
           setClass("rendered");
129 130
         } else if (result.status === "error") {
130 131
           error(result.error);

+ 2 - 2
client/video.js View File

@@ -15,8 +15,8 @@ function kill() {
15 15
 
16 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 21
   d3.select("#download")
22 22
     .attr("download", filename)