diff --git a/BililiveRecorder.Core/Api/Model/RoomInfo.cs b/BililiveRecorder.Core/Api/Model/RoomInfo.cs index af77b01..98442b9 100644 --- a/BililiveRecorder.Core/Api/Model/RoomInfo.cs +++ b/BililiveRecorder.Core/Api/Model/RoomInfo.cs @@ -28,6 +28,9 @@ namespace BililiveRecorder.Core.Api.Model public class InnerRoomInfo { + [JsonProperty("uid")] + public long Uid { get; set; } + [JsonProperty("room_id")] public int RoomId { get; set; } diff --git a/BililiveRecorder.Core/IRoom.cs b/BililiveRecorder.Core/IRoom.cs index 742ad1b..7106de8 100644 --- a/BililiveRecorder.Core/IRoom.cs +++ b/BililiveRecorder.Core/IRoom.cs @@ -15,6 +15,7 @@ namespace BililiveRecorder.Core int ShortId { get; } string Name { get; } + long Uid { get;} string Title { get; } string AreaNameParent { get; } string AreaNameChild { get; } diff --git a/BililiveRecorder.Core/Recording/RecordTaskBase.cs b/BililiveRecorder.Core/Recording/RecordTaskBase.cs index a43af48..1c98620 100644 --- a/BililiveRecorder.Core/Recording/RecordTaskBase.cs +++ b/BililiveRecorder.Core/Recording/RecordTaskBase.cs @@ -190,6 +190,7 @@ namespace BililiveRecorder.Core.Recording Title = FileNameGenerator.RemoveInvalidFileName(this.room.Title, ignore_slash: false), RoomId = this.room.RoomConfig.RoomId, ShortId = this.room.ShortId, + Uid = this.room.Uid, AreaParent = FileNameGenerator.RemoveInvalidFileName(this.room.AreaNameParent, ignore_slash: false), AreaChild = FileNameGenerator.RemoveInvalidFileName(this.room.AreaNameChild, ignore_slash: false), PartIndex = this.partIndex, diff --git a/BililiveRecorder.Core/Room.cs b/BililiveRecorder.Core/Room.cs index b910248..ee44c26 100644 --- a/BililiveRecorder.Core/Room.cs +++ b/BililiveRecorder.Core/Room.cs @@ -46,6 +46,7 @@ namespace BililiveRecorder.Core private int shortId; private string name = string.Empty; + private long uid; private string title = string.Empty; private string areaNameParent = string.Empty; private string areaNameChild = string.Empty; @@ -101,6 +102,7 @@ namespace BililiveRecorder.Core public int ShortId { get => this.shortId; private set => this.SetField(ref this.shortId, value); } public string Name { get => this.name; private set => this.SetField(ref this.name, value); } + public long Uid { get => this.uid; private set => this.SetField(ref this.uid, value); } public string Title { get => this.title; private set => this.SetField(ref this.title, value); } public string AreaNameParent { get => this.areaNameParent; private set => this.SetField(ref this.areaNameParent, value); } public string AreaNameChild { get => this.areaNameChild; private set => this.SetField(ref this.areaNameChild, value); } @@ -209,6 +211,7 @@ namespace BililiveRecorder.Core { this.RoomConfig.RoomId = room.Room.RoomId; this.ShortId = room.Room.ShortId; + this.Uid = room.Room.Uid; this.Title = room.Room.Title; this.AreaNameParent = room.Room.ParentAreaName; this.AreaNameChild = room.Room.AreaName; @@ -542,8 +545,7 @@ retry: if (this.RoomConfig.DanmakuAuthenticateWithStreamerUid) { var obj = JObject.Parse(json); - // TODO add uid to property of IRoom - obj["uid"] = this.RawBilibiliApiJsonData?["room_info"]?["uid"]?.ToObject() ?? 0; + obj["uid"] = this.Uid; // delete token obj.Remove("key"); json = obj.ToString(Formatting.None); diff --git a/BililiveRecorder.Core/Scripting/Runtime/JintRoomInfo.cs b/BililiveRecorder.Core/Scripting/Runtime/JintRoomInfo.cs index 5d338fc..226ed27 100644 --- a/BililiveRecorder.Core/Scripting/Runtime/JintRoomInfo.cs +++ b/BililiveRecorder.Core/Scripting/Runtime/JintRoomInfo.cs @@ -15,6 +15,7 @@ namespace BililiveRecorder.Core.Scripting.Runtime this.FastSetProperty("roomId", new PropertyDescriptor(room.RoomConfig.RoomId, false, true, false)); this.FastSetProperty("shortId", new PropertyDescriptor(room.ShortId, false, true, false)); this.FastSetProperty("name", new PropertyDescriptor(room.Name, false, true, false)); + this.FastSetProperty("uid", new PropertyDescriptor(room.Uid.ToString(), false, true, false)); this.FastSetProperty("title", new PropertyDescriptor(room.Title, false, true, false)); this.FastSetProperty("areaParent", new PropertyDescriptor(room.AreaNameParent, false, true, false)); this.FastSetProperty("areaChild", new PropertyDescriptor(room.AreaNameChild, false, true, false)); diff --git a/BililiveRecorder.Core/Templating/FileNameTemplateContext.cs b/BililiveRecorder.Core/Templating/FileNameTemplateContext.cs index 793d84e..2b9b623 100644 --- a/BililiveRecorder.Core/Templating/FileNameTemplateContext.cs +++ b/BililiveRecorder.Core/Templating/FileNameTemplateContext.cs @@ -10,6 +10,8 @@ namespace BililiveRecorder.Core.Templating public string Name { get; set; } = string.Empty; + public long Uid { get; set; } + public string Title { get; set; } = string.Empty; public string AreaParent { get; set; } = string.Empty; diff --git a/BililiveRecorder.WPF/Pages/SettingsPage.xaml.cs b/BililiveRecorder.WPF/Pages/SettingsPage.xaml.cs index a1d0d84..08bb163 100644 --- a/BililiveRecorder.WPF/Pages/SettingsPage.xaml.cs +++ b/BililiveRecorder.WPF/Pages/SettingsPage.xaml.cs @@ -20,6 +20,7 @@ namespace BililiveRecorder.WPF.Pages Name = "3号直播间", RoomId = 23058, ShortId = 3, + Uid = 11153765, Title = "哔哩哔哩音悦台", AreaParent = "电台", AreaChild = "唱见电台", diff --git a/BililiveRecorder.Web/Models/Graphql/RoomType.cs b/BililiveRecorder.Web/Models/Graphql/RoomType.cs index 812e848..ab35251 100644 --- a/BililiveRecorder.Web/Models/Graphql/RoomType.cs +++ b/BililiveRecorder.Web/Models/Graphql/RoomType.cs @@ -11,6 +11,7 @@ namespace BililiveRecorder.Web.Models.Graphql this.Field(x => x.RoomConfig, type: typeof(RoomConfigType)); this.Field(x => x.ShortId); this.Field(x => x.Name); + this.Field(x => x.Uid); this.Field(x => x.Title); this.Field(x => x.AreaNameParent); this.Field(x => x.AreaNameChild); diff --git a/BililiveRecorder.Web/Models/Rest/FileNameTemplateContextDto.cs b/BililiveRecorder.Web/Models/Rest/FileNameTemplateContextDto.cs index 904457e..61e2b9a 100644 --- a/BililiveRecorder.Web/Models/Rest/FileNameTemplateContextDto.cs +++ b/BililiveRecorder.Web/Models/Rest/FileNameTemplateContextDto.cs @@ -5,6 +5,7 @@ namespace BililiveRecorder.Web.Models.Rest public int RoomId { get; set; } public int ShortId { get; set; } public string Name { get; set; } = string.Empty; + public long Uid { get; set; } public string Title { get; set; } = string.Empty; public string AreaParent { get; set; } = string.Empty; public string AreaChild { get; set; } = string.Empty; diff --git a/BililiveRecorder.Web/Models/Rest/RoomDto.cs b/BililiveRecorder.Web/Models/Rest/RoomDto.cs index 7df11c9..9ba0f81 100644 --- a/BililiveRecorder.Web/Models/Rest/RoomDto.cs +++ b/BililiveRecorder.Web/Models/Rest/RoomDto.cs @@ -9,6 +9,7 @@ namespace BililiveRecorder.Web.Models.Rest public bool AutoRecord { get; set; } public int ShortId { get; set; } public string? Name { get; set; } + public long Uid { get; set; } public string? Title { get; set; } public string? AreaNameParent { get; set; } public string? AreaNameChild { get; set; }