Skip to content

Commit

Permalink
增加下播提醒事件;增加最小生成文件阈值配置项
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Jul 1, 2024
1 parent 6eb955e commit abe98ef
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
19 changes: 19 additions & 0 deletions Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,25 @@ public bool _SaveCover
}
}

private static string AutomaticFileCleaningThreshold = "8388608";
/// <summary>
/// 自动删除过小文件的阈值
/// 默认值:8388608 (8*1024*1024,8MB)
/// </summary>
public long _AutomaticFileCleaningThreshold
{
get => long.Parse(AutomaticFileCleaningThreshold);
set
{
if (value.ToString() != AutomaticFileCleaningThreshold)
{
AutomaticFileCleaningThreshold = value.ToString();
OnPropertyChanged();
ModifyConfig(value);
}
}
}

}
#endregion
}
Expand Down
4 changes: 4 additions & 0 deletions Core/LogModule/Opcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ public enum Download
/// FLV任务成功开始
/// </summary>
FlvTaskStart=40109,
/// <summary>
/// 下播提醒
/// </summary>
EndBroadcastingReminder=40110,
}
}
}
10 changes: 7 additions & 3 deletions Core/RuntimeObject/DetectRoom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ internal static void DetectRoom_LiveEnd(object? sender, RoomCardClass e)
{
if (e.IsRemind)
{
string msg = $"{e.RoomId}({e.Name})下播";
OperationQueue.Add(Opcode.Download.StopLiveEvent, msg, e.UID);
Log.Info(nameof(DetectRoom_LiveEnd), msg);
string msg1 = $"下播提醒,房间:{e.RoomId}({e.Name})";
OperationQueue.Add(Opcode.Download.EndBroadcastingReminder, msg1, e.UID);
Log.Info(nameof(DetectRoom_LiveEnd), msg1);
}

string msg2 = $"下播事件,房间:{e.RoomId}({e.Name})";
OperationQueue.Add(Opcode.Download.StopLiveEvent, msg2, e.UID);
Log.Info(nameof(DetectRoom_LiveEnd), msg2);
}


Expand Down
5 changes: 2 additions & 3 deletions Core/RuntimeObject/Download/Basics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ internal static HostClass GetFlvHost_avc(RoomCardClass roomCard)
/// <returns>是否成功</returns>
internal static DlwnloadTaskState CheckAndHandleFile(string File, ref RoomCardClass card,bool AnchorReStream = false)
{
const long FileSizeThreshold = 8 * 1024 * 1024; // 8MB
if (card.DownInfo.IsCut)
{
return DlwnloadTaskState.Cut;
Expand All @@ -313,13 +312,13 @@ internal static DlwnloadTaskState CheckAndHandleFile(string File, ref RoomCardCl
if (fileExists)
{
System.IO.FileInfo fileInfo = new(File);
if (fileInfo.Length > FileSizeThreshold)
if (fileInfo.Length > Config.Core_RunConfig._AutomaticFileCleaningThreshold)
{
return DlwnloadTaskState.Success;
}
else
{
Tools.FileOperations.Delete(File, $"文件大小小于设置的{(FileSizeThreshold / 1024 / 1024)}MB,自动删除");
Tools.FileOperations.Delete(File, $"文件大小小于设置的{(Config.Core_RunConfig._AutomaticFileCleaningThreshold / 1024 / 1024)}MB,自动删除");
}

}
Expand Down

0 comments on commit abe98ef

Please sign in to comment.