Skip to content

Commit

Permalink
修复DDTVLiveRec在启动后不会自动录制已经正在直播房间的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Mar 24, 2021
1 parent 31578ec commit 9255f9a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Auxiliary/MMPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ public static double 测试延迟(string Url)
{
try
{
NewWebClient myWebClient = new NewWebClient(1 * 1000);
NewWebClient myWebClient = new NewWebClient(1 * 800);
//wcl.Timeout = 1000;
Stopwatch spwatch = new Stopwatch();
spwatch.Start();
Expand Down
15 changes: 14 additions & 1 deletion Auxiliary/RoomInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Auxiliary
Expand Down Expand Up @@ -114,6 +115,7 @@ public static bool 根据唯一码获取直播状态(string GUID)
// }
//});
}
public static bool 首次房间列表刷新 = true;
private static void 刷新B站房间列表()
{
if (!MMPU.是否能连接阿B)
Expand All @@ -138,13 +140,19 @@ private static void 刷新B站房间列表()
}
A--;
}


foreach (var 最新的状态 in bilibili.RoomList)
{
foreach (var 之前的状态 in 之前的bilibili房间主表状态)
{

if (之前的状态.唯一码 == 最新的状态.房间号)
{
if (首次房间列表刷新)
{
之前的状态.直播状态 = false;
}
if (B站更新刷新次数 > 5)
{
if (之前的状态.直播状态 == false && 最新的状态.直播状态 == true && 之前的状态.是否提醒)
Expand Down Expand Up @@ -208,6 +216,11 @@ private static void 刷新B站房间列表()
int B = 之前的bilibili房间主表状态.Count();
临时主表.Add(new RL { 名称 = 最新的状态.名称, 唯一码 = 最新的状态.房间号, 平台 = "bilibili", 是否录制 = 最新的状态.是否录制视频, 是否提醒 = 最新的状态.是否提醒, 直播状态 = 最新的状态.直播状态, 原名 = 最新的状态.原名 });
}
if(之前的bilibili房间主表状态.Count!=0)
{
首次房间列表刷新 = false;
}

bilibili房间主表.Clear();
foreach (var item in 临时主表)
{
Expand Down
5 changes: 4 additions & 1 deletion Auxiliary/VTBS/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public class API
/// </summary>
public class VTBS服务器CDN
{
public static string VTBS_Url = "https://api.vtbs.moe";
public static bool 更新CDN完成 = false;
public static bool 更新vtbs房间直播状态完成 = false;
public static string VTBS_Url = "https://api.tokyo.vtbs.moe";
public static void 根据CDN更新VTBS_Url()
{
new Task(()=> {
Expand All @@ -38,6 +40,7 @@ public static void 根据CDN更新VTBS_Url()
PING.Add(new 延迟对象() { CDN_URL = item.ToString() });
}
VTBS_Url = 返回延迟最低的连接(PING, 5);
更新CDN完成 = true;
InfoLog.InfoPrintf("获取到VTBS当前可用CDN为:" + VTBS_Url, InfoLog.InfoClass.Debug);
}).Start();
}
Expand Down
8 changes: 7 additions & 1 deletion Auxiliary/bilibili.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static void start()
{
try
{

更新VTBS房间数据();
Thread.Sleep(1000 * 60 * 60);
}
Expand Down Expand Up @@ -117,8 +118,9 @@ public static void 更新VTBS房间数据()
string vtbs房间数据 = string.Empty;
try
{

vtbs房间数据 = MMPU.返回网页内容_GET(VTBS.API.VTBS服务器CDN.VTBS_Url + "/v1/short", 3000);
if(string.IsNullOrEmpty(vtbs房间数据))
if (string.IsNullOrEmpty(vtbs房间数据))
{
int a = int.Parse("A");
}
Expand All @@ -135,6 +137,7 @@ public static void 更新VTBS房间数据()
{
// InfoLog.InfoPrintf($"{vtbs房间数据}", InfoLog.InfoClass.Debug);
JO = (JArray)JsonConvert.DeserializeObject(vtbs房间数据);

}
catch (Exception e)
{
Expand Down Expand Up @@ -200,6 +203,7 @@ public static void 更新VTBS房间数据()
是否需要保存房间配置文件 = true;
}
}

if (rlc.data != null)
{
foreach (var ROOMCONFIG in rlc.data)
Expand Down Expand Up @@ -349,6 +353,7 @@ public static void 使用vtbsAPI更新房间状态()

}
InfoLog.InfoPrintf("Vtbs数据更新成功", InfoLog.InfoClass.没啥价值的消息);
VTBS.API.VTBS服务器CDN.更新vtbs房间直播状态完成 = true;
}
catch (Exception)
{
Expand Down Expand Up @@ -376,6 +381,7 @@ public static void 使用vtbsAPI更新房间状态()
}
}
InfoLog.InfoPrintf("备用数据源加载成功", InfoLog.InfoClass.Debug);
VTBS.API.VTBS服务器CDN.更新vtbs房间直播状态完成 = true;
}
catch (Exception)
{
Expand Down

0 comments on commit 9255f9a

Please sign in to comment.