Skip to content

Commit

Permalink
修复任务详情时间显示错误,DDTVLR的版本更新提示优化。 增 加 圣 诞 涂 装 
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Dec 24, 2020
1 parent 616dea0 commit a8f09fb
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 46 deletions.
36 changes: 18 additions & 18 deletions Auxiliary/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void 轮询检查下载任务()
}
catch (Exception)
{ }
Thread.Sleep(60 * 1000);
Thread.Sleep(30 * 1000);
}
Thread.Sleep(500);
}
Expand All @@ -124,14 +124,14 @@ public static void 下载任务状态检测()
{
foreach (var item in MMPU.DownList)
{
if(item.DownIofo.下载状态&&item.DownIofo.已下载大小bit>10000&& item.DownIofo.最后连接时间!=0&& Gettime()-item.DownIofo.最后连接时间>120)
if(item.DownIofo.下载状态&&item.DownIofo.已下载大小bit>10000&& item.DownIofo.最后连接时间!=0&& Gettime()-item.DownIofo.最后连接时间>60)
{
InfoLog.InfoPrintf(item.DownIofo.房间_频道号 + "下载状态异常,重置下载任务", InfoLog.InfoClass.下载必要提示);
item.DownIofo.网络超时 = true;
item.DownIofo.备注 = "下载状态异常,重置下载任务";
Clear(true, item.DownIofo);
item.DownIofo.下载状态 = false;
item.DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
item.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
item.DownIofo.WC.CancelAsync();
new Task(() =>
{
Expand Down Expand Up @@ -185,15 +185,15 @@ public string Start(string 开始后显示的备注)
InfoLog.InfoPrintf(DownIofo.房间_频道号 + "房间:" + DownIofo.主播名称 + " 房间直播状态为False,取消建立新的下载任务", InfoLog.InfoClass.下载必要提示);
DownIofo.下载状态 = false;
DownIofo.备注 = "该房间未直播";
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
return null;
}
break;
case "主站视频":
break;
default:
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.备注 = "不支持的平台";
return null;
}
Expand Down Expand Up @@ -238,7 +238,7 @@ public string Start(string 开始后显示的备注)
InfoLog.InfoPrintf(DownIofo.房间_频道号 + "房间:" + DownIofo.主播名称 + " 房间未直播,下载任务取消", InfoLog.InfoClass.下载必要提示);
DownIofo.下载状态 = false;
DownIofo.备注 = "该房间未直播";
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
if (DownIofo.继承.是否为继承对象)
{
//MMPU.弹窗.Add(3000, "重连任务取消", DownIofo.房间_频道号 + ",该房间未直播");
Expand All @@ -259,7 +259,7 @@ public string Start(string 开始后显示的备注)
}
}
}
DownIofo.开始时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.开始时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
try
{
DownIofo.WC.DownloadFileTaskAsync(new Uri(DownIofo.下载地址), DownIofo.文件保存路径);
Expand Down Expand Up @@ -460,7 +460,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
try
{
//DownIofo.下载状态 = true;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.备注 = "下载任务结束";
if (e.Cancelled&&!DownIofo.网络超时)
{
Expand Down Expand Up @@ -514,7 +514,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号,true) && DownIofo.是否保存)
{
DownIofo.备注 = "下载流中断,检测到房间仍为开播状态,新建续下任务。";
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
switch (DownIofo.平台)
{
case "bilibili":
Expand Down Expand Up @@ -547,7 +547,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
重连下载对象.DownIofo.弹幕储存流 = DownIofo.弹幕储存流;
重连下载对象.DownIofo.礼物储存流 = DownIofo.礼物储存流;
重连下载对象.DownIofo.下载状态 = false;
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
重连下载对象.DownIofo.备注 = "服务器主动断开连接,直播结束";
foreach (var item in RoomInit.bilibili房间主表)
{
Expand All @@ -571,9 +571,9 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
}
DownIofo.备注 = "服务器主动断开连接,直播结束";
重连下载对象.DownIofo.下载状态 = false;
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
下载结束提醒(true, "下载任务结束", 重连下载对象.DownIofo);
return;
}
Expand All @@ -585,7 +585,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
if (重连下载对象.DownIofo.已下载大小bit > 1000)
{
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
下载结束提醒(true, "下载任务结束", DownIofo);
重连下载对象.DownIofo.备注 = "完成重连,正在续命..";
//下载对象.DownIofo.下载状态 = true;
Expand All @@ -596,9 +596,9 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
重连下载对象.DownIofo.备注 = "停止直播";
DownIofo.备注 = "直播停止,下载完成下载完成";
重连下载对象.DownIofo.下载状态 = false;
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
重连下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
重连下载对象.DownIofo.WC.CancelAsync();
MMPU.DownList.Remove(重连下载对象);
下载结束提醒(true, "下载任务结束", DownIofo);
Expand All @@ -613,7 +613,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
default:
DownIofo.备注 = "不受支持的平台";
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
InfoLog.InfoPrintf("该房间的配置文件发现了与当前版本不支持的平台,请检查文件配置或者检查更新", InfoLog.InfoClass.系统错误信息);
//下载结束提醒(false);
return;
Expand All @@ -628,7 +628,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
}
}
DownIofo.下载状态 = false;
DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
DownIofo.备注 = "下载任务结束";
}
catch (Exception)
Expand Down Expand Up @@ -659,7 +659,7 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e)
下载对象.DownIofo.备注 = "新建续下载对象出现异常,放弃新建任务";
下载结束提醒(true,"下载任务结束", DownIofo);
下载对象.DownIofo.下载状态 = false;
下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
下载对象.DownIofo.结束时间 = Convert.ToInt32((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
下载对象.DownIofo.WC.CancelAsync();
MMPU.DownList.Remove(下载对象);
}
Expand Down
8 changes: 4 additions & 4 deletions Auxiliary/MMPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class MMPU
public static int 心跳打印间隔 = 180;

public static int 启动模式 = 0;//0:DDTV,1:DDTVLive
public static bool 网络环境变动监听 = true;//0:DDTV,1:DDTVLive
public static bool 网络环境变动监听 = false;

/// <summary>
/// 配置文件初始化
Expand All @@ -95,7 +95,7 @@ public static bool 配置文件初始化(int 模式)
Debug输出到文件 = 读取exe默认配置文件("DebugFile", "1") == "0" ? false : true;
Debug打印到终端 = 读取exe默认配置文件("DebugCmd", "0") == "0" ? false : true;
心跳打印间隔 = int.Parse(读取exe默认配置文件("DokiDoki", "180"));
网络环境变动监听 = 读取exe默认配置文件("NetStatusMonitor", "1") == "0" ? false : true;
网络环境变动监听 = 读取exe默认配置文件("NetStatusMonitor", "0") == "0" ? false : true;
if (模式 == 0)
{
InfoLog.InfoInit("./DDTVLog.out", new InfoLog.InfoClasslBool()
Expand Down Expand Up @@ -1045,8 +1045,8 @@ public static long 获取时间戳()
/// <returns></returns>
public static DateTime Unix转换为DateTime(string timeStamp)
{
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000000");
DateTime dtStart = TimeZone.CurrentTimeZone.ToUniversalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000000")+(288000000000);
TimeSpan toNow = new TimeSpan(lTime);
return dtStart.Add(toNow);
}
Expand Down
31 changes: 17 additions & 14 deletions DDTVLiveRec/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,31 @@ static void Main(string[] args)
}).Start();
new Task(() =>
{
try
while (true)
{
string 服务器版本号 = MMPU.TcpSend(Server.RequestCode.GET_VER, "{}", true, 50);
if (!string.IsNullOrEmpty(服务器版本号))
try
{
bool 检测状态 = true;
foreach (var item in MMPU.不检测的版本号)
string 服务器版本号 = MMPU.TcpSend(Server.RequestCode.GET_VER, "{}", true, 50);
if (!string.IsNullOrEmpty(服务器版本号))
{
if (服务器版本号 == item)
bool 检测状态 = true;
foreach (var item in MMPU.不检测的版本号)
{
检测状态 = false;
if (服务器版本号 == item)
{
检测状态 = false;
}
}
if (MMPU.版本号 != 服务器版本号 && 检测状态)
{
MMPU.是否有新版本 = true;
InfoLog.InfoPrintf("检测到版本更新,更新内容:\n" + MMPU.TcpSend(Server.RequestCode.GET_VERTEXT, "{}", true, 100) + "\n\n", InfoLog.InfoClass.下载必要提示);
}
}
if (MMPU.版本号 != 服务器版本号 && 检测状态)
{
MMPU.是否有新版本 = true;
InfoLog.InfoPrintf("检测到版本更新,更新公告:\n" + MMPU.TcpSend(Server.RequestCode.GET_VERTEXT, "{}", true, 100) + "\n\n", InfoLog.InfoClass.下载必要提示);
//Console.ReadKey();
}
}
catch (Exception) { }
Thread.Sleep(3600*1000);
}
catch (Exception) { }
}).Start();
MMPU.缓存路径 = MMPU.下载储存目录;
InfoLog.InfoPrintf(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": " + "DDTVLiveRec启动完成", InfoLog.InfoClass.下载必要提示);
Expand Down
1 change: 1 addition & 0 deletions DDTV_New/DDTV_New.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@
<Content Include="libvlc\win-x64\plugins\visualization\libgoom_plugin.dll" />
<Content Include="libvlc\win-x64\plugins\visualization\libprojectm_plugin.dll" />
<Content Include="libvlc\win-x64\plugins\visualization\libvisual_plugin.dll" />
<Resource Include="res\img\sdm.png" />
<Resource Include="更新日志\2.0.4.3b.txt" />
<Resource Include="更新日志\2.0.4.3a.txt" />
<Resource Include="更新日志\2.0.4.1a.txt" />
Expand Down
13 changes: 9 additions & 4 deletions DDTV_New/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,15 @@

</Grid>
<Grid x:Name="logo层">
<Image x:Name="logo" Source="res/img/ddtv_logo.png" Margin="8,6,662,474" Width="130" Height="35" />
<Image Source="res/ico/close.png" Name="exit" Stretch="Fill" Width="30" Height="30" Margin="760,5,10,480" MouseLeftButtonDown="关闭按钮_Click"/>
<Image Source="res/ico/unfold.png" Name="最小化" Stretch="Fill" Width="30" Height="30" Margin="725,5,45,480" MouseLeftButtonDown="最小化按钮_Click"/>
<Label x:Name="版本更新通知" Content="" VerticalAlignment="Center" HorizontalAlignment="Center" Height="31" Width="183" VerticalContentAlignment="Center" Foreground="Black" Margin="486,484,131,0" />
<Grid.RowDefinitions>
<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 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" />
<Label x:Name="全局提示" Content="" HorizontalAlignment="Left" Margin="181,6,0,0" VerticalAlignment="Top" Foreground="Red" Width="525" Visibility="Collapsed"/>
</Grid>
<Grid x:Name="等待框" Background="#B2636363" Visibility="Collapsed" >
Expand Down
Loading

0 comments on commit a8f09fb

Please sign in to comment.