Skip to content

Commit

Permalink
修改多个逻辑:合并flv逻辑为下播后统一合并。主播在诡异上下播操作时导致建立多个录制任务的问题。同步任务进程防止不同进程之间信息延迟导致录…
Browse files Browse the repository at this point in the history
…制重复。
  • Loading branch information
CHKZL committed Dec 27, 2020
1 parent a8f09fb commit 9c3d7d5
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 88 deletions.
145 changes: 89 additions & 56 deletions Auxiliary/Downloader.cs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Auxiliary/FlvMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public static string FlvSum(Flv A,bool 是否直播结束)
String output;
if (是否直播结束)
{
output = A.File1Url.Replace("_202", "⒂").Split('⒂')[0] + ".flv";
string file = A.File1Url.Replace("_202", "⒂").Split('⒂')[0];
if(file.Substring(file.Length-4,4)==".flv")
{
file = file.Substring(0, file.Length - 4);
}
output = file + ".flv";
}
else
{
Expand Down
1 change: 1 addition & 0 deletions Auxiliary/MMPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public static void DokiDoki(int 模式)
{
if (item.DownIofo.下载状态)
{
item.DownIofo.下载状态 = false;
item.DownIofo.WC.CancelAsync();
new Task(() =>
{
Expand Down
41 changes: 28 additions & 13 deletions Auxiliary/RoomInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,40 @@ private static void 刷新B站房间列表()
}

InfoLog.InfoPrintf(最新的状态.名称 + "/" + 最新的状态.原名 + "直播间状态发生了变化", InfoLog.InfoClass.下载必要提示);
//Console.WriteLine(最新的状态.名称);
new Task(() =>
bool 是否新建任务 = true;
foreach (var item in MMPU.DownList)
{
string 下载地址 = bilibili.根据房间号获取房间信息.下载地址(之前的状态.唯一码);
if(string.IsNullOrEmpty(下载地址))
if (item.DownIofo.房间_频道号== 最新的状态.房间号)
{
InfoLog.InfoPrintf("解析下载地址失败,一般是该房间未开播或已加密", InfoLog.InfoClass.下载必要提示);
return;
if(item.DownIofo.下载状态 == true && item.DownIofo.是否保存)
{
是否新建任务 = false;
break;
}
}
Downloader DLL = Downloader.新建下载对象(之前的状态.平台, 之前的状态.唯一码, bilibili.根据房间号获取房间信息.获取标题(之前的状态.唯一码), Guid.NewGuid().ToString(), 下载地址, "自动录制", true, 最新的状态.名称, false, null);
if(DLL!=null)
}
//Console.WriteLine(最新的状态.名称);
if (是否新建任务)
{
new Task(() =>
{
if (string.IsNullOrEmpty(DLL.DownIofo.备注))
string 下载地址 = bilibili.根据房间号获取房间信息.下载地址(之前的状态.唯一码);
if (string.IsNullOrEmpty(下载地址))
{
DLL.DownIofo.备注 = "新建自动录制任务..等待数据..";
InfoLog.InfoPrintf("解析下载地址失败,一般是该房间未开播或已加密", InfoLog.InfoClass.下载必要提示);
return;
}
}

}).Start();
Downloader DLL = Downloader.新建下载对象(之前的状态.平台, 之前的状态.唯一码, bilibili.根据房间号获取房间信息.获取标题(之前的状态.唯一码), Guid.NewGuid().ToString(), 下载地址, "自动录制", true, 最新的状态.名称, false, null);
if (DLL != null)
{
if (string.IsNullOrEmpty(DLL.DownIofo.备注))
{
DLL.DownIofo.备注 = "新建自动录制任务..等待数据..";
}
}

}).Start();
}
}
break;

Expand Down
32 changes: 16 additions & 16 deletions Auxiliary/bilibili.cs
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,14 @@ public static bool 是否正在直播(string RoomId,bool 强制刷新)
}
else
{
foreach (var roomtask in RoomList)
{
if (roomtask.房间号 == RoomId)
{
roomtask.直播状态 = false;
break;
}
}
//foreach (var roomtask in RoomList)
//{
// if (roomtask.房间号 == RoomId)
// {
// roomtask.直播状态 = false;
// break;
// }
//}
DataCache.写缓存(CacheStr + RoomId, "0");
return false;
}
Expand All @@ -870,14 +870,14 @@ public static bool 是否正在直播(string RoomId,bool 强制刷新)
}
else
{
foreach (var roomtask in RoomList)
{
if (roomtask.房间号 == RoomId)
{
roomtask.直播状态 = false;
break;
}
}
//foreach (var roomtask in RoomList)
//{
// if (roomtask.房间号 == RoomId)
// {
// roomtask.直播状态 = false;
// break;
// }
//}
DataCache.写缓存(CacheStr + RoomId, "0");
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions DDTV_New/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@
<RowDefinition Height="59*"/>
<RowDefinition Height="456*"/>
</Grid.RowDefinitions>
<Image x:Name="logo" Source="res/img/ddtv_logo.png" Margin="8,6,662,18" Width="130" Height="35" />
<Image x:Name="logo2" Source="res/img/sdm.png" Margin="-27,-6,747,43" RenderTransformOrigin="0.672,0.261" />
<Image x:Name="logo" Source="res/img/ddtv_logo.png" Margin="27,11,643,13" Width="130" Height="35" />
<Image x:Name="logo2" Source="res/img/sdm.png" Margin="-15,0,719,32" RenderTransformOrigin="0.672,0.261" />
<Image Source="res/ico/close.png" Name="exit" Stretch="Fill" Width="30" Height="30" Margin="760,5,10,24" MouseLeftButtonDown="关闭按钮_Click"/>
<Image Source="res/ico/unfold.png" Name="最小化" Stretch="Fill" Width="30" Height="30" Margin="725,5,45,24" MouseLeftButtonDown="最小化按钮_Click"/>
<Label x:Name="版本更新通知" Content="" VerticalAlignment="Center" HorizontalAlignment="Center" Height="31" Width="183" VerticalContentAlignment="Center" Foreground="Black" Margin="486,425,131,0" Grid.Row="1" />
Expand Down

0 comments on commit 9c3d7d5

Please sign in to comment.