@dan-uni/dan-any 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,6 +30,8 @@
30
30
 
31
31
  - [dan-any-plugin-detalu](https://github.com/ani-uni/danuni/tree/master/packages/dan-any-plugin-detalu): 基于pakku.js的弹幕过滤器
32
32
 
33
+ ## 特殊字段提示
34
+
33
35
  ### ASS Raw 字段
34
36
 
35
37
  为便于由ASS格式还原,由本工具生成的ASS弹幕格式中,包含以下字段:`RawCompressType` `RawBaseType` `Raw`
@@ -38,7 +40,8 @@
38
40
 
39
41
  ## TODO
40
42
 
41
- - [ ] 反向转换bili弹幕格式
43
+ - [ ] 完善弹幕降级显示功能(使高级弹幕有损转换为普通弹幕)
44
+ - [ ] 完善使用文档
42
45
 
43
46
  ## License 许可证
44
47
 
package/dist/index.js CHANGED
@@ -5218,7 +5218,8 @@ class UniDM {
5218
5218
  const pool = args.pool, extra = {
5219
5219
  bili: {
5220
5220
  mode: args.mode,
5221
- pool: args.pool
5221
+ pool: args.pool,
5222
+ dmid: args.id
5222
5223
  }
5223
5224
  };
5224
5225
  switch(args.mode){
@@ -5281,7 +5282,7 @@ class UniDM {
5281
5282
  return 1;
5282
5283
  }
5283
5284
  };
5284
- const rMode = recMode(this.mode, this.extra?.bili);
5285
+ const rMode = this.extra.bili?.mode || recMode(this.mode, this.extra?.bili);
5285
5286
  let content;
5286
5287
  switch(rMode){
5287
5288
  case 7:
@@ -5305,9 +5306,9 @@ class UniDM {
5305
5306
  this.fontsize,
5306
5307
  this.color,
5307
5308
  this.ctime.getTime() / 1000,
5308
- this.pool,
5309
+ this.extra.bili?.pool || this.pool,
5309
5310
  this.senderID,
5310
- this.DMID || this.toDMID(),
5311
+ this.extra.bili?.dmid || this.DMID || this.toDMID(),
5311
5312
  this.weight
5312
5313
  ].join(',')
5313
5314
  };
@@ -19263,7 +19263,8 @@
19263
19263
  const pool = args.pool, extra = {
19264
19264
  bili: {
19265
19265
  mode: args.mode,
19266
- pool: args.pool
19266
+ pool: args.pool,
19267
+ dmid: args.id
19267
19268
  }
19268
19269
  };
19269
19270
  switch(args.mode){
@@ -19326,7 +19327,7 @@
19326
19327
  return 1;
19327
19328
  }
19328
19329
  };
19329
- const rMode = recMode(this.mode, this.extra?.bili);
19330
+ const rMode = this.extra.bili?.mode || recMode(this.mode, this.extra?.bili);
19330
19331
  let content;
19331
19332
  switch(rMode){
19332
19333
  case 7:
@@ -19350,9 +19351,9 @@
19350
19351
  this.fontsize,
19351
19352
  this.color,
19352
19353
  this.ctime.getTime() / 1000,
19353
- this.pool,
19354
+ this.extra.bili?.pool || this.pool,
19354
19355
  this.senderID,
19355
- this.DMID || this.toDMID(),
19356
+ this.extra.bili?.dmid || this.DMID || this.toDMID(),
19356
19357
  this.weight
19357
19358
  ].join(',')
19358
19359
  };
@@ -86,6 +86,7 @@ interface ExtraArtplayer {
86
86
  interface ExtraBili {
87
87
  mode?: number;
88
88
  pool?: number;
89
+ dmid?: bigint;
89
90
  adv?: string;
90
91
  code?: string;
91
92
  bas?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-uni/dan-any",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "A danmaku transformer lib, supporting danmaku from different platforms.",
5
5
  "keywords": [
6
6
  "bangumi",
@@ -217,6 +217,7 @@ interface ExtraArtplayer {
217
217
  interface ExtraBili {
218
218
  mode?: number //原弹幕类型
219
219
  pool?: number //原弹幕池
220
+ dmid?: bigint //原弹幕ID
220
221
  adv?: string
221
222
  code?: string
222
223
  bas?: string
@@ -658,7 +659,9 @@ export class UniDM {
658
659
  senderID = ID.fromBili({ midHash: args.midHash })
659
660
  let mode = Modes.Normal
660
661
  const pool = args.pool, //暂时不做处理,兼容bili的pool格式
661
- extra: TExtra = { bili: { mode: args.mode, pool: args.pool } }
662
+ extra: TExtra = {
663
+ bili: { mode: args.mode, pool: args.pool, dmid: args.id },
664
+ }
662
665
  //重复 transMode ,但此处有关于extra的额外处理
663
666
  switch (args.mode) {
664
667
  case 4:
@@ -687,9 +690,6 @@ export class UniDM {
687
690
  mode = Modes.Normal
688
691
  break
689
692
  }
690
- // if (args.mode === 7) extra.bili.adv = args.content
691
- // else if (args.mode === 8) extra.bili.code = args.content
692
- // else if (args.mode === 9) extra.bili.bas = args.content
693
693
  return this.create({
694
694
  ...args,
695
695
  SOID: SOID.toString(),
@@ -732,7 +732,7 @@ export class UniDM {
732
732
  return 1
733
733
  }
734
734
  }
735
- const rMode = recMode(this.mode, this.extra?.bili)
735
+ const rMode = this.extra.bili?.mode || recMode(this.mode, this.extra?.bili)
736
736
  let content
737
737
  switch (rMode) {
738
738
  case 7:
@@ -756,9 +756,9 @@ export class UniDM {
756
756
  this.fontsize,
757
757
  this.color,
758
758
  this.ctime.getTime() / 1000,
759
- this.pool, // 目前pool与bili兼容
759
+ this.extra.bili?.pool || this.pool, // 目前pool与bili兼容
760
760
  this.senderID,
761
- this.DMID || this.toDMID(),
761
+ this.extra.bili?.dmid || this.DMID || this.toDMID(),
762
762
  this.weight,
763
763
  ].join(','),
764
764
  }