瀏覽代碼

Derive the filename from the caption.

parisminton 7 年之前
父節點
當前提交
493ad872ac
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 2 1
      client/index.js
  2. 2 2
      client/video.js

+ 2 - 1
client/index.js 查看文件

@@ -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 查看文件

@@ -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)