ow
This commit is contained in:
1 parent
501c92d87c
commit
f1a88acb89
9 files changed
+1040
-165
No files matched your search
@@ -1190,7 +1190,7 @@ namespace CloudBuilder.Master.Service
|
||||
string backupFileName = Path.Combine(backupRootPath, filePath, file.FileName);
|
||||
if (!Directory.Exists(Path.Combine(backupRootPath, filePath)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(backupRootPath, filePath));
|
||||
Directory.CreateDirectory(Path.Combine(backupRootPath, filePath));
|
||||
}
|
||||
|
||||
if (fns[fns.Length - 1].Split('.')[0] == "1")
|
||||
@@ -1357,7 +1357,7 @@ namespace CloudBuilder.Master.Service
|
||||
{
|
||||
if (File.Exists(fileName)) File.Delete(fileName);
|
||||
}
|
||||
string m3u8FilePath = fullName.Replace(fileExtension, ".png");
|
||||
string m3u8FilePath = fullName.Replace(fileExtension, FileTypePolicy.JPG);
|
||||
//生成m3u8(暂不生成,只生成截图)
|
||||
TsToM3u8(dmsFile.OrderKey, fullName, m3u8FilePath);
|
||||
}
|
||||
@@ -1405,7 +1405,14 @@ namespace CloudBuilder.Master.Service
|
||||
public void TsToM3u8(string orderKey, string mp4Url, string m3u8Url, int videoLength = 6)
|
||||
{
|
||||
string para = string.Format(service.Configuration[ServiceSettingsPolicy.FfmpegPictrue], mp4Url, m3u8Url);
|
||||
RunMyProcess(service.Configuration[ServiceSettingsPolicy.FfmpegPath], para);
|
||||
try
|
||||
{
|
||||
RunMyProcess(service.Configuration[ServiceSettingsPolicy.FfmpegPath], para);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
new FileLog(service.Configuration).WriteToFile(ex.Message);
|
||||
}
|
||||
return;
|
||||
para = string.Format(service.Configuration["Ffmpeg:Arguments"], mp4Url, videoLength, m3u8Url);
|
||||
//不直接转码视频文件,影响服务器性能,改为在闭时自动生成
|
||||
@@ -1483,8 +1490,10 @@ namespace CloudBuilder.Master.Service
|
||||
/// <param name="Parameters"></param>
|
||||
public void RunMyProcess(string exePath, string Parameters)
|
||||
{
|
||||
FileLog log = new FileLog(service.Configuration);
|
||||
try
|
||||
{
|
||||
log.WriteToFile(exePath + Parameters);
|
||||
if (string.IsNullOrEmpty(exePath)) return;
|
||||
Cli.Wrap(exePath)
|
||||
.WithArguments(Parameters)
|
||||
@@ -1492,6 +1501,7 @@ namespace CloudBuilder.Master.Service
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.WriteToFile(ex.Message);
|
||||
throw new ValidatedException(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,18 +88,10 @@ namespace CloudBuilder.Master.Service
|
||||
{
|
||||
var upload = ServiceSettingsPolicy.GetDmsFileUploadDirectory(service).Replace(phy, "");
|
||||
|
||||
var filePathRel = Path.Combine(upload, item.CreatedBy, "m3u8", "");
|
||||
var filePath = filePathRel.Replace(Path.DirectorySeparatorChar, '/');
|
||||
item.FormattedUrl = service.Configuration[AppsettingsPolicy.ApplicationUrl] + webRootPath + filePath + '/' + Path.GetFileNameWithoutExtension(item.Url) + "/main.m3u8";
|
||||
|
||||
item.FormattedPic = item.FormattedUrl.Replace("main.m3u8", "main.png");
|
||||
|
||||
DmsFileEntity dmsFileEntity = repositoryDmsFile.DetachedEntities.Where(x => x.OrderKey == Path.GetFileNameWithoutExtension(item.Url)).FirstOrDefault();
|
||||
string transcodeIndc = YesNoPolicy.NO;
|
||||
if (dmsFileEntity != null) transcodeIndc = dmsFileEntity.TranscodeIndc;
|
||||
item.FormattedUrl = FileTypePolicy.PackUrl(service, item.CreatedBy, item.Url, transcodeIndc);
|
||||
|
||||
|
||||
//暂时不支持转码
|
||||
//DmsFileEntity dmsFileEntity = repositoryDmsFile.DetachedEntities.Where(x => x.OrderKey == item.Url).FirstOrDefault();
|
||||
item.FormattedPic = FileTypePolicy.PackUrl(service, item.CreatedBy, item.Url, YesNoPolicy.YES);
|
||||
item.FormattedUrl = FileTypePolicy.PackUrl(service, item.CreatedBy, item.Url, YesNoPolicy.NO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user