|
|
@@ -31,11 +31,13 @@ namespace CallCenterApi.Interface.Controllers
|
|
31
|
31
|
string fullFileName = datename + "_" + _upFile.FileName;
|
|
32
|
32
|
string ffmpegLocation = Server.MapPath("~/");
|
|
33
|
33
|
string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
|
|
|
34
|
+ //string dirpath = Configs.GetValue("saveloc");
|
|
34
|
35
|
if (!System.IO.Directory.Exists(dirpath))
|
|
35
|
36
|
{
|
|
36
|
37
|
System.IO.Directory.CreateDirectory(dirpath);
|
|
37
|
38
|
}
|
|
38
|
39
|
string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
|
|
|
40
|
+ //string physicalpath = dirpath + fullFileName;
|
|
39
|
41
|
string physicalpath = Server.MapPath(path);
|
|
40
|
42
|
_upFile.SaveAs(physicalpath);
|
|
41
|
43
|
|
|
|
@@ -60,6 +62,11 @@ namespace CallCenterApi.Interface.Controllers
|
|
60
|
62
|
//p.StandardInput.WriteLine(ffmpegLocation.TrimEnd('\\'));
|
|
61
|
63
|
|
|
62
|
64
|
string temp_filename = physicalpath.Split('\\').Last().Split('.')[0] + "_temp";
|
|
|
65
|
+ string savedir = Configs.GetValue("saveloc");
|
|
|
66
|
+ if (!System.IO.Directory.Exists(savedir))
|
|
|
67
|
+ {
|
|
|
68
|
+ System.IO.Directory.CreateDirectory(savedir);
|
|
|
69
|
+ }
|
|
63
|
70
|
|
|
64
|
71
|
p.Start();
|
|
65
|
72
|
//先进入cmd命令
|
|
|
@@ -72,14 +79,14 @@ namespace CallCenterApi.Interface.Controllers
|
|
72
|
79
|
//p.StandardInput.WriteLine(ffmpegLocation.TrimEnd('\\'));
|
|
73
|
80
|
|
|
74
|
81
|
//p.StandardInput.WriteLine("ffmpeg -i " + temp_filename + i + ".mp3 -f pcm -ar 16000 -ac 1 -ab 16 " + namepart.Replace(@"/", @"\"));
|
|
75
|
|
- //string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_s16le -f s16le -ar 16000 -ac 1 " + ffmpegLocation + temp_filename + ".pcm";
|
|
76
|
|
- string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + dirpath + "\\" + temp_filename + ".wav";
|
|
|
82
|
+ //string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + dirpath + "\\" + temp_filename + ".wav";
|
|
|
83
|
+ string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + savedir + "\\" + temp_filename + ".wav";
|
|
77
|
84
|
//ffmpeg -i D:\项目\公司5.1\codegit\CallCenterApi\CallCenterApi.Interface\CallCenterApi.Interface\upload\20180131150114_2566994_913583164044.wav -acodec pcm_s16le -f s16le -ar 8000 -ac 1 D:\项目\公司5.1\codegit\CallCenterApi\CallCenterApi.Interface\CallCenterApi.Interface\20180131150114_2566994_913583164044_temp.pcm
|
|
78
|
85
|
p.StandardInput.WriteLine(changefile);
|
|
79
|
86
|
Thread.Sleep(3000);
|
|
80
|
87
|
p.StandardInput.WriteLine("exit");
|
|
81
|
88
|
//Kill 是终止没有图形化界面的进程的唯一方法。
|
|
82
|
|
- p.Kill();
|
|
|
89
|
+ //p.Kill();
|
|
83
|
90
|
|
|
84
|
91
|
#region 上传
|
|
85
|
92
|
uploadFile upfile = new uploadFile();
|
|
|
@@ -96,7 +103,8 @@ namespace CallCenterApi.Interface.Controllers
|
|
96
|
103
|
//string res = upfile.UploadLocalToFtp(path);
|
|
97
|
104
|
//string res = upfile.UploadLocalToFtp(physicalpath);
|
|
98
|
105
|
//D:\项目\公司5.1\codegit\CallCenterApi\CallCenterApi.Interface\CallCenterApi.Interface\20180131150114_2566994_913583164044_temp.pcm
|
|
99
|
|
- string uploadres = upfile.UploadLocalToFtp(dirpath + "\\" + temp_filename + ".wav");
|
|
|
106
|
+ //string uploadres = upfile.UploadLocalToFtp(dirpath + "\\" + temp_filename + ".wav");
|
|
|
107
|
+ string uploadres = upfile.UploadLocalToFtp(savedir + "\\" + temp_filename + ".wav");
|
|
100
|
108
|
if (uploadres == "上传成功!")
|
|
101
|
109
|
{
|
|
102
|
110
|
//写入日志
|