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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace CloudBuilder.Security.Policy
|
||||
public const string DOCUMENT = "D";
|
||||
public const string LYRIC = "L";
|
||||
|
||||
public const string JPG = ".jpg";
|
||||
|
||||
public static FileTypePolicy instance = null;
|
||||
|
||||
public FileTypePolicy(IContext context) : base(context)
|
||||
@@ -115,7 +117,7 @@ namespace CloudBuilder.Security.Policy
|
||||
var upload = (ServiceSettingsPolicy.GetDmsFileBackupDirectory(service) ?? "").Replace(phy ?? "", "");
|
||||
var filePathRel = Path.Combine(upload, createdBy, fileExtension.Replace(".", ""), "");
|
||||
var filePath = filePathRel.Replace(Path.DirectorySeparatorChar, '/') + "/";
|
||||
url = service.Configuration[AppsettingsPolicy.ApplicationUrl] + webRootPath + filePath + Path.GetFileNameWithoutExtension(orderKey) + ".png";
|
||||
url = service.Configuration[AppsettingsPolicy.ApplicationUrl] + webRootPath + filePath + Path.GetFileNameWithoutExtension(orderKey) + JPG;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,35 +5,17 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
# 此階段是用來組建服務專案
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj", "CloudBuilder.Web.Entry/"]
|
||||
RUN dotnet restore "./CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/CloudBuilder.Web.Entry"
|
||||
RUN dotnet build "./CloudBuilder.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# 此階段可用來發佈要複製到最終階段的服務專案
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./CloudBuilder.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# 此階段用於生產環境,或以一般模式從 VS 執行時 (未使用偵錯設定時的預設值)
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=publish /app/publish .
|
||||
COPY ./dist ./dist
|
||||
ENTRYPOINT ["dotnet", "CloudBuilder.Web.Entry.dll"]
|
||||
|
||||
#version: "3"
|
||||
#services:
|
||||
#cb:
|
||||
#image: mcr.microsoft.com/dotnet/runtime-deps:8.0
|
||||
#container_name: CloudBuilder.Web.Entry
|
||||
#build: .
|
||||
#container_name: youjiala.com
|
||||
#restart: always
|
||||
#ports:
|
||||
#- "5200:8080"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>C:\inetpub\wwwroot\dockwebapi2</_PublishTargetUrl>
|
||||
<History>True|2026-09-16T05:56:51.8724546Z||;True|2026-09-15T20:44:46.6559899+08:00||;True|2026-09-13T19:02:59.5654245+08:00||;True|2026-09-10T09:14:56.2914193+08:00||;True|2026-09-09T16:40:16.6461154+08:00||;True|2026-09-08T13:55:23.1502435+08:00||;True|2026-09-08T08:04:53.4279263+08:00||;True|2026-09-07T08:48:17.4682304+08:00||;True|2026-09-04T14:39:08.7878670+08:00||;True|2026-09-04T14:35:48.2937877+08:00||;True|2026-09-04T11:45:16.1372876+08:00||;True|2026-09-04T11:42:59.9356436+08:00||;True|2026-09-03T16:05:52.5270232+08:00||;True|2026-09-03T14:52:56.8559144+08:00||;True|2026-09-02T11:08:23.8720038+08:00||;True|2026-09-02T10:58:16.8081797+08:00||;True|2026-08-26T13:34:12.3805892+08:00||;True|2026-08-25T08:31:30.7787234+08:00||;True|2026-08-20T13:10:46.4725468+08:00||;True|2026-08-20T13:10:28.3142576+08:00||;True|2026-08-19T16:10:27.3362887+08:00||;True|2026-08-19T16:01:12.6234971+08:00||;True|2026-08-19T15:42:46.6576265+08:00||;True|2026-08-19T13:39:59.9363522+08:00||;True|2026-08-19T13:36:53.0379313+08:00||;True|2026-08-19T13:31:36.0841398+08:00||;True|2026-08-19T11:44:37.5319626+08:00||;True|2026-08-19T09:36:45.6000047+08:00||;True|2026-08-19T09:34:36.8468631+08:00||;True|2026-08-19T08:35:41.2202300+08:00||;True|2026-08-18T16:20:59.0170916+08:00||;</History>
|
||||
<History>True|2026-09-17T10:11:11.5364547Z||;True|2026-09-17T18:07:27.7830758+08:00||;True|2026-09-17T17:58:16.5798560+08:00||;True|2026-09-17T15:37:30.9025614+08:00||;True|2026-09-17T15:25:46.9116292+08:00||;True|2026-09-17T15:05:18.6592403+08:00||;True|2026-09-17T14:57:28.7997437+08:00||;True|2026-09-17T14:36:00.6339386+08:00||;True|2026-09-17T13:56:43.2376873+08:00||;True|2026-09-16T13:56:51.8724546+08:00||;True|2026-09-15T20:44:46.6559899+08:00||;True|2026-09-13T19:02:59.5654245+08:00||;True|2026-09-10T09:14:56.2914193+08:00||;True|2026-09-09T16:40:16.6461154+08:00||;True|2026-09-08T13:55:23.1502435+08:00||;True|2026-09-08T08:04:53.4279263+08:00||;True|2026-09-07T08:48:17.4682304+08:00||;True|2026-09-04T14:39:08.7878670+08:00||;True|2026-09-04T14:35:48.2937877+08:00||;True|2026-09-04T11:45:16.1372876+08:00||;True|2026-09-04T11:42:59.9356436+08:00||;True|2026-09-03T16:05:52.5270232+08:00||;True|2026-09-03T14:52:56.8559144+08:00||;True|2026-09-02T11:08:23.8720038+08:00||;True|2026-09-02T10:58:16.8081797+08:00||;True|2026-08-26T13:34:12.3805892+08:00||;True|2026-08-25T08:31:30.7787234+08:00||;True|2026-08-20T13:10:46.4725468+08:00||;True|2026-08-20T13:10:28.3142576+08:00||;True|2026-08-19T16:10:27.3362887+08:00||;True|2026-08-19T16:01:12.6234971+08:00||;True|2026-08-19T15:42:46.6576265+08:00||;True|2026-08-19T13:39:59.9363522+08:00||;True|2026-08-19T13:36:53.0379313+08:00||;True|2026-08-19T13:31:36.0841398+08:00||;True|2026-08-19T11:44:37.5319626+08:00||;True|2026-08-19T09:36:45.6000047+08:00||;True|2026-08-19T09:34:36.8468631+08:00||;True|2026-08-19T08:35:41.2202300+08:00||;True|2026-08-18T16:20:59.0170916+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -65,7 +65,7 @@
|
||||
},
|
||||
"Ffmpeg": {
|
||||
"Path": "D:\\NET8\\Exe\\ffmpeg\\bin\\ffmpeg.exe", //视频转码
|
||||
"Pictrue": " -i {0} -ss 00:00:2.000 -frames:v 1 {1}",
|
||||
"Pictrue": " -i {0} -ss 00:00:2.000 -frames:v 1 -vf \"scale=1280:-1\" -q:v 4 {1}", //" -i {0} -ss 00:00:2.000 -frames:v 1 {1}",
|
||||
"Arguments": " -i {0} -c:v libx264 -vf scale=1280:-1 -start_number 0 -hls_time {1} -hls_list_size 0 -f hls {2}" //0-源路径,1-目标路径,2-存放多少秒 1280×720,852*480
|
||||
},
|
||||
"CloudBuilder.Topshelf": {
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user