Skip to content

Commit

Permalink
增加对于收费直播的录制尝试和修复功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Oct 13, 2024
1 parent e298632 commit 915e7e3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Core/RuntimeObject/Danmu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ public static void SevaDanmu(LiveChat.LiveChatListener liveChatListener, bool De
/// <param name="FileName">保存路径</param>
/// <param name="Name">昵称</param>
/// <param name="roomId">房间号</param>
public static FileInfo SevaDanmu(List<DanmuInfo> danmuInfo, string FileName, string Name, long roomId)
/// <param name="IsTemporary">是否为临时保存(不删除记录)</param>
/// <returns></returns>
public static FileInfo SevaDanmu(List<DanmuInfo> danmuInfo, string FileName, string Name, long roomId,bool IsTemporary= false)
{
string XML = string.Empty;
XML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
Expand Down
30 changes: 23 additions & 7 deletions Core/RuntimeObject/Download/HLS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,29 +237,45 @@ private static DlwnloadTaskState HandleHlsError(RoomCardClass card, HostClass ho
{
return DlwnloadTaskState.StopLive;
}
if(card.DownInfo.Unmark)

if (card.DownInfo.Unmark)
{
return DlwnloadTaskState.UserCancellation;
}
//是否为收费直播
//
bool isPaidLiveStream = hostClass.all_special_types.Contains(1);
string url = string.Empty;

//是否为收费直播
if (isPaidLiveStream)
{
card.DownInfo.Status = RoomCardClass.DownloadStatus.Special;
return DlwnloadTaskState.PaidLiveStream;
{
//测是否有门票
if (!GetHlsAvcUrl(card, Core.Config.Core_RunConfig._DefaultResolution, out url))
{
//没门票
card.DownInfo.Status = RoomCardClass.DownloadStatus.Special;
return DlwnloadTaskState.PaidLiveStream;
}
//有门票
if (!string.IsNullOrEmpty(url))
{
Log.Info(nameof(HandleHlsError), $"[{card.Name}({card.RoomId})]检测到收费直播,但是好像有门票,继续尝试录制");
}
}
//是否有HLS流
if (hostClass.Effective)
{
card.DownInfo.Status = RoomCardClass.DownloadStatus.Downloading;
card.DownInfo.Status = RoomCardClass.DownloadStatus.Downloading;
return DlwnloadTaskState.Default;
}
else
{
card.DownInfo.Status = RoomCardClass.DownloadStatus.Standby;
card.DownInfo.Status = RoomCardClass.DownloadStatus.Standby;
return DlwnloadTaskState.NoHLSStreamExists;
}
}


/// <summary>
/// 更新下载速度
/// </summary>
Expand Down

0 comments on commit 915e7e3

Please sign in to comment.