|
|
@@ -287,7 +287,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
287
|
287
|
}
|
|
288
|
288
|
#endregion
|
|
289
|
289
|
|
|
290
|
|
- #region 保存原文件到本地指定目录
|
|
|
290
|
+ #region 保存原文件到项目中
|
|
291
|
291
|
string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
|
|
292
|
292
|
if (!System.IO.Directory.Exists(Server.MapPath(this.Request.ApplicationPath + "/auoupload/")))
|
|
293
|
293
|
{
|
|
|
@@ -297,7 +297,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
297
|
297
|
_upFile.SaveAs(physicalpath);
|
|
298
|
298
|
#endregion
|
|
299
|
299
|
|
|
300
|
|
- #region 修改音频格式
|
|
|
300
|
+ #region 修改音频格式并保存新文件到指定目录中和项目中
|
|
301
|
301
|
if (!string.IsNullOrEmpty(physicalpath))
|
|
302
|
302
|
{
|
|
303
|
303
|
# region 修改音频格式
|
|
|
@@ -311,17 +311,29 @@ namespace CallCenterApi.Interface.Controllers
|
|
311
|
311
|
p.StartInfo.CreateNoWindow = true;
|
|
312
|
312
|
|
|
313
|
313
|
string temp_filename = physicalpath.Split('\\').Last().Split('.')[0] + "_temp";
|
|
|
314
|
+ string path1 = this.Request.ApplicationPath + "/auoupload/";
|
|
|
315
|
+ string physicalpath1 = Server.MapPath(path1);
|
|
314
|
316
|
|
|
315
|
317
|
p.Start();
|
|
316
|
318
|
p.StandardInput.WriteLine("cd " + ffmpegLocation);
|
|
317
|
319
|
p.StandardInput.WriteLine(ffmpegLocation.Split('\\').First());
|
|
318
|
320
|
p.StandardInput.WriteLine("ffmpeg.exe");
|
|
319
|
321
|
string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + savedir + temp_filename + ".wav";
|
|
|
322
|
+ string changefile1 = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + physicalpath1 + temp_filename + ".wav";
|
|
320
|
323
|
p.StandardInput.WriteLine(changefile);
|
|
|
324
|
+ p.StandardInput.WriteLine(changefile1);
|
|
|
325
|
+ while (true)
|
|
|
326
|
+ {
|
|
|
327
|
+ if (System.IO.File.Exists(physicalpath1 + temp_filename + ".wav"))
|
|
|
328
|
+ break;
|
|
|
329
|
+ }
|
|
321
|
330
|
Thread.Sleep(3000);
|
|
322
|
331
|
p.StandardInput.WriteLine("exit");
|
|
|
332
|
+ //p.WaitForExit();//等待程序执行完退出进程
|
|
|
333
|
+ p.Close();//关闭进程
|
|
323
|
334
|
//Kill 是终止没有图形化界面的进程的唯一方法。
|
|
324
|
|
- p.Kill();
|
|
|
335
|
+ p.Dispose();//释放资源
|
|
|
336
|
+ //p.Kill();
|
|
325
|
337
|
#endregion
|
|
326
|
338
|
#region 上传
|
|
327
|
339
|
uploadFile upfile = new uploadFile();
|
|
|
@@ -334,7 +346,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
334
|
346
|
upfile.ftpUserID = _acc;
|
|
335
|
347
|
upfile.ftpPassword = _pwd;
|
|
336
|
348
|
//20180207 原文件同时保存
|
|
337
|
|
- string uploadres = upfile.UploadLocalToFtp(savedir + temp_filename + ".wav");
|
|
|
349
|
+ string uploadres = upfile.UploadLocalToFtp(physicalpath1 + temp_filename + ".wav");
|
|
338
|
350
|
string uploadBeforres = upfile.UploadLocalToFtp(physicalpath);
|
|
339
|
351
|
if (uploadres == "上传成功!" && uploadBeforres == "上传成功!")
|
|
340
|
352
|
{
|
|
|
@@ -350,7 +362,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
350
|
362
|
|
|
351
|
363
|
|
|
352
|
364
|
//删除本地文件
|
|
353
|
|
- System.IO.File.Delete(savedir + fullFileName);
|
|
|
365
|
+ //System.IO.File.Delete(savedir + fullFileName);
|
|
354
|
366
|
System.IO.File.Delete(savedir + temp_filename + ".wav");
|
|
355
|
367
|
//System.IO.File.Delete(physicalpath);
|
|
356
|
368
|
var obj = new
|