@dan-uni/dan-any 1.3.5 → 1.3.7
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 +9 -0
- package/dist/browser/index.min.js +9 -9
- package/dist/browser/src/index.d.ts +2 -2
- package/dist/node/index.js +9 -9
- package/dist/node/src/index.d.ts +2 -2
- package/dist/umd/index.umd.min.js +9 -9
- package/dist/umd/plugins/bili.umd.min.js +9 -9
- package/dist/umd/plugins/index.umd.min.js +9 -9
- package/dist/umd/src/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/index.ts +11 -11
package/README.md
CHANGED
|
@@ -31,6 +31,15 @@
|
|
|
31
31
|
- [dan-any-plugin-detaolu](https://github.com/ani-uni/danuni/tree/master/packages/dan-any-plugin-detaolu): 基于pakku.js的弹幕过滤器
|
|
32
32
|
- `src/plugins`下的插件 `bili`(B站弹幕相关) `stats`(统计相关),内部附有使用文档
|
|
33
33
|
|
|
34
|
+
## 转换提示
|
|
35
|
+
|
|
36
|
+
使用该库可以不失去任何关键信息地导入常见格式的弹幕,并已附加字段的形式保留部分弹幕格式专有的信息;但将弹幕转换为第三方格式时,由于其设计上无法封装附加信息,会导致不可避免的信息损失。
|
|
37
|
+
如果需要以最为可靠的方式传送弹幕,请尽量使用 `danuni.json` / `danuni.binpb` 进行导出分发。
|
|
38
|
+
|
|
39
|
+
由于设计上想尽可能多地保留原始信息,将弹幕转换为第三方格式的弹幕时,可能在非常用字段上与官方格式不完全相同,若有极强的兼容性需求,请手动开启对应转换函数的兼容性选项。
|
|
40
|
+
|
|
41
|
+
*致开发者: 若导入后检测到 `UniPool.info.fromConverted` 为true ,建议提示用户不要再对该弹幕文件再次进行转换,否则可能导致解析错误*
|
|
42
|
+
|
|
34
43
|
## 特殊字段提示
|
|
35
44
|
|
|
36
45
|
### ASS Raw 字段
|
|
@@ -11461,7 +11461,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
11461
11461
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
11462
11462
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
11463
11463
|
});
|
|
11464
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
11464
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
11465
11465
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
11466
11466
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
11467
11467
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -12976,9 +12976,6 @@ class UniPool {
|
|
|
12976
12976
|
}
|
|
12977
12977
|
return new UniPool(result, this.options, this.info);
|
|
12978
12978
|
}
|
|
12979
|
-
minify() {
|
|
12980
|
-
return this.dans.map((d)=>d.minify());
|
|
12981
|
-
}
|
|
12982
12979
|
static import(file, options, mod) {
|
|
12983
12980
|
const handlers = {
|
|
12984
12981
|
["danuni.json"]: (json)=>({
|
|
@@ -13187,6 +13184,9 @@ class UniPool {
|
|
|
13187
13184
|
}
|
|
13188
13185
|
}
|
|
13189
13186
|
}
|
|
13187
|
+
minify() {
|
|
13188
|
+
return this.dans.map((d)=>d.minify());
|
|
13189
|
+
}
|
|
13190
13190
|
static fromMin(json, options) {
|
|
13191
13191
|
return new UniPool(json.map((d)=>UniDM.create(d, options)));
|
|
13192
13192
|
}
|
|
@@ -13240,7 +13240,7 @@ class UniPool {
|
|
|
13240
13240
|
}
|
|
13241
13241
|
toBiliXML(options) {
|
|
13242
13242
|
const genCID = (id)=>{
|
|
13243
|
-
const UniID = id_gen_UniID.fromString(id);
|
|
13243
|
+
const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
|
|
13244
13244
|
if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
|
|
13245
13245
|
const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
|
|
13246
13246
|
if (cid) return cid;
|
|
@@ -13261,7 +13261,7 @@ class UniPool {
|
|
|
13261
13261
|
},
|
|
13262
13262
|
i: {
|
|
13263
13263
|
chatserver: 'chat.bilibili.com',
|
|
13264
|
-
chatid: genCID(this.dans[0]
|
|
13264
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
13265
13265
|
mission: 0,
|
|
13266
13266
|
maxlimit: this.dans.length,
|
|
13267
13267
|
state: 0,
|
|
@@ -13323,7 +13323,7 @@ class UniPool {
|
|
|
13323
13323
|
code: 0,
|
|
13324
13324
|
danuni: {
|
|
13325
13325
|
...DanUniConvertTipTemplate,
|
|
13326
|
-
data: this.dans[0]
|
|
13326
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
13327
13327
|
},
|
|
13328
13328
|
data: this.dans.map((dan)=>{
|
|
13329
13329
|
const d = dan.toDplayer();
|
|
@@ -13352,7 +13352,7 @@ class UniPool {
|
|
|
13352
13352
|
return {
|
|
13353
13353
|
danuni: {
|
|
13354
13354
|
...DanUniConvertTipTemplate,
|
|
13355
|
-
data: this.dans[0]
|
|
13355
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
13356
13356
|
},
|
|
13357
13357
|
danmuku: this.dans.map((dan)=>{
|
|
13358
13358
|
const d = dan.toArtplayer();
|
|
@@ -13383,7 +13383,7 @@ class UniPool {
|
|
|
13383
13383
|
});
|
|
13384
13384
|
}
|
|
13385
13385
|
toDDPlay() {
|
|
13386
|
-
const episodeId = this.dans[0]
|
|
13386
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
13387
13387
|
return {
|
|
13388
13388
|
danuni: {
|
|
13389
13389
|
...DanUniConvertTipTemplate,
|
|
@@ -214,7 +214,6 @@ export declare class UniPool {
|
|
|
214
214
|
* @param lifetime 查重时间区段,单位秒 (默认为 0,表示不查重)
|
|
215
215
|
*/
|
|
216
216
|
merge(lifetime?: number): UniPool;
|
|
217
|
-
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
218
217
|
static import(file: unknown, options?: Options,
|
|
219
218
|
/**
|
|
220
219
|
* 加载指定解析模块,为空则全选,为字符串则视为文件名解析加载模块
|
|
@@ -223,8 +222,9 @@ export declare class UniPool {
|
|
|
223
222
|
pool: UniPool;
|
|
224
223
|
fmt: DM_format;
|
|
225
224
|
};
|
|
226
|
-
convert2
|
|
225
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
226
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
|
+
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
230
230
|
/**
|
package/dist/node/index.js
CHANGED
|
@@ -39,7 +39,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
39
39
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
40
40
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
41
41
|
});
|
|
42
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
42
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
43
43
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
44
44
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
45
45
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -1551,9 +1551,6 @@ class UniPool {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
return new UniPool(result, this.options, this.info);
|
|
1553
1553
|
}
|
|
1554
|
-
minify() {
|
|
1555
|
-
return this.dans.map((d)=>d.minify());
|
|
1556
|
-
}
|
|
1557
1554
|
static import(file, options, mod) {
|
|
1558
1555
|
const handlers = {
|
|
1559
1556
|
["danuni.json"]: (json)=>({
|
|
@@ -1762,6 +1759,9 @@ class UniPool {
|
|
|
1762
1759
|
}
|
|
1763
1760
|
}
|
|
1764
1761
|
}
|
|
1762
|
+
minify() {
|
|
1763
|
+
return this.dans.map((d)=>d.minify());
|
|
1764
|
+
}
|
|
1765
1765
|
static fromMin(json, options) {
|
|
1766
1766
|
return new UniPool(json.map((d)=>UniDM.create(d, options)));
|
|
1767
1767
|
}
|
|
@@ -1815,7 +1815,7 @@ class UniPool {
|
|
|
1815
1815
|
}
|
|
1816
1816
|
toBiliXML(options) {
|
|
1817
1817
|
const genCID = (id)=>{
|
|
1818
|
-
const UniID = id_gen_UniID.fromString(id);
|
|
1818
|
+
const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
|
|
1819
1819
|
if (UniID.domain === platform_PlatformVideoSource.Bilibili) {
|
|
1820
1820
|
const cid = UniID.id.replaceAll(`def_${platform_PlatformVideoSource.Bilibili}+`, '');
|
|
1821
1821
|
if (cid) return cid;
|
|
@@ -1836,7 +1836,7 @@ class UniPool {
|
|
|
1836
1836
|
},
|
|
1837
1837
|
i: {
|
|
1838
1838
|
chatserver: 'chat.bilibili.com',
|
|
1839
|
-
chatid: genCID(this.dans[0]
|
|
1839
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
1840
1840
|
mission: 0,
|
|
1841
1841
|
maxlimit: this.dans.length,
|
|
1842
1842
|
state: 0,
|
|
@@ -1898,7 +1898,7 @@ class UniPool {
|
|
|
1898
1898
|
code: 0,
|
|
1899
1899
|
danuni: {
|
|
1900
1900
|
...DanUniConvertTipTemplate,
|
|
1901
|
-
data: this.dans[0]
|
|
1901
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
1902
1902
|
},
|
|
1903
1903
|
data: this.dans.map((dan)=>{
|
|
1904
1904
|
const d = dan.toDplayer();
|
|
@@ -1927,7 +1927,7 @@ class UniPool {
|
|
|
1927
1927
|
return {
|
|
1928
1928
|
danuni: {
|
|
1929
1929
|
...DanUniConvertTipTemplate,
|
|
1930
|
-
data: this.dans[0]
|
|
1930
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
1931
1931
|
},
|
|
1932
1932
|
danmuku: this.dans.map((dan)=>{
|
|
1933
1933
|
const d = dan.toArtplayer();
|
|
@@ -1958,7 +1958,7 @@ class UniPool {
|
|
|
1958
1958
|
});
|
|
1959
1959
|
}
|
|
1960
1960
|
toDDPlay() {
|
|
1961
|
-
const episodeId = this.dans[0]
|
|
1961
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
1962
1962
|
return {
|
|
1963
1963
|
danuni: {
|
|
1964
1964
|
...DanUniConvertTipTemplate,
|
package/dist/node/src/index.d.ts
CHANGED
|
@@ -214,7 +214,6 @@ export declare class UniPool {
|
|
|
214
214
|
* @param lifetime 查重时间区段,单位秒 (默认为 0,表示不查重)
|
|
215
215
|
*/
|
|
216
216
|
merge(lifetime?: number): UniPool;
|
|
217
|
-
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
218
217
|
static import(file: unknown, options?: Options,
|
|
219
218
|
/**
|
|
220
219
|
* 加载指定解析模块,为空则全选,为字符串则视为文件名解析加载模块
|
|
@@ -223,8 +222,9 @@ export declare class UniPool {
|
|
|
223
222
|
pool: UniPool;
|
|
224
223
|
fmt: DM_format;
|
|
225
224
|
};
|
|
226
|
-
convert2
|
|
225
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
226
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
|
+
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
230
230
|
/**
|
|
@@ -21770,7 +21770,7 @@ and limitations under the License.
|
|
|
21770
21770
|
function timestamp_timestampMs(timestamp) {
|
|
21771
21771
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21772
21772
|
}
|
|
21773
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
21773
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21774
21774
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21775
21775
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21776
21776
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -25464,9 +25464,6 @@ and limitations under the License.
|
|
|
25464
25464
|
}
|
|
25465
25465
|
return new UniPool(result, this.options, this.info);
|
|
25466
25466
|
}
|
|
25467
|
-
minify() {
|
|
25468
|
-
return this.dans.map((d)=>d.minify());
|
|
25469
|
-
}
|
|
25470
25467
|
static import(file, options, mod) {
|
|
25471
25468
|
const handlers = {
|
|
25472
25469
|
["danuni.json"]: (json)=>({
|
|
@@ -25675,6 +25672,9 @@ and limitations under the License.
|
|
|
25675
25672
|
}
|
|
25676
25673
|
}
|
|
25677
25674
|
}
|
|
25675
|
+
minify() {
|
|
25676
|
+
return this.dans.map((d)=>d.minify());
|
|
25677
|
+
}
|
|
25678
25678
|
static fromMin(json, options) {
|
|
25679
25679
|
return new UniPool(json.map((d)=>UniDM.create(d, options)));
|
|
25680
25680
|
}
|
|
@@ -25728,7 +25728,7 @@ and limitations under the License.
|
|
|
25728
25728
|
}
|
|
25729
25729
|
toBiliXML(options) {
|
|
25730
25730
|
const genCID = (id)=>{
|
|
25731
|
-
const UniID = id_gen_UniID.fromString(id);
|
|
25731
|
+
const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
|
|
25732
25732
|
if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
|
|
25733
25733
|
const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
|
|
25734
25734
|
if (cid) return cid;
|
|
@@ -25749,7 +25749,7 @@ and limitations under the License.
|
|
|
25749
25749
|
},
|
|
25750
25750
|
i: {
|
|
25751
25751
|
chatserver: 'chat.bilibili.com',
|
|
25752
|
-
chatid: genCID(this.dans[0]
|
|
25752
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
25753
25753
|
mission: 0,
|
|
25754
25754
|
maxlimit: this.dans.length,
|
|
25755
25755
|
state: 0,
|
|
@@ -25811,7 +25811,7 @@ and limitations under the License.
|
|
|
25811
25811
|
code: 0,
|
|
25812
25812
|
danuni: {
|
|
25813
25813
|
...DanUniConvertTipTemplate,
|
|
25814
|
-
data: this.dans[0]
|
|
25814
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25815
25815
|
},
|
|
25816
25816
|
data: this.dans.map((dan)=>{
|
|
25817
25817
|
const d = dan.toDplayer();
|
|
@@ -25840,7 +25840,7 @@ and limitations under the License.
|
|
|
25840
25840
|
return {
|
|
25841
25841
|
danuni: {
|
|
25842
25842
|
...DanUniConvertTipTemplate,
|
|
25843
|
-
data: this.dans[0]
|
|
25843
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25844
25844
|
},
|
|
25845
25845
|
danmuku: this.dans.map((dan)=>{
|
|
25846
25846
|
const d = dan.toArtplayer();
|
|
@@ -25871,7 +25871,7 @@ and limitations under the License.
|
|
|
25871
25871
|
});
|
|
25872
25872
|
}
|
|
25873
25873
|
toDDPlay() {
|
|
25874
|
-
const episodeId = this.dans[0]
|
|
25874
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25875
25875
|
return {
|
|
25876
25876
|
danuni: {
|
|
25877
25877
|
...DanUniConvertTipTemplate,
|
|
@@ -21060,7 +21060,7 @@
|
|
|
21060
21060
|
function timestamp_timestampMs(timestamp) {
|
|
21061
21061
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21062
21062
|
}
|
|
21063
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
21063
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21064
21064
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21065
21065
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21066
21066
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -24720,9 +24720,6 @@
|
|
|
24720
24720
|
}
|
|
24721
24721
|
return new UniPool(result, this.options, this.info);
|
|
24722
24722
|
}
|
|
24723
|
-
minify() {
|
|
24724
|
-
return this.dans.map((d)=>d.minify());
|
|
24725
|
-
}
|
|
24726
24723
|
static import(file, options, mod) {
|
|
24727
24724
|
const handlers = {
|
|
24728
24725
|
["danuni.json"]: (json)=>({
|
|
@@ -24931,6 +24928,9 @@
|
|
|
24931
24928
|
}
|
|
24932
24929
|
}
|
|
24933
24930
|
}
|
|
24931
|
+
minify() {
|
|
24932
|
+
return this.dans.map((d)=>d.minify());
|
|
24933
|
+
}
|
|
24934
24934
|
static fromMin(json, options) {
|
|
24935
24935
|
return new UniPool(json.map((d)=>UniDM.create(d, options)));
|
|
24936
24936
|
}
|
|
@@ -24984,7 +24984,7 @@
|
|
|
24984
24984
|
}
|
|
24985
24985
|
toBiliXML(options) {
|
|
24986
24986
|
const genCID = (id)=>{
|
|
24987
|
-
const UniID = id_gen_UniID.fromString(id);
|
|
24987
|
+
const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
|
|
24988
24988
|
if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
|
|
24989
24989
|
const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
|
|
24990
24990
|
if (cid) return cid;
|
|
@@ -25005,7 +25005,7 @@
|
|
|
25005
25005
|
},
|
|
25006
25006
|
i: {
|
|
25007
25007
|
chatserver: 'chat.bilibili.com',
|
|
25008
|
-
chatid: genCID(this.dans[0]
|
|
25008
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
25009
25009
|
mission: 0,
|
|
25010
25010
|
maxlimit: this.dans.length,
|
|
25011
25011
|
state: 0,
|
|
@@ -25067,7 +25067,7 @@
|
|
|
25067
25067
|
code: 0,
|
|
25068
25068
|
danuni: {
|
|
25069
25069
|
...DanUniConvertTipTemplate,
|
|
25070
|
-
data: this.dans[0]
|
|
25070
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25071
25071
|
},
|
|
25072
25072
|
data: this.dans.map((dan)=>{
|
|
25073
25073
|
const d = dan.toDplayer();
|
|
@@ -25096,7 +25096,7 @@
|
|
|
25096
25096
|
return {
|
|
25097
25097
|
danuni: {
|
|
25098
25098
|
...DanUniConvertTipTemplate,
|
|
25099
|
-
data: this.dans[0]
|
|
25099
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25100
25100
|
},
|
|
25101
25101
|
danmuku: this.dans.map((dan)=>{
|
|
25102
25102
|
const d = dan.toArtplayer();
|
|
@@ -25127,7 +25127,7 @@
|
|
|
25127
25127
|
});
|
|
25128
25128
|
}
|
|
25129
25129
|
toDDPlay() {
|
|
25130
|
-
const episodeId = this.dans[0]
|
|
25130
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25131
25131
|
return {
|
|
25132
25132
|
danuni: {
|
|
25133
25133
|
...DanUniConvertTipTemplate,
|
|
@@ -21060,7 +21060,7 @@
|
|
|
21060
21060
|
function timestamp_timestampMs(timestamp) {
|
|
21061
21061
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21062
21062
|
}
|
|
21063
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
21063
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.7","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21064
21064
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21065
21065
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21066
21066
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -24720,9 +24720,6 @@
|
|
|
24720
24720
|
}
|
|
24721
24721
|
return new UniPool(result, this.options, this.info);
|
|
24722
24722
|
}
|
|
24723
|
-
minify() {
|
|
24724
|
-
return this.dans.map((d)=>d.minify());
|
|
24725
|
-
}
|
|
24726
24723
|
static import(file, options, mod) {
|
|
24727
24724
|
const handlers = {
|
|
24728
24725
|
["danuni.json"]: (json)=>({
|
|
@@ -24931,6 +24928,9 @@
|
|
|
24931
24928
|
}
|
|
24932
24929
|
}
|
|
24933
24930
|
}
|
|
24931
|
+
minify() {
|
|
24932
|
+
return this.dans.map((d)=>d.minify());
|
|
24933
|
+
}
|
|
24934
24934
|
static fromMin(json, options) {
|
|
24935
24935
|
return new UniPool(json.map((d)=>UniDM.create(d, options)));
|
|
24936
24936
|
}
|
|
@@ -24984,7 +24984,7 @@
|
|
|
24984
24984
|
}
|
|
24985
24985
|
toBiliXML(options) {
|
|
24986
24986
|
const genCID = (id)=>{
|
|
24987
|
-
const UniID = id_gen_UniID.fromString(id);
|
|
24987
|
+
const UniID = id ? id_gen_UniID.fromString(id) : id_gen_UniID.fromNull();
|
|
24988
24988
|
if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
|
|
24989
24989
|
const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
|
|
24990
24990
|
if (cid) return cid;
|
|
@@ -25005,7 +25005,7 @@
|
|
|
25005
25005
|
},
|
|
25006
25006
|
i: {
|
|
25007
25007
|
chatserver: 'chat.bilibili.com',
|
|
25008
|
-
chatid: genCID(this.dans[0]
|
|
25008
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
25009
25009
|
mission: 0,
|
|
25010
25010
|
maxlimit: this.dans.length,
|
|
25011
25011
|
state: 0,
|
|
@@ -25067,7 +25067,7 @@
|
|
|
25067
25067
|
code: 0,
|
|
25068
25068
|
danuni: {
|
|
25069
25069
|
...DanUniConvertTipTemplate,
|
|
25070
|
-
data: this.dans[0]
|
|
25070
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25071
25071
|
},
|
|
25072
25072
|
data: this.dans.map((dan)=>{
|
|
25073
25073
|
const d = dan.toDplayer();
|
|
@@ -25096,7 +25096,7 @@
|
|
|
25096
25096
|
return {
|
|
25097
25097
|
danuni: {
|
|
25098
25098
|
...DanUniConvertTipTemplate,
|
|
25099
|
-
data: this.dans[0]
|
|
25099
|
+
data: this.dans[0]?.SOID.split('@')[0]
|
|
25100
25100
|
},
|
|
25101
25101
|
danmuku: this.dans.map((dan)=>{
|
|
25102
25102
|
const d = dan.toArtplayer();
|
|
@@ -25127,7 +25127,7 @@
|
|
|
25127
25127
|
});
|
|
25128
25128
|
}
|
|
25129
25129
|
toDDPlay() {
|
|
25130
|
-
const episodeId = this.dans[0]
|
|
25130
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25131
25131
|
return {
|
|
25132
25132
|
danuni: {
|
|
25133
25133
|
...DanUniConvertTipTemplate,
|
package/dist/umd/src/index.d.ts
CHANGED
|
@@ -214,7 +214,6 @@ export declare class UniPool {
|
|
|
214
214
|
* @param lifetime 查重时间区段,单位秒 (默认为 0,表示不查重)
|
|
215
215
|
*/
|
|
216
216
|
merge(lifetime?: number): UniPool;
|
|
217
|
-
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
218
217
|
static import(file: unknown, options?: Options,
|
|
219
218
|
/**
|
|
220
219
|
* 加载指定解析模块,为空则全选,为字符串则视为文件名解析加载模块
|
|
@@ -223,8 +222,9 @@ export declare class UniPool {
|
|
|
223
222
|
pool: UniPool;
|
|
224
223
|
fmt: DM_format;
|
|
225
224
|
};
|
|
226
|
-
convert2
|
|
225
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
226
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
227
|
+
minify(): (Partial<UniDMTools.UniDMObj> & Pick<UniDMTools.UniDMObj, "SOID">)[];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
230
230
|
/**
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -463,9 +463,6 @@ export class UniPool {
|
|
|
463
463
|
}
|
|
464
464
|
return new UniPool(result, this.options, this.info)
|
|
465
465
|
}
|
|
466
|
-
minify() {
|
|
467
|
-
return this.dans.map((d) => d.minify())
|
|
468
|
-
}
|
|
469
466
|
static import(
|
|
470
467
|
file: unknown,
|
|
471
468
|
options?: Options,
|
|
@@ -687,8 +684,8 @@ export class UniPool {
|
|
|
687
684
|
}
|
|
688
685
|
throw new Error(errmesg ?? err)
|
|
689
686
|
}
|
|
690
|
-
convert2
|
|
691
|
-
format:
|
|
687
|
+
convert2(
|
|
688
|
+
format: DM_format,
|
|
692
689
|
file_wrapper: true,
|
|
693
690
|
continue_on_error?: boolean,
|
|
694
691
|
): File
|
|
@@ -776,6 +773,9 @@ export class UniPool {
|
|
|
776
773
|
}
|
|
777
774
|
}
|
|
778
775
|
}
|
|
776
|
+
minify() {
|
|
777
|
+
return this.dans.map((d) => d.minify())
|
|
778
|
+
}
|
|
779
779
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options) {
|
|
780
780
|
return new UniPool(json.map((d: any) => UniDM.create(d, options)))
|
|
781
781
|
}
|
|
@@ -865,8 +865,8 @@ export class UniPool {
|
|
|
865
865
|
*/
|
|
866
866
|
avoidSenderIDWithAt?: boolean
|
|
867
867
|
}): string {
|
|
868
|
-
const genCID = (id
|
|
869
|
-
const UniID = ID.fromString(id)
|
|
868
|
+
const genCID = (id?: string) => {
|
|
869
|
+
const UniID = id ? ID.fromString(id) : ID.fromNull()
|
|
870
870
|
if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
|
|
871
871
|
const cid = UniID.id.replaceAll(
|
|
872
872
|
`def_${platform.PlatformVideoSource.Bilibili}+`,
|
|
@@ -892,7 +892,7 @@ export class UniPool {
|
|
|
892
892
|
},
|
|
893
893
|
i: {
|
|
894
894
|
chatserver: 'chat.bilibili.com',
|
|
895
|
-
chatid: genCID(this.dans[0]
|
|
895
|
+
chatid: genCID(this.dans[0]?.SOID),
|
|
896
896
|
mission: 0,
|
|
897
897
|
maxlimit: this.dans.length,
|
|
898
898
|
state: 0,
|
|
@@ -995,7 +995,7 @@ export class UniPool {
|
|
|
995
995
|
code: 0,
|
|
996
996
|
danuni: {
|
|
997
997
|
...DanUniConvertTipTemplate,
|
|
998
|
-
data: this.dans[0]
|
|
998
|
+
data: this.dans[0]?.SOID.split('@')[0],
|
|
999
999
|
},
|
|
1000
1000
|
data: this.dans.map((dan) => {
|
|
1001
1001
|
const d = dan.toDplayer()
|
|
@@ -1032,7 +1032,7 @@ export class UniPool {
|
|
|
1032
1032
|
return {
|
|
1033
1033
|
danuni: {
|
|
1034
1034
|
...DanUniConvertTipTemplate,
|
|
1035
|
-
data: this.dans[0]
|
|
1035
|
+
data: this.dans[0]?.SOID.split('@')[0],
|
|
1036
1036
|
},
|
|
1037
1037
|
danmuku: this.dans.map((dan) => {
|
|
1038
1038
|
const d = dan.toArtplayer()
|
|
@@ -1074,7 +1074,7 @@ export class UniPool {
|
|
|
1074
1074
|
)
|
|
1075
1075
|
}
|
|
1076
1076
|
toDDPlay(): DM_JSON_DDPlay & { danuni?: DanUniConvertTip } {
|
|
1077
|
-
const episodeId = this.dans[0]
|
|
1077
|
+
const episodeId = this.dans[0]?.SOID.split('@')[0].replaceAll(
|
|
1078
1078
|
`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`,
|
|
1079
1079
|
'',
|
|
1080
1080
|
)
|