From c41b10d0b274bba09fda087dc0fa17df78cbcdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B4=AB?= Date: Fri, 20 Mar 2020 23:22:55 +0800 Subject: [PATCH] =?UTF-8?q?2.0.2.1c=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=92=AD=E6=94=BE=E5=92=8C=E4=B8=8B=E8=BD=BD=E4=B8=8D?= =?UTF-8?q?=E6=96=AD=E9=87=8D=E8=BF=9E=E7=9A=84=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E4=BF=9D=E5=AD=98cookie=E5=92=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=9E=9A=E4=B8=BE=E6=96=B9=E5=BC=8F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E7=99=BB=E9=99=86=E7=8A=B6=E6=80=81=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=93=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Auxiliary/Auxiliary.csproj | 2 + Auxiliary/Downloader.cs | 29 ++-- Auxiliary/Encryption.cs | 137 ++++++++++++++++++ Auxiliary/MMPU.cs | 85 ++++++----- Auxiliary/bilibili.cs | 59 +++++++- DDTV_New/DDTV_New.csproj | 3 +- DDTV_New/MainWindow.xaml | 2 +- DDTV_New/MainWindow.xaml.cs | 43 +++++- DDTV_New/RoomInit.cs | 6 +- DDTV_New/window/BiliLoginWindowQR.xaml.cs | 8 +- .../2.0.2.1c.txt" | 6 +- PlayW/MainWindow.xaml.cs | 29 +++- README.md | 4 +- 13 files changed, 347 insertions(+), 66 deletions(-) create mode 100644 Auxiliary/Encryption.cs rename "DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1.txt" => "DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1c.txt" (88%) diff --git a/Auxiliary/Auxiliary.csproj b/Auxiliary/Auxiliary.csproj index 6b6e6f82e..3aa2837ef 100644 --- a/Auxiliary/Auxiliary.csproj +++ b/Auxiliary/Auxiliary.csproj @@ -84,6 +84,7 @@ + @@ -95,6 +96,7 @@ + diff --git a/Auxiliary/Downloader.cs b/Auxiliary/Downloader.cs index 3a170db1c..f03e293f5 100644 --- a/Auxiliary/Downloader.cs +++ b/Auxiliary/Downloader.cs @@ -13,7 +13,7 @@ namespace Auxiliary { public class Downloader { - + public DownIofoData DownIofo = new DownIofoData(); public class DownIofoData { @@ -33,10 +33,12 @@ public class DownIofoData public string 标题 { set; get; } public bool 播放状态 { set; get; } public bool 是否是播放任务 { set; get; } + public string 重连文件路径 { set; get; } } public string Start(string 开始后显示的备注) { int a = 0; + DownIofo.WC = new WebClient(); DownIofo.WC.Headers.Add("Accept: */*"); DownIofo.WC.Headers.Add("User-Agent: " + Ver.UA); @@ -96,15 +98,21 @@ public string Start(string 开始后显示的备注) Thread.Sleep(1000); if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号)) { + a++; if (判断文件是否存在.判断(DownIofo.下载地址, DownIofo.平台)) { - DownIofo.下载地址 = bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号); + //DownIofo.下载地址 = bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号); break; } else { - if(a>5) + DownIofo.下载地址 = bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号); + if (判断文件是否存在.判断(DownIofo.下载地址, DownIofo.平台)) + { + break; + } + if (a>5) { DownIofo.下载状态 = false; DownIofo.备注 = "该房间未推送直播流"; @@ -124,7 +132,8 @@ public string Start(string 开始后显示的备注) } } DownIofo.开始时间 = Convert.ToInt32((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); - DownIofo.WC.DownloadFileAsync(new Uri(DownIofo.下载地址), DownIofo.文件保存路径); + //DownIofo.WC.DownloadFileAsync(new Uri(DownIofo.下载地址), DownIofo.文件保存路径); + DownIofo.WC.DownloadFileTaskAsync(new Uri(DownIofo.下载地址), DownIofo.文件保存路径); DownIofo.备注 = 开始后显示的备注; DownIofo.下载状态 = true; return DownIofo.文件保存路径; @@ -174,11 +183,11 @@ public static Downloader 新建下载对象(string 平台, string 唯一码, str }; if(!是否保存) { - int 优雅 = new Random().Next(1000, 9999); - 下载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 下载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + 优雅 + ".flv"; + int 随机值 = new Random().Next(1000, 9999); + 下载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 下载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + 随机值 + ".flv"; if (File.Exists(下载对象.DownIofo.文件保存路径)) { - 下载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 下载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + (优雅)+1 + ".flv"; + 下载对象.DownIofo.文件保存路径 = AppDomain.CurrentDomain.BaseDirectory + "tmp\\LiveCache\\" + 下载对象.DownIofo.标题 + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + (随机值)+1 + ".flv"; } } @@ -225,13 +234,13 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e) } else { - if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号)&& DownIofo.是否保存) + if (bilibili.根据房间号获取房间信息.是否正在直播(DownIofo.房间_频道号) && DownIofo.是否保存) { switch (DownIofo.平台) { case "bilibili": { - Downloader 下载对象 = Downloader.新建下载对象(DownIofo.平台, DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号), "重连", false); + Downloader 下载对象 = Downloader.新建下载对象(DownIofo.平台, DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(DownIofo.房间_频道号), "重连", DownIofo.是否保存); if (!下载对象.DownIofo.下载状态) { 下载对象.DownIofo.备注 = "该房间当前状态不能获取到直播流"; @@ -245,6 +254,8 @@ private void 下载完成事件(object sender, AsyncCompletedEventArgs e) Thread.Sleep(1000); if (下载对象.DownIofo.已下载大小bit > 1000) { + // DownIofo.重连文件路径 = 下载对象.DownIofo.文件保存路径; + //DownIofo = 下载对象.DownIofo; DownIofo.下载状态 = true; return; } diff --git a/Auxiliary/Encryption.cs b/Auxiliary/Encryption.cs new file mode 100644 index 000000000..b6fd0bff5 --- /dev/null +++ b/Auxiliary/Encryption.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace Auxiliary +{ + public static class Encryption + { + #region AES 加密解密 + + /// + /// AES加密 + /// + /// 待加密字段 + /// 密钥值 + /// 加密辅助向量 + /// + public static string AesStr(this string source, string keyVal, string ivVal) + { + var encoding = Encoding.UTF8; + byte[] btKey = keyVal.FormatByte(encoding); + byte[] btIv = ivVal.FormatByte(encoding); + byte[] byteArray = encoding.GetBytes(source); + string encrypt; + Rijndael aes = Rijndael.Create(); + using (MemoryStream mStream = new MemoryStream()) + { + using (CryptoStream cStream = new CryptoStream(mStream, aes.CreateEncryptor(btKey, btIv), CryptoStreamMode.Write)) + { + cStream.Write(byteArray, 0, byteArray.Length); + cStream.FlushFinalBlock(); + encrypt = Convert.ToBase64String(mStream.ToArray()); + } + } + aes.Clear(); + return encrypt; + } + + /// + /// AES解密 + /// + /// 待加密字段 + /// 密钥值 + /// 加密辅助向量 + /// + public static string UnAesStr(this string source, string keyVal, string ivVal) + { + var encoding = Encoding.UTF8; + byte[] btKey = keyVal.FormatByte(encoding); + byte[] btIv = ivVal.FormatByte(encoding); + byte[] byteArray = Convert.FromBase64String(source); + string decrypt; + Rijndael aes = Rijndael.Create(); + using (MemoryStream mStream = new MemoryStream()) + { + using (CryptoStream cStream = new CryptoStream(mStream, aes.CreateDecryptor(btKey, btIv), CryptoStreamMode.Write)) + { + cStream.Write(byteArray, 0, byteArray.Length); + cStream.FlushFinalBlock(); + decrypt = encoding.GetString(mStream.ToArray()); + } + } + aes.Clear(); + return decrypt; + } + #endregion + #region BASE64 加密解密 + + /// + /// BASE64 加密 + /// + /// 待加密字段 + /// + public static string Base64(this string source) + { + var btArray = Encoding.UTF8.GetBytes(source); + return Convert.ToBase64String(btArray, 0, btArray.Length); + } + + /// + /// BASE64 解密 + /// + /// 待解密字段 + /// + public static string UnBase64(this string source) + { + var btArray = Convert.FromBase64String(source); + return Encoding.UTF8.GetString(btArray); + } + + #endregion + + #region 内部方法 + + /// + /// 转成数组 + /// + private static byte[] Str2Bytes(this string source) + { + source = source.Replace(" ", ""); + byte[] buffer = new byte[source.Length / 2]; + for (int i = 0; i < source.Length; i += 2) buffer[i / 2] = Convert.ToByte(source.Substring(i, 2), 16); + return buffer; + } + + /// + /// 转换成字符串 + /// + private static string Bytes2Str(this IEnumerable source, string formatStr = "{0:X2}") + { + StringBuilder pwd = new StringBuilder(); + foreach (byte btStr in source) { pwd.AppendFormat(formatStr, btStr); } + return pwd.ToString(); + } + + private static byte[] FormatByte(this string strVal, Encoding encoding) + { + return encoding.GetBytes(strVal.Base64().Substring(0, 16).ToUpper()); + } + + /// + /// HashAlgorithm 加密统一方法 + /// + private static string HashAlgorithmBase(HashAlgorithm hashAlgorithmObj, string source, Encoding encoding) + { + byte[] btStr = encoding.GetBytes(source); + byte[] hashStr = hashAlgorithmObj.ComputeHash(btStr); + return hashStr.Bytes2Str(); + } + + #endregion + } +} diff --git a/Auxiliary/MMPU.cs b/Auxiliary/MMPU.cs index 94fe94f40..cb3edfecc 100644 --- a/Auxiliary/MMPU.cs +++ b/Auxiliary/MMPU.cs @@ -15,6 +15,7 @@ using System.Text.RegularExpressions; using System.Security.Cryptography; using Newtonsoft.Json.Linq; +using System.Windows.Forms; namespace Auxiliary { @@ -25,7 +26,7 @@ public class MMPU public static string 直播缓存目录 =""; public static int 直播更新时间 = 40; public static string 下载储存目录 = ""; - public static string 版本号 = "2.0.2.1b"; + public static string 版本号 = "2.0.2.1c"; public static string[] 不检测的版本号 = {"2.0.2.0b", "2.0.2.0c" , "2.0.2.0d" , "2.0.2.0e" , "2.0.2.0f", "2.0.2.0g", "2.0.2.0" }; public static bool 第一次打开播放窗口 = true; public static int 默认音量= 0; @@ -49,6 +50,8 @@ public class MMPU public static string UID = ""; public static string BiliUserFile= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BiliUser.ini"); public static int 播放缓冲时长 = 3; + public static string AESKey="rzqIzYmDQFqQmWfr"; + public static string AESVal = "itkIBBs5JdCLKqpP"; public static string 房间状态MD5值 = string.Empty; public static void 修改默认音量设置(int A) @@ -120,6 +123,8 @@ public static string 写ini配置文件(string 节点, string 项目,string 值, bilibili.BiliUser.Write(节点, 项目, 值, 路径); return null; } + + /// /// /// @@ -215,55 +220,61 @@ public static void 更新网络房间缓存() int A = 1; new Thread(new ThreadStart(delegate { - var wc = new WebClient(); - wc.Headers.Add("Accept: */*"); - wc.Headers.Add("Accept-Language: zh-CN,zh;q=0.8,en;q=0.6,ja;q=0.4"); - byte[] roomHtml = wc.DownloadData("https://gitee.com/SYXM/vdb/raw/master/json/list.json"); - var result = JObject.Parse(Encoding.UTF8.GetString(roomHtml)); - - foreach (var item in result["vtbs"]) + try { - foreach (var x in item["accounts"]) + var wc = new WebClient(); + wc.Headers.Add("Accept: */*"); + wc.Headers.Add("Accept-Language: zh-CN,zh;q=0.8,en;q=0.6,ja;q=0.4"); + byte[] roomHtml = wc.DownloadData("https://gitee.com/SYXM/vdb/raw/master/json/list.json"); + var result = JObject.Parse(Encoding.UTF8.GetString(roomHtml)); + + foreach (var item in result["vtbs"]) { - if (x["platform"].ToString() == "bilibili") + foreach (var x in item["accounts"]) { - - string name = ""; - if (item["name"].ToString().Contains("ch")) + if (x["platform"].ToString() == "bilibili") { - try - { - name = item["name"]["ch"].ToString(); - } - catch (Exception) - { - } - } - else if (item["name"].ToString().Contains("cn")) - { - try + string name = ""; + if (item["name"].ToString().Contains("ch")) { - name = item["name"]["cn"].ToString(); + try + { + name = item["name"]["ch"].ToString(); + } + catch (Exception) + { + + } } - catch (Exception) + else if (item["name"].ToString().Contains("cn")) { - + try + { + name = item["name"]["cn"].ToString(); + } + catch (Exception) + { + + } } + 列表缓存.Add(new 列表加载缓存 + { + 编号 = A, + 名称 = name, + 官方名称 = item["name"][item["name"]["default"].ToString()].ToString(), + 平台 = "bilibili", + UID = x["id"].ToString(), + 类型 = x["type"].ToString() + }); + A++; } - 列表缓存.Add(new 列表加载缓存 - { - 编号 = A, - 名称 = name, - 官方名称 = item["name"][item["name"]["default"].ToString()].ToString(), - 平台 = "bilibili", - UID = x["id"].ToString(), - 类型 = x["type"].ToString() - }); - A++; } } } + catch (Exception) + { + } //this.Dispatcher.Invoke(new Action(delegate //{ // 选中内容展示.Content = ""; diff --git a/Auxiliary/bilibili.cs b/Auxiliary/bilibili.cs index 44c72593b..1e86665d7 100644 --- a/Auxiliary/bilibili.cs +++ b/Auxiliary/bilibili.cs @@ -302,6 +302,7 @@ public static string 获取标题(string roomid) } public static string 下载地址(string roomid) { + // return "https://d1--cn-gotcha04.bilivideo.com/live-bvc/793662/live_458154143_84879393.flv?cdn=cn-gotcha04&expires=1584633755&len=0&oi=3664520922&pt=web&qn=10000&trid=ceaa755109194e2aa2249569d4945b22&sigparams=cdn,expires,len,oi,pt,qn,trid&sign=81057e08abe71ffa9a1a86d0c93cd0c3&ptype=0&platform=web&pSession=keiyK8Ef-t7iZ-4xGe-hER9-NfFXX7SF7ibN"; roomid = 获取真实房间号(roomid); if (roomid == null) { @@ -319,7 +320,61 @@ public static string 下载地址(string roomid) { wc.Headers.Add("Cookie", MMPU.Cookie); } - + string resultString; + try + { + resultString = wc.DownloadString(apiUrl); + } + catch (Exception e) + { + Console.WriteLine("发送解析请求失败:" + e.Message); + return ""; + } + + //解析结果使用最高清晰度 + try + { + //foreach (var item in JObject.Parse(resultString)["data"]["durl"]) + //{ + // Console.WriteLine(item["url"].ToString()); + + //} + MMPU.判断网络路径是否存在 判断文件是否存在 = new MMPU.判断网络路径是否存在(); + string BBBC = (JObject.Parse(resultString)["data"]["durl"][0]["url"].ToString() + "&platform=web").Replace("pt=", "pt=web") + "&pSession=" + Guid.NewGuid(); + if (!判断文件是否存在.判断(BBBC, "bilibili")) + { + BBBC = (JObject.Parse(resultString)["data"]["durl"][0]["url"].ToString()); + } + + Console.WriteLine(BBBC); + return BBBC; + } + catch (Exception e) + { + Console.WriteLine("视频流地址解析失败:" + e.Message); + return ""; + } + } + public static string 下载地址(string roomid,int live) + { + roomid = 获取真实房间号(roomid); + if (roomid == null) + { + Console.WriteLine("房间号获取错误。"); + return null; + } + var apiUrl = "https://api.live.bilibili.com/room/v1/Room/playUrl?cid=" + roomid + "&otype=json"; + + //访问API获取结果 + var wc = new WebClient(); + wc.Headers.Add("Accept: */*"); + wc.Headers.Add("User-Agent: " + Ver.UA); + wc.Headers.Add("Accept-Language: zh-CN,zh;q=0.9,ja;q=0.8"); + if (!string.IsNullOrEmpty(MMPU.Cookie)) + { + wc.Headers.Add("Cookie", MMPU.Cookie); + } + string resultString; try @@ -335,7 +390,7 @@ public static string 下载地址(string roomid) //解析结果使用最高清晰度 try { - return JObject.Parse(resultString)["data"]["durl"][0]["url"].ToString(); + return JObject.Parse(resultString)["data"]["durl"][live]["url"].ToString(); } catch (Exception e) { diff --git a/DDTV_New/DDTV_New.csproj b/DDTV_New/DDTV_New.csproj index 71c3de066..b5a80fadb 100644 --- a/DDTV_New/DDTV_New.csproj +++ b/DDTV_New/DDTV_New.csproj @@ -74,6 +74,7 @@ + @@ -292,7 +293,7 @@ - + diff --git a/DDTV_New/MainWindow.xaml b/DDTV_New/MainWindow.xaml index 6b5451320..7eb8e5215 100644 --- a/DDTV_New/MainWindow.xaml +++ b/DDTV_New/MainWindow.xaml @@ -130,7 +130,7 @@ - + diff --git a/DDTV_New/MainWindow.xaml.cs b/DDTV_New/MainWindow.xaml.cs index a741d4501..c2aa24939 100644 --- a/DDTV_New/MainWindow.xaml.cs +++ b/DDTV_New/MainWindow.xaml.cs @@ -45,8 +45,17 @@ public MainWindow() 软件启动配置初始化(); icon(); MMPU.弹窗.IcoUpdate += A_IcoUpdate; + + System.Net.ServicePointManager.ServerCertificateValidationCallback += + delegate (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) + { + return true; // **** Always accept + }; + System.Net.ServicePointManager.DefaultConnectionLimit = 999;/*---------这里最重要--------*/ + System.Net.ServicePointManager.MaxServicePoints = 999; } + public void 软件启动配置初始化() { //检查配置文件 @@ -86,7 +95,15 @@ public void 软件启动配置初始化() #region BiliUser配置文件初始化 //账号登陆cookie - MMPU.Cookie = MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile); + + try + { + MMPU.Cookie = string.IsNullOrEmpty(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile)) ? "" : Encryption.UnAesStr(MMPU.读ini配置文件("User", "Cookie", MMPU.BiliUserFile), MMPU.AESKey, MMPU.AESVal); + } + catch (Exception) + { + MMPU.Cookie = ""; + } //账号UID MMPU.UID = MMPU.读ini配置文件("User", "UID", MMPU.BiliUserFile); //string.IsNullOrEmpty(MMPU.读取exe默认配置文件("UID", "")) ? null : MMPU.读取exe默认配置文件("UID", ""); //账号登陆cookie的有效期 @@ -279,6 +296,16 @@ public void 软件启动配置初始化() } //增加插件列表 { + + PluginC.Items.Add(new + { + 编号 = "0", + 名称 = "DDTV", + 版本 = MMPU.版本号, + 是否加载 = "强制", + 说明 = "本软件的所有必须内容()", + 备注 = "" + }); PluginC.Items.Add(new { 编号 = "1", @@ -311,7 +338,7 @@ public void 软件启动配置初始化() 编号 = "4", 名称 = "弹幕录制工具", 版本 = "1.0.0.1", - 是否加载 = "√", + 是否加载 = "X", 说明 = "用于录制直播弹幕内容(工具箱内)", 备注 = "调试中的功能,还没写完" }); @@ -322,7 +349,7 @@ public void 软件启动配置初始化() 版本 = "2.2.0.12", 是否加载 = "√", 说明 = "用于处理B站账号类的操作", - 备注 = "引用GITHUB @LeoChen98/BiliAccount" + 备注 = "基于MIT授权引用GITHUB @LeoChen98/BiliAccount" }); } @@ -826,6 +853,14 @@ private void 直播表双击事件(object sender, MouseButtonEventArgs e) } public void 打开直播列表(Downloader DL) { + //System.Diagnostics.Process p = new System.Diagnostics.Process(); + //p.StartInfo.FileName = @"D:\Program Files (x86)\Pure Codec\x64\PotPlayerMini64.exe";//需要启动的程序名 + //p.StartInfo.Arguments = " \""+DL.DownIofo.下载地址+"\"";//启动参数 + //p.Start();//启动 + + //return; + + if (DL != null) { DL.DownIofo.播放状态 = true; @@ -1462,7 +1497,7 @@ private void 播放本地视频文件按钮_Click(object sender, RoutedEventArgs private void 播放缓冲时长_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { - 检测输入框是否为数字((System.Windows.Controls.TextBox)sender, 60, 2); + 检测输入框是否为数字((System.Windows.Controls.TextBox)sender, 60, 1); } private void 修改播放缓冲时长确定按钮点击事件(object sender, RoutedEventArgs e) diff --git a/DDTV_New/RoomInit.cs b/DDTV_New/RoomInit.cs index a6a518bac..582af2f01 100644 --- a/DDTV_New/RoomInit.cs +++ b/DDTV_New/RoomInit.cs @@ -102,14 +102,14 @@ private static void 刷新B站房间列表() { if (之前的状态.直播状态 == false && 最新的状态.直播状态 == true && 之前的状态.是否提醒) { - MMPU.弹窗.Add(3000, "直播提醒", 最新的状态.名称 + "的直播状态发生了变化"); + MMPU.弹窗.Add(3000, "直播提醒", 最新的状态.名称 + "/" + 最新的状态.原名 + "的直播状态发生了变化"); } if (之前的状态.直播状态 == false && 最新的状态.直播状态 == true && 之前的状态.是否录制 == true) { - MMPU.弹窗.Add(3000, "自动录制", 最新的状态.名称 + "开始直播了,开始自动录制"); + MMPU.弹窗.Add(3000, "自动录制", 最新的状态.名称 + "/" + 最新的状态.原名 + "开始直播了,开始自动录制"); Console.WriteLine(最新的状态.名称); - Downloader.新建下载对象(之前的状态.平台, 之前的状态.唯一码, bilibili.根据房间号获取房间信息.获取标题(之前的状态.唯一码), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(之前的状态.唯一码), "自动录制", true).DownIofo.备注="自动录制下载中"; + Downloader.新建下载对象(之前的状态.平台, 之前的状态.唯一码, bilibili.根据房间号获取房间信息.获取标题(之前的状态.唯一码), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(之前的状态.唯一码), "自动录制", true).DownIofo.备注 = "自动录制下载中"; } break; } diff --git a/DDTV_New/window/BiliLoginWindowQR.xaml.cs b/DDTV_New/window/BiliLoginWindowQR.xaml.cs index 61e51e817..c6b7dc6cf 100644 --- a/DDTV_New/window/BiliLoginWindowQR.xaml.cs +++ b/DDTV_New/window/BiliLoginWindowQR.xaml.cs @@ -40,7 +40,7 @@ private void ByQRCode_QrCodeRefresh(Bitmap newQrCode) private void ByQRCode_QrCodeStatus_Changed(ByQRCode.QrCodeStatus status, Account account = null) { - if (account != null) + if (status == ByQRCode.QrCodeStatus.Success) { Plugin.BilibiliAccount.account = account; Console.WriteLine(status); @@ -49,19 +49,19 @@ private void ByQRCode_QrCodeStatus_Changed(ByQRCode.QrCodeStatus status, Account MMPU.写ini配置文件("User", "UID", MMPU.UID, MMPU.BiliUserFile); foreach (var item in account.Cookies) { - MMPU.Cookie = MMPU.Cookie + item.ToString() + ";"; + MMPU.Cookie = MMPU.Cookie + item + ";"; } MMPU.CookieEX = account.Expires_Cookies; MMPU.csrf = account.CsrfToken; + ; MMPU.写ini配置文件("User", "csrf", MMPU.csrf, MMPU.BiliUserFile); - MMPU.写ini配置文件("User", "Cookie", MMPU.Cookie, MMPU.BiliUserFile); + MMPU.写ini配置文件("User", "Cookie", Encryption.AesStr(MMPU.Cookie, MMPU.AESKey, MMPU.AESVal), MMPU.BiliUserFile); MMPU.写ini配置文件("User", "CookieEX", MMPU.CookieEX.ToString(), MMPU.BiliUserFile); Dispatcher.Invoke(new Action(delegate { Close(); })); } - } [System.Runtime.InteropServices.DllImport("gdi32.dll")] diff --git "a/DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1.txt" "b/DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1c.txt" similarity index 88% rename from "DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1.txt" rename to "DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1c.txt" index a971556a6..6e3b62d88 100644 --- "a/DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1.txt" +++ "b/DDTV_New/\346\233\264\346\226\260\346\227\245\345\277\227/2.0.2.1c.txt" @@ -1,4 +1,8 @@ -2.0.2.1更新内容 +2.0.2.1c对比2.0.2.1b更新内容 +【重要重要】修复了录制和播放都会缓冲成一地玻璃渣的问题,现在稳定性upup + + +2.0.2.1对比2.0.2.0更新内容 增加: 1.增加基于网络的一键监控功能。可以使用vtbs.moe的网络数据进行一键增加监控列表,不用手动填写了。 2.增加了扫码登陆功能,理论上购买过付费直播门票的用户登陆后也可以使用DDTV进行观看(已测试) diff --git a/PlayW/MainWindow.xaml.cs b/PlayW/MainWindow.xaml.cs index fb35da98f..45f51af3c 100644 --- a/PlayW/MainWindow.xaml.cs +++ b/PlayW/MainWindow.xaml.cs @@ -291,7 +291,32 @@ private void 播放到达结尾触发事件(object sender, Vlc.DotNet.Core.VlcMe { if (播放状态) { - 刷新播放("直播源推流停止或卡顿,正在尝试重连(或延长设置里“默认缓冲时长”的时间)"); + //if(!string.IsNullOrEmpty(DD.DownIofo.重连文件路径)) + //{ + // try + // { + // new Task(() => + // { + // this.VlcControl.SourceProvider.MediaPlayer.Stop();//这里要开线程处理,不然会阻塞播放 + // this.VlcControl.SourceProvider.MediaPlayer.Play(new Uri(DD.DownIofo.重连文件路径)); + // DD.DownIofo.重连文件路径 = null; + // }).Start(); + + // } + // catch (Exception) + // { + + // return; + // } + + + //} + //else + { + 刷新播放("直播源推流停止或卡顿,正在尝试重连(或延长设置里“默认缓冲时长”的时间)"); + } + + } } public void 刷新播放(string 提示内容) @@ -313,7 +338,7 @@ public void 刷新播放(string 提示内容) DD.DownIofo.WC.CancelAsync(); DD.DownIofo.备注 = "播放刷新"; DD.DownIofo.下载状态 = false; - Downloader 下载对象 = Downloader.新建下载对象(DD.DownIofo.平台, DD.DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DD.DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(DD.DownIofo.房间_频道号), "播放缓冲重连", false); + Downloader 下载对象 = Downloader.新建下载对象(DD.DownIofo.平台, DD.DownIofo.房间_频道号, bilibili.根据房间号获取房间信息.获取标题(DD.DownIofo.房间_频道号), Guid.NewGuid().ToString(), bilibili.根据房间号获取房间信息.下载地址(DD.DownIofo.房间_频道号,1), "播放缓冲重连", false); MMPU.文件删除委托(DD.DownIofo.文件保存路径); DD = 下载对象; for (int i = 0; i < MMPU.播放缓冲时长; i++) diff --git a/README.md b/README.md index 4ef055138..b13719746 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ DDNA列表(各平台当前直播情况): 在正在播放的窗口中只有最先打开的窗口是使用CPU硬件解码,后面打开的播放窗口将会因为是软件解码模式而使用更多系统资源,当使用的资源达到某个系统瓶颈后可能卡顿。 如果使用高DPI,使用系统全局缩放非100%的情况下可能会出现显示错误 -# FA♂Q -有啥问题想到再写( +# 使用到的第三方组件 +* [BiliAccount](https://github.com/LeoChen98/BiliAccount) # 捐助 ### 捐助表示您对我这个项目的认可,也能激励我继续开发更多好的项目