feat: add streamer uid to IRoom and other types

This commit is contained in:
genteure 2023-07-08 16:14:45 +08:00
parent 14c8fde4a4
commit 26ea02d944
10 changed files with 16 additions and 2 deletions

View File

@ -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; }

View File

@ -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; }

View File

@ -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,

View File

@ -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<int>() ?? 0;
obj["uid"] = this.Uid;
// delete token
obj.Remove("key");
json = obj.ToString(Formatting.None);

View File

@ -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));

View File

@ -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;

View File

@ -20,6 +20,7 @@ namespace BililiveRecorder.WPF.Pages
Name = "3号直播间",
RoomId = 23058,
ShortId = 3,
Uid = 11153765,
Title = "哔哩哔哩音悦台",
AreaParent = "电台",
AreaChild = "唱见电台",

View File

@ -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);

View File

@ -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;

View File

@ -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; }