@dan-uni/dan-any 1.3.4 → 1.3.6
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/dist/browser/index.min.js +11 -11
- package/dist/browser/src/index.d.ts +5 -5
- package/dist/browser/src/utils/dm-gen.d.ts +3 -3
- package/dist/node/index.js +11 -11
- package/dist/node/src/index.d.ts +5 -5
- package/dist/node/src/utils/dm-gen.d.ts +3 -3
- package/dist/umd/index.umd.min.js +11 -11
- package/dist/umd/plugins/bili.umd.min.js +10 -10
- package/dist/umd/plugins/index.umd.min.js +10 -10
- package/dist/umd/src/index.d.ts +5 -5
- package/dist/umd/src/utils/dm-gen.d.ts +3 -3
- package/package.json +1 -1
- package/src/index.test.ts +2 -2
- package/src/index.ts +17 -17
- package/src/utils/dm-gen.ts +4 -4
|
@@ -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.6","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;
|
|
@@ -12086,7 +12086,7 @@ class UniDM {
|
|
|
12086
12086
|
style: this.extra.artplayer?.style
|
|
12087
12087
|
};
|
|
12088
12088
|
}
|
|
12089
|
-
static
|
|
12089
|
+
static fromDDPlay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
12090
12090
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
12091
12091
|
return this.create({
|
|
12092
12092
|
...args,
|
|
@@ -12098,7 +12098,7 @@ class UniDM {
|
|
|
12098
12098
|
DMID: args.cid.toString()
|
|
12099
12099
|
}, options);
|
|
12100
12100
|
}
|
|
12101
|
-
|
|
12101
|
+
toDDPlay() {
|
|
12102
12102
|
let mode = 1;
|
|
12103
12103
|
if (2 === this.mode) mode = 5;
|
|
12104
12104
|
else if (1 === this.mode) mode = 4;
|
|
@@ -12302,8 +12302,8 @@ _ts_decorate([
|
|
|
12302
12302
|
Expose(),
|
|
12303
12303
|
_ts_metadata("design:type", Function),
|
|
12304
12304
|
_ts_metadata("design:paramtypes", []),
|
|
12305
|
-
_ts_metadata("design:returntype", "u" < typeof
|
|
12306
|
-
], UniDM.prototype, "
|
|
12305
|
+
_ts_metadata("design:returntype", "u" < typeof DMDDPlay ? Object : DMDDPlay)
|
|
12306
|
+
], UniDM.prototype, "toDDPlay", null);
|
|
12307
12307
|
const DanmakuType = {
|
|
12308
12308
|
SCROLL: 1,
|
|
12309
12309
|
BOTTOM: 2,
|
|
@@ -12764,7 +12764,7 @@ var src_DM_format = /*#__PURE__*/ function(DM_format) {
|
|
|
12764
12764
|
DM_format["BiliUpJson"] = "bili.up.json";
|
|
12765
12765
|
DM_format["DplayerJson"] = "dplayer.json";
|
|
12766
12766
|
DM_format["ArtplayerJson"] = "artplayer.json";
|
|
12767
|
-
DM_format["
|
|
12767
|
+
DM_format["DDPlayJson"] = "ddplay.json";
|
|
12768
12768
|
DM_format["CommonAss"] = "common.ass";
|
|
12769
12769
|
return DM_format;
|
|
12770
12770
|
}({});
|
|
@@ -13174,11 +13174,11 @@ class UniPool {
|
|
|
13174
13174
|
return this.toArtplayer();
|
|
13175
13175
|
case "ddplay.json":
|
|
13176
13176
|
if (file_wrapper) return new File([
|
|
13177
|
-
src_JSON.stringify(this.
|
|
13177
|
+
src_JSON.stringify(this.toDDPlay())
|
|
13178
13178
|
], "ddplay.json", {
|
|
13179
13179
|
type: 'application/json'
|
|
13180
13180
|
});
|
|
13181
|
-
return this.
|
|
13181
|
+
return this.toDDPlay();
|
|
13182
13182
|
default:
|
|
13183
13183
|
{
|
|
13184
13184
|
const message = '(err) Unknown format or unsupported now!';
|
|
@@ -13370,7 +13370,7 @@ class UniPool {
|
|
|
13370
13370
|
static fromDDPlay(json, episodeId, options) {
|
|
13371
13371
|
return new UniPool(json.comments.map((d)=>{
|
|
13372
13372
|
const p_arr = d.p.split(',');
|
|
13373
|
-
return UniDM.
|
|
13373
|
+
return UniDM.fromDDPlay({
|
|
13374
13374
|
cid: d.cid,
|
|
13375
13375
|
color: Number.parseInt(p_arr[2]),
|
|
13376
13376
|
m: d.m,
|
|
@@ -13382,7 +13382,7 @@ class UniPool {
|
|
|
13382
13382
|
fromConverted: !!json.danuni
|
|
13383
13383
|
});
|
|
13384
13384
|
}
|
|
13385
|
-
|
|
13385
|
+
toDDPlay() {
|
|
13386
13386
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
13387
13387
|
return {
|
|
13388
13388
|
danuni: {
|
|
@@ -13391,7 +13391,7 @@ class UniPool {
|
|
|
13391
13391
|
},
|
|
13392
13392
|
count: this.dans.length,
|
|
13393
13393
|
comments: this.dans.map((dan)=>{
|
|
13394
|
-
const d = dan.
|
|
13394
|
+
const d = dan.toDDPlay();
|
|
13395
13395
|
return {
|
|
13396
13396
|
cid: d.cid,
|
|
13397
13397
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
|
@@ -127,7 +127,7 @@ export declare enum DM_format {
|
|
|
127
127
|
BiliUpJson = "bili.up.json",
|
|
128
128
|
DplayerJson = "dplayer.json",
|
|
129
129
|
ArtplayerJson = "artplayer.json",
|
|
130
|
-
|
|
130
|
+
DDPlayJson = "ddplay.json",
|
|
131
131
|
CommonAss = "common.ass"
|
|
132
132
|
}
|
|
133
133
|
type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
|
|
@@ -141,7 +141,7 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.
|
|
144
|
+
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
145
|
type Convert2ResultMap = {
|
|
146
146
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
147
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -153,7 +153,7 @@ type Convert2ResultMap = {
|
|
|
153
153
|
[DM_format.ArtplayerJson]: DM_JSON_Artplayer & {
|
|
154
154
|
danuni?: DanUniConvertTip;
|
|
155
155
|
};
|
|
156
|
-
[DM_format.
|
|
156
|
+
[DM_format.DDPlayJson]: DM_JSON_DDPlay & {
|
|
157
157
|
danuni?: DanUniConvertTip;
|
|
158
158
|
};
|
|
159
159
|
};
|
|
@@ -223,7 +223,7 @@ export declare class UniPool {
|
|
|
223
223
|
pool: UniPool;
|
|
224
224
|
fmt: DM_format;
|
|
225
225
|
};
|
|
226
|
-
convert2
|
|
226
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
227
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
@@ -265,7 +265,7 @@ export declare class UniPool {
|
|
|
265
265
|
static fromDDPlay(json: DM_JSON_DDPlay & {
|
|
266
266
|
danuni?: DanUniConvertTip;
|
|
267
267
|
}, episodeId: string, options?: Options): UniPool;
|
|
268
|
-
|
|
268
|
+
toDDPlay(): DM_JSON_DDPlay & {
|
|
269
269
|
danuni?: DanUniConvertTip;
|
|
270
270
|
};
|
|
271
271
|
static fromASS(ass: string, options?: Options): UniPool;
|
|
@@ -62,7 +62,7 @@ interface DMArtplayer {
|
|
|
62
62
|
border?: boolean;
|
|
63
63
|
style?: object;
|
|
64
64
|
}
|
|
65
|
-
interface
|
|
65
|
+
interface DMDDPlay {
|
|
66
66
|
cid: bigint;
|
|
67
67
|
/**
|
|
68
68
|
* content
|
|
@@ -303,7 +303,7 @@ export declare class UniDM {
|
|
|
303
303
|
toDplayer(): DMDplayer;
|
|
304
304
|
static fromArtplayer(args: DMArtplayer, playerID: string, domain: string, options?: Options): UniDM;
|
|
305
305
|
toArtplayer(): DMArtplayer;
|
|
306
|
-
static
|
|
307
|
-
|
|
306
|
+
static fromDDPlay(args: DMDDPlay, episodeId: string, domain?: PlatformDanmakuOnlySource, options?: Options): UniDM;
|
|
307
|
+
toDDPlay(): DMDDPlay;
|
|
308
308
|
}
|
|
309
309
|
export {};
|
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.6","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;
|
|
@@ -663,7 +663,7 @@ class UniDM {
|
|
|
663
663
|
style: this.extra.artplayer?.style
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
static
|
|
666
|
+
static fromDDPlay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
667
667
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
668
668
|
return this.create({
|
|
669
669
|
...args,
|
|
@@ -675,7 +675,7 @@ class UniDM {
|
|
|
675
675
|
DMID: args.cid.toString()
|
|
676
676
|
}, options);
|
|
677
677
|
}
|
|
678
|
-
|
|
678
|
+
toDDPlay() {
|
|
679
679
|
let mode = 1;
|
|
680
680
|
if (2 === this.mode) mode = 5;
|
|
681
681
|
else if (1 === this.mode) mode = 4;
|
|
@@ -879,8 +879,8 @@ _ts_decorate([
|
|
|
879
879
|
Expose(),
|
|
880
880
|
_ts_metadata("design:type", Function),
|
|
881
881
|
_ts_metadata("design:paramtypes", []),
|
|
882
|
-
_ts_metadata("design:returntype", "u" < typeof
|
|
883
|
-
], UniDM.prototype, "
|
|
882
|
+
_ts_metadata("design:returntype", "u" < typeof DMDDPlay ? Object : DMDDPlay)
|
|
883
|
+
], UniDM.prototype, "toDDPlay", null);
|
|
884
884
|
const DanmakuType = {
|
|
885
885
|
SCROLL: 1,
|
|
886
886
|
BOTTOM: 2,
|
|
@@ -1339,7 +1339,7 @@ var src_DM_format = /*#__PURE__*/ function(DM_format) {
|
|
|
1339
1339
|
DM_format["BiliUpJson"] = "bili.up.json";
|
|
1340
1340
|
DM_format["DplayerJson"] = "dplayer.json";
|
|
1341
1341
|
DM_format["ArtplayerJson"] = "artplayer.json";
|
|
1342
|
-
DM_format["
|
|
1342
|
+
DM_format["DDPlayJson"] = "ddplay.json";
|
|
1343
1343
|
DM_format["CommonAss"] = "common.ass";
|
|
1344
1344
|
return DM_format;
|
|
1345
1345
|
}({});
|
|
@@ -1749,11 +1749,11 @@ class UniPool {
|
|
|
1749
1749
|
return this.toArtplayer();
|
|
1750
1750
|
case "ddplay.json":
|
|
1751
1751
|
if (file_wrapper) return new File([
|
|
1752
|
-
src_JSON.stringify(this.
|
|
1752
|
+
src_JSON.stringify(this.toDDPlay())
|
|
1753
1753
|
], "ddplay.json", {
|
|
1754
1754
|
type: 'application/json'
|
|
1755
1755
|
});
|
|
1756
|
-
return this.
|
|
1756
|
+
return this.toDDPlay();
|
|
1757
1757
|
default:
|
|
1758
1758
|
{
|
|
1759
1759
|
const message = '(err) Unknown format or unsupported now!';
|
|
@@ -1945,7 +1945,7 @@ class UniPool {
|
|
|
1945
1945
|
static fromDDPlay(json, episodeId, options) {
|
|
1946
1946
|
return new UniPool(json.comments.map((d)=>{
|
|
1947
1947
|
const p_arr = d.p.split(',');
|
|
1948
|
-
return UniDM.
|
|
1948
|
+
return UniDM.fromDDPlay({
|
|
1949
1949
|
cid: d.cid,
|
|
1950
1950
|
color: Number.parseInt(p_arr[2]),
|
|
1951
1951
|
m: d.m,
|
|
@@ -1957,7 +1957,7 @@ class UniPool {
|
|
|
1957
1957
|
fromConverted: !!json.danuni
|
|
1958
1958
|
});
|
|
1959
1959
|
}
|
|
1960
|
-
|
|
1960
|
+
toDDPlay() {
|
|
1961
1961
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
1962
1962
|
return {
|
|
1963
1963
|
danuni: {
|
|
@@ -1966,7 +1966,7 @@ class UniPool {
|
|
|
1966
1966
|
},
|
|
1967
1967
|
count: this.dans.length,
|
|
1968
1968
|
comments: this.dans.map((dan)=>{
|
|
1969
|
-
const d = dan.
|
|
1969
|
+
const d = dan.toDDPlay();
|
|
1970
1970
|
return {
|
|
1971
1971
|
cid: d.cid,
|
|
1972
1972
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
package/dist/node/src/index.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ export declare enum DM_format {
|
|
|
127
127
|
BiliUpJson = "bili.up.json",
|
|
128
128
|
DplayerJson = "dplayer.json",
|
|
129
129
|
ArtplayerJson = "artplayer.json",
|
|
130
|
-
|
|
130
|
+
DDPlayJson = "ddplay.json",
|
|
131
131
|
CommonAss = "common.ass"
|
|
132
132
|
}
|
|
133
133
|
type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
|
|
@@ -141,7 +141,7 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.
|
|
144
|
+
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
145
|
type Convert2ResultMap = {
|
|
146
146
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
147
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -153,7 +153,7 @@ type Convert2ResultMap = {
|
|
|
153
153
|
[DM_format.ArtplayerJson]: DM_JSON_Artplayer & {
|
|
154
154
|
danuni?: DanUniConvertTip;
|
|
155
155
|
};
|
|
156
|
-
[DM_format.
|
|
156
|
+
[DM_format.DDPlayJson]: DM_JSON_DDPlay & {
|
|
157
157
|
danuni?: DanUniConvertTip;
|
|
158
158
|
};
|
|
159
159
|
};
|
|
@@ -223,7 +223,7 @@ export declare class UniPool {
|
|
|
223
223
|
pool: UniPool;
|
|
224
224
|
fmt: DM_format;
|
|
225
225
|
};
|
|
226
|
-
convert2
|
|
226
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
227
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
@@ -265,7 +265,7 @@ export declare class UniPool {
|
|
|
265
265
|
static fromDDPlay(json: DM_JSON_DDPlay & {
|
|
266
266
|
danuni?: DanUniConvertTip;
|
|
267
267
|
}, episodeId: string, options?: Options): UniPool;
|
|
268
|
-
|
|
268
|
+
toDDPlay(): DM_JSON_DDPlay & {
|
|
269
269
|
danuni?: DanUniConvertTip;
|
|
270
270
|
};
|
|
271
271
|
static fromASS(ass: string, options?: Options): UniPool;
|
|
@@ -62,7 +62,7 @@ interface DMArtplayer {
|
|
|
62
62
|
border?: boolean;
|
|
63
63
|
style?: object;
|
|
64
64
|
}
|
|
65
|
-
interface
|
|
65
|
+
interface DMDDPlay {
|
|
66
66
|
cid: bigint;
|
|
67
67
|
/**
|
|
68
68
|
* content
|
|
@@ -303,7 +303,7 @@ export declare class UniDM {
|
|
|
303
303
|
toDplayer(): DMDplayer;
|
|
304
304
|
static fromArtplayer(args: DMArtplayer, playerID: string, domain: string, options?: Options): UniDM;
|
|
305
305
|
toArtplayer(): DMArtplayer;
|
|
306
|
-
static
|
|
307
|
-
|
|
306
|
+
static fromDDPlay(args: DMDDPlay, episodeId: string, domain?: PlatformDanmakuOnlySource, options?: Options): UniDM;
|
|
307
|
+
toDDPlay(): DMDDPlay;
|
|
308
308
|
}
|
|
309
309
|
export {};
|
|
@@ -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.6","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;
|
|
@@ -24573,7 +24573,7 @@ and limitations under the License.
|
|
|
24573
24573
|
style: this.extra.artplayer?.style
|
|
24574
24574
|
};
|
|
24575
24575
|
}
|
|
24576
|
-
static
|
|
24576
|
+
static fromDDPlay(args, episodeId, domain = platform.PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
24577
24577
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
24578
24578
|
return this.create({
|
|
24579
24579
|
...args,
|
|
@@ -24585,7 +24585,7 @@ and limitations under the License.
|
|
|
24585
24585
|
DMID: args.cid.toString()
|
|
24586
24586
|
}, options);
|
|
24587
24587
|
}
|
|
24588
|
-
|
|
24588
|
+
toDDPlay() {
|
|
24589
24589
|
let mode = 1;
|
|
24590
24590
|
if (2 === this.mode) mode = 5;
|
|
24591
24591
|
else if (1 === this.mode) mode = 4;
|
|
@@ -24789,8 +24789,8 @@ and limitations under the License.
|
|
|
24789
24789
|
Expose(),
|
|
24790
24790
|
_ts_metadata("design:type", Function),
|
|
24791
24791
|
_ts_metadata("design:paramtypes", []),
|
|
24792
|
-
_ts_metadata("design:returntype", "u" < typeof
|
|
24793
|
-
], UniDM.prototype, "
|
|
24792
|
+
_ts_metadata("design:returntype", "u" < typeof DMDDPlay ? Object : DMDDPlay)
|
|
24793
|
+
], UniDM.prototype, "toDDPlay", null);
|
|
24794
24794
|
const DanmakuType = {
|
|
24795
24795
|
SCROLL: 1,
|
|
24796
24796
|
BOTTOM: 2,
|
|
@@ -25252,7 +25252,7 @@ and limitations under the License.
|
|
|
25252
25252
|
DM_format["BiliUpJson"] = "bili.up.json";
|
|
25253
25253
|
DM_format["DplayerJson"] = "dplayer.json";
|
|
25254
25254
|
DM_format["ArtplayerJson"] = "artplayer.json";
|
|
25255
|
-
DM_format["
|
|
25255
|
+
DM_format["DDPlayJson"] = "ddplay.json";
|
|
25256
25256
|
DM_format["CommonAss"] = "common.ass";
|
|
25257
25257
|
return DM_format;
|
|
25258
25258
|
}({});
|
|
@@ -25662,11 +25662,11 @@ and limitations under the License.
|
|
|
25662
25662
|
return this.toArtplayer();
|
|
25663
25663
|
case "ddplay.json":
|
|
25664
25664
|
if (file_wrapper) return new File([
|
|
25665
|
-
src_JSON.stringify(this.
|
|
25665
|
+
src_JSON.stringify(this.toDDPlay())
|
|
25666
25666
|
], "ddplay.json", {
|
|
25667
25667
|
type: 'application/json'
|
|
25668
25668
|
});
|
|
25669
|
-
return this.
|
|
25669
|
+
return this.toDDPlay();
|
|
25670
25670
|
default:
|
|
25671
25671
|
{
|
|
25672
25672
|
const message = '(err) Unknown format or unsupported now!';
|
|
@@ -25858,7 +25858,7 @@ and limitations under the License.
|
|
|
25858
25858
|
static fromDDPlay(json, episodeId, options) {
|
|
25859
25859
|
return new UniPool(json.comments.map((d)=>{
|
|
25860
25860
|
const p_arr = d.p.split(',');
|
|
25861
|
-
return UniDM.
|
|
25861
|
+
return UniDM.fromDDPlay({
|
|
25862
25862
|
cid: d.cid,
|
|
25863
25863
|
color: Number.parseInt(p_arr[2]),
|
|
25864
25864
|
m: d.m,
|
|
@@ -25870,7 +25870,7 @@ and limitations under the License.
|
|
|
25870
25870
|
fromConverted: !!json.danuni
|
|
25871
25871
|
});
|
|
25872
25872
|
}
|
|
25873
|
-
|
|
25873
|
+
toDDPlay() {
|
|
25874
25874
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25875
25875
|
return {
|
|
25876
25876
|
danuni: {
|
|
@@ -25879,7 +25879,7 @@ and limitations under the License.
|
|
|
25879
25879
|
},
|
|
25880
25880
|
count: this.dans.length,
|
|
25881
25881
|
comments: this.dans.map((dan)=>{
|
|
25882
|
-
const d = dan.
|
|
25882
|
+
const d = dan.toDDPlay();
|
|
25883
25883
|
return {
|
|
25884
25884
|
cid: d.cid,
|
|
25885
25885
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
|
@@ -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.6","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;
|
|
@@ -23843,7 +23843,7 @@
|
|
|
23843
23843
|
style: this.extra.artplayer?.style
|
|
23844
23844
|
};
|
|
23845
23845
|
}
|
|
23846
|
-
static
|
|
23846
|
+
static fromDDPlay(args, episodeId, domain = platform.PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
23847
23847
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
23848
23848
|
return this.create({
|
|
23849
23849
|
...args,
|
|
@@ -23855,7 +23855,7 @@
|
|
|
23855
23855
|
DMID: args.cid.toString()
|
|
23856
23856
|
}, options);
|
|
23857
23857
|
}
|
|
23858
|
-
|
|
23858
|
+
toDDPlay() {
|
|
23859
23859
|
let mode = 1;
|
|
23860
23860
|
if (2 === this.mode) mode = 5;
|
|
23861
23861
|
else if (1 === this.mode) mode = 4;
|
|
@@ -24059,8 +24059,8 @@
|
|
|
24059
24059
|
Expose(),
|
|
24060
24060
|
_ts_metadata("design:type", Function),
|
|
24061
24061
|
_ts_metadata("design:paramtypes", []),
|
|
24062
|
-
_ts_metadata("design:returntype", "u" < typeof
|
|
24063
|
-
], UniDM.prototype, "
|
|
24062
|
+
_ts_metadata("design:returntype", "u" < typeof DMDDPlay ? Object : DMDDPlay)
|
|
24063
|
+
], UniDM.prototype, "toDDPlay", null);
|
|
24064
24064
|
const DanmakuType = {
|
|
24065
24065
|
SCROLL: 1,
|
|
24066
24066
|
BOTTOM: 2,
|
|
@@ -24918,11 +24918,11 @@
|
|
|
24918
24918
|
return this.toArtplayer();
|
|
24919
24919
|
case "ddplay.json":
|
|
24920
24920
|
if (file_wrapper) return new File([
|
|
24921
|
-
src_JSON.stringify(this.
|
|
24921
|
+
src_JSON.stringify(this.toDDPlay())
|
|
24922
24922
|
], "ddplay.json", {
|
|
24923
24923
|
type: 'application/json'
|
|
24924
24924
|
});
|
|
24925
|
-
return this.
|
|
24925
|
+
return this.toDDPlay();
|
|
24926
24926
|
default:
|
|
24927
24927
|
{
|
|
24928
24928
|
const message = '(err) Unknown format or unsupported now!';
|
|
@@ -25114,7 +25114,7 @@
|
|
|
25114
25114
|
static fromDDPlay(json, episodeId, options) {
|
|
25115
25115
|
return new UniPool(json.comments.map((d)=>{
|
|
25116
25116
|
const p_arr = d.p.split(',');
|
|
25117
|
-
return UniDM.
|
|
25117
|
+
return UniDM.fromDDPlay({
|
|
25118
25118
|
cid: d.cid,
|
|
25119
25119
|
color: Number.parseInt(p_arr[2]),
|
|
25120
25120
|
m: d.m,
|
|
@@ -25126,7 +25126,7 @@
|
|
|
25126
25126
|
fromConverted: !!json.danuni
|
|
25127
25127
|
});
|
|
25128
25128
|
}
|
|
25129
|
-
|
|
25129
|
+
toDDPlay() {
|
|
25130
25130
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25131
25131
|
return {
|
|
25132
25132
|
danuni: {
|
|
@@ -25135,7 +25135,7 @@
|
|
|
25135
25135
|
},
|
|
25136
25136
|
count: this.dans.length,
|
|
25137
25137
|
comments: this.dans.map((dan)=>{
|
|
25138
|
-
const d = dan.
|
|
25138
|
+
const d = dan.toDDPlay();
|
|
25139
25139
|
return {
|
|
25140
25140
|
cid: d.cid,
|
|
25141
25141
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
|
@@ -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.6","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;
|
|
@@ -23843,7 +23843,7 @@
|
|
|
23843
23843
|
style: this.extra.artplayer?.style
|
|
23844
23844
|
};
|
|
23845
23845
|
}
|
|
23846
|
-
static
|
|
23846
|
+
static fromDDPlay(args, episodeId, domain = platform.PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
23847
23847
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
23848
23848
|
return this.create({
|
|
23849
23849
|
...args,
|
|
@@ -23855,7 +23855,7 @@
|
|
|
23855
23855
|
DMID: args.cid.toString()
|
|
23856
23856
|
}, options);
|
|
23857
23857
|
}
|
|
23858
|
-
|
|
23858
|
+
toDDPlay() {
|
|
23859
23859
|
let mode = 1;
|
|
23860
23860
|
if (2 === this.mode) mode = 5;
|
|
23861
23861
|
else if (1 === this.mode) mode = 4;
|
|
@@ -24059,8 +24059,8 @@
|
|
|
24059
24059
|
Expose(),
|
|
24060
24060
|
_ts_metadata("design:type", Function),
|
|
24061
24061
|
_ts_metadata("design:paramtypes", []),
|
|
24062
|
-
_ts_metadata("design:returntype", "u" < typeof
|
|
24063
|
-
], UniDM.prototype, "
|
|
24062
|
+
_ts_metadata("design:returntype", "u" < typeof DMDDPlay ? Object : DMDDPlay)
|
|
24063
|
+
], UniDM.prototype, "toDDPlay", null);
|
|
24064
24064
|
const DanmakuType = {
|
|
24065
24065
|
SCROLL: 1,
|
|
24066
24066
|
BOTTOM: 2,
|
|
@@ -24918,11 +24918,11 @@
|
|
|
24918
24918
|
return this.toArtplayer();
|
|
24919
24919
|
case "ddplay.json":
|
|
24920
24920
|
if (file_wrapper) return new File([
|
|
24921
|
-
src_JSON.stringify(this.
|
|
24921
|
+
src_JSON.stringify(this.toDDPlay())
|
|
24922
24922
|
], "ddplay.json", {
|
|
24923
24923
|
type: 'application/json'
|
|
24924
24924
|
});
|
|
24925
|
-
return this.
|
|
24925
|
+
return this.toDDPlay();
|
|
24926
24926
|
default:
|
|
24927
24927
|
{
|
|
24928
24928
|
const message = '(err) Unknown format or unsupported now!';
|
|
@@ -25114,7 +25114,7 @@
|
|
|
25114
25114
|
static fromDDPlay(json, episodeId, options) {
|
|
25115
25115
|
return new UniPool(json.comments.map((d)=>{
|
|
25116
25116
|
const p_arr = d.p.split(',');
|
|
25117
|
-
return UniDM.
|
|
25117
|
+
return UniDM.fromDDPlay({
|
|
25118
25118
|
cid: d.cid,
|
|
25119
25119
|
color: Number.parseInt(p_arr[2]),
|
|
25120
25120
|
m: d.m,
|
|
@@ -25126,7 +25126,7 @@
|
|
|
25126
25126
|
fromConverted: !!json.danuni
|
|
25127
25127
|
});
|
|
25128
25128
|
}
|
|
25129
|
-
|
|
25129
|
+
toDDPlay() {
|
|
25130
25130
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25131
25131
|
return {
|
|
25132
25132
|
danuni: {
|
|
@@ -25135,7 +25135,7 @@
|
|
|
25135
25135
|
},
|
|
25136
25136
|
count: this.dans.length,
|
|
25137
25137
|
comments: this.dans.map((dan)=>{
|
|
25138
|
-
const d = dan.
|
|
25138
|
+
const d = dan.toDDPlay();
|
|
25139
25139
|
return {
|
|
25140
25140
|
cid: d.cid,
|
|
25141
25141
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
package/dist/umd/src/index.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ export declare enum DM_format {
|
|
|
127
127
|
BiliUpJson = "bili.up.json",
|
|
128
128
|
DplayerJson = "dplayer.json",
|
|
129
129
|
ArtplayerJson = "artplayer.json",
|
|
130
|
-
|
|
130
|
+
DDPlayJson = "ddplay.json",
|
|
131
131
|
CommonAss = "common.ass"
|
|
132
132
|
}
|
|
133
133
|
type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
|
|
@@ -141,7 +141,7 @@ export interface Options {
|
|
|
141
141
|
*/
|
|
142
142
|
dmid?: boolean | number | UniIDTools.DMIDGenerator;
|
|
143
143
|
}
|
|
144
|
-
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.
|
|
144
|
+
type Convert2Format = DM_format.DanuniJson | DM_format.DanuniMinJson | DM_format.DanuniPbBin | DM_format.BiliXml | DM_format.DplayerJson | DM_format.ArtplayerJson | DM_format.DDPlayJson;
|
|
145
145
|
type Convert2ResultMap = {
|
|
146
146
|
[DM_format.DanuniJson]: UniDM[];
|
|
147
147
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin;
|
|
@@ -153,7 +153,7 @@ type Convert2ResultMap = {
|
|
|
153
153
|
[DM_format.ArtplayerJson]: DM_JSON_Artplayer & {
|
|
154
154
|
danuni?: DanUniConvertTip;
|
|
155
155
|
};
|
|
156
|
-
[DM_format.
|
|
156
|
+
[DM_format.DDPlayJson]: DM_JSON_DDPlay & {
|
|
157
157
|
danuni?: DanUniConvertTip;
|
|
158
158
|
};
|
|
159
159
|
};
|
|
@@ -223,7 +223,7 @@ export declare class UniPool {
|
|
|
223
223
|
pool: UniPool;
|
|
224
224
|
fmt: DM_format;
|
|
225
225
|
};
|
|
226
|
-
convert2
|
|
226
|
+
convert2(format: DM_format, file_wrapper: true, continue_on_error?: boolean): File;
|
|
227
227
|
convert2<T extends Convert2Format>(format: T, file_wrapper?: false, continue_on_error?: boolean): Convert2ResultMap[T];
|
|
228
228
|
static fromMin(json: DM_JSON_DanuniMin, options?: Options): UniPool;
|
|
229
229
|
static fromPb(bin: Uint8Array | ArrayBuffer, options?: Options): UniPool;
|
|
@@ -265,7 +265,7 @@ export declare class UniPool {
|
|
|
265
265
|
static fromDDPlay(json: DM_JSON_DDPlay & {
|
|
266
266
|
danuni?: DanUniConvertTip;
|
|
267
267
|
}, episodeId: string, options?: Options): UniPool;
|
|
268
|
-
|
|
268
|
+
toDDPlay(): DM_JSON_DDPlay & {
|
|
269
269
|
danuni?: DanUniConvertTip;
|
|
270
270
|
};
|
|
271
271
|
static fromASS(ass: string, options?: Options): UniPool;
|
|
@@ -62,7 +62,7 @@ interface DMArtplayer {
|
|
|
62
62
|
border?: boolean;
|
|
63
63
|
style?: object;
|
|
64
64
|
}
|
|
65
|
-
interface
|
|
65
|
+
interface DMDDPlay {
|
|
66
66
|
cid: bigint;
|
|
67
67
|
/**
|
|
68
68
|
* content
|
|
@@ -303,7 +303,7 @@ export declare class UniDM {
|
|
|
303
303
|
toDplayer(): DMDplayer;
|
|
304
304
|
static fromArtplayer(args: DMArtplayer, playerID: string, domain: string, options?: Options): UniDM;
|
|
305
305
|
toArtplayer(): DMArtplayer;
|
|
306
|
-
static
|
|
307
|
-
|
|
306
|
+
static fromDDPlay(args: DMDDPlay, episodeId: string, domain?: PlatformDanmakuOnlySource, options?: Options): UniDM;
|
|
307
|
+
toDDPlay(): DMDDPlay;
|
|
308
308
|
}
|
|
309
309
|
export {};
|
package/package.json
CHANGED
package/src/index.test.ts
CHANGED
|
@@ -85,9 +85,9 @@ describe('转化自', () => {
|
|
|
85
85
|
const imp2 = UniPool.import(pb, undefined, 'test-danuni.binpb')
|
|
86
86
|
expect(imp2).toEqual(imp)
|
|
87
87
|
})
|
|
88
|
-
it('
|
|
88
|
+
it('DDPlay[双向]', () => {
|
|
89
89
|
const pool = UniPool.fromBiliXML(xml)
|
|
90
|
-
const ddplay = pool.
|
|
90
|
+
const ddplay = pool.toDDPlay()
|
|
91
91
|
console.info(UniPool.fromDDPlay(ddplay, '1'))
|
|
92
92
|
const imp = UniPool.import(ddplay)
|
|
93
93
|
expect(imp.fmt).toBe('ddplay.json')
|
package/src/index.ts
CHANGED
|
@@ -165,7 +165,7 @@ export enum DM_format {
|
|
|
165
165
|
BiliUpJson = 'bili.up.json',
|
|
166
166
|
DplayerJson = 'dplayer.json',
|
|
167
167
|
ArtplayerJson = 'artplayer.json',
|
|
168
|
-
|
|
168
|
+
DDPlayJson = 'ddplay.json',
|
|
169
169
|
CommonAss = 'common.ass',
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -207,7 +207,7 @@ type Convert2Format =
|
|
|
207
207
|
| DM_format.BiliXml
|
|
208
208
|
| DM_format.DplayerJson
|
|
209
209
|
| DM_format.ArtplayerJson
|
|
210
|
-
| DM_format.
|
|
210
|
+
| DM_format.DDPlayJson
|
|
211
211
|
type Convert2ResultMap = {
|
|
212
212
|
[DM_format.DanuniJson]: UniDM[]
|
|
213
213
|
[DM_format.DanuniMinJson]: DM_JSON_DanuniMin
|
|
@@ -215,7 +215,7 @@ type Convert2ResultMap = {
|
|
|
215
215
|
[DM_format.BiliXml]: string
|
|
216
216
|
[DM_format.DplayerJson]: DM_JSON_Dplayer & { danuni?: DanUniConvertTip }
|
|
217
217
|
[DM_format.ArtplayerJson]: DM_JSON_Artplayer & { danuni?: DanUniConvertTip }
|
|
218
|
-
[DM_format.
|
|
218
|
+
[DM_format.DDPlayJson]: DM_JSON_DDPlay & { danuni?: DanUniConvertTip }
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
export class UniPool {
|
|
@@ -535,13 +535,13 @@ export class UniPool {
|
|
|
535
535
|
),
|
|
536
536
|
fmt: DM_format.ArtplayerJson,
|
|
537
537
|
}),
|
|
538
|
-
[DM_format.
|
|
538
|
+
[DM_format.DDPlayJson]: (
|
|
539
539
|
json: DM_JSON_DDPlay & {
|
|
540
540
|
danuni?: DanUniConvertTip
|
|
541
541
|
},
|
|
542
542
|
) => ({
|
|
543
543
|
pool: this.fromDDPlay(json, json.danuni?.data ?? '', options),
|
|
544
|
-
fmt: DM_format.
|
|
544
|
+
fmt: DM_format.DDPlayJson,
|
|
545
545
|
}),
|
|
546
546
|
[DM_format.CommonAss]: (file: string) => ({
|
|
547
547
|
pool: this.fromASS(file, options),
|
|
@@ -571,8 +571,8 @@ export class UniPool {
|
|
|
571
571
|
return handlers[DM_format.DplayerJson](fileParser(file, 'json'))
|
|
572
572
|
else if (fn.endsWith(DM_format.ArtplayerJson))
|
|
573
573
|
return handlers[DM_format.ArtplayerJson](fileParser(file, 'json'))
|
|
574
|
-
else if (fn.endsWith(DM_format.
|
|
575
|
-
return handlers[DM_format.
|
|
574
|
+
else if (fn.endsWith(DM_format.DDPlayJson))
|
|
575
|
+
return handlers[DM_format.DDPlayJson](fileParser(file, 'json'))
|
|
576
576
|
else if (fn.endsWith(DM_format.CommonAss))
|
|
577
577
|
return handlers[DM_format.CommonAss](fileParser(file, 'string'))
|
|
578
578
|
} catch {}
|
|
@@ -603,7 +603,7 @@ export class UniPool {
|
|
|
603
603
|
Array.isArray(json.comments) &&
|
|
604
604
|
json.comments.every((d) => d.m)
|
|
605
605
|
) {
|
|
606
|
-
return handlers[DM_format.
|
|
606
|
+
return handlers[DM_format.DDPlayJson](json)
|
|
607
607
|
} else if (
|
|
608
608
|
json.code == 0 &&
|
|
609
609
|
json.data &&
|
|
@@ -687,8 +687,8 @@ export class UniPool {
|
|
|
687
687
|
}
|
|
688
688
|
throw new Error(errmesg ?? err)
|
|
689
689
|
}
|
|
690
|
-
convert2
|
|
691
|
-
format:
|
|
690
|
+
convert2(
|
|
691
|
+
format: DM_format,
|
|
692
692
|
file_wrapper: true,
|
|
693
693
|
continue_on_error?: boolean,
|
|
694
694
|
): File
|
|
@@ -757,16 +757,16 @@ export class UniPool {
|
|
|
757
757
|
},
|
|
758
758
|
)
|
|
759
759
|
return this.toArtplayer()
|
|
760
|
-
case DM_format.
|
|
760
|
+
case DM_format.DDPlayJson:
|
|
761
761
|
if (file_wrapper)
|
|
762
762
|
return new File(
|
|
763
|
-
[JSON.stringify(this.
|
|
764
|
-
DM_format.
|
|
763
|
+
[JSON.stringify(this.toDDPlay())],
|
|
764
|
+
DM_format.DDPlayJson,
|
|
765
765
|
{
|
|
766
766
|
type: 'application/json',
|
|
767
767
|
},
|
|
768
768
|
)
|
|
769
|
-
return this.
|
|
769
|
+
return this.toDDPlay()
|
|
770
770
|
// case DM_format.CommonAss:
|
|
771
771
|
// return this.toASS()
|
|
772
772
|
default: {
|
|
@@ -1055,7 +1055,7 @@ export class UniPool {
|
|
|
1055
1055
|
return new UniPool(
|
|
1056
1056
|
json.comments.map((d) => {
|
|
1057
1057
|
const p_arr = d.p.split(',')
|
|
1058
|
-
return UniDM.
|
|
1058
|
+
return UniDM.fromDDPlay(
|
|
1059
1059
|
{
|
|
1060
1060
|
cid: d.cid,
|
|
1061
1061
|
color: Number.parseInt(p_arr[2]),
|
|
@@ -1073,7 +1073,7 @@ export class UniPool {
|
|
|
1073
1073
|
{ fromConverted: !!json.danuni },
|
|
1074
1074
|
)
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1076
|
+
toDDPlay(): DM_JSON_DDPlay & { danuni?: DanUniConvertTip } {
|
|
1077
1077
|
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(
|
|
1078
1078
|
`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`,
|
|
1079
1079
|
'',
|
|
@@ -1082,7 +1082,7 @@ export class UniPool {
|
|
|
1082
1082
|
danuni: { ...DanUniConvertTipTemplate, data: episodeId },
|
|
1083
1083
|
count: this.dans.length,
|
|
1084
1084
|
comments: this.dans.map((dan) => {
|
|
1085
|
-
const d = dan.
|
|
1085
|
+
const d = dan.toDDPlay()
|
|
1086
1086
|
return {
|
|
1087
1087
|
cid: d.cid,
|
|
1088
1088
|
p: `${d.progress},${d.mode},${d.color},${d.uid}`,
|
package/src/utils/dm-gen.ts
CHANGED
|
@@ -203,7 +203,7 @@ interface DMArtplayer {
|
|
|
203
203
|
border?: boolean
|
|
204
204
|
style?: object
|
|
205
205
|
}
|
|
206
|
-
interface
|
|
206
|
+
interface DMDDPlay {
|
|
207
207
|
cid: bigint
|
|
208
208
|
/**
|
|
209
209
|
* content
|
|
@@ -1029,8 +1029,8 @@ export class UniDM {
|
|
|
1029
1029
|
style: this.extra.artplayer?.style,
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
static
|
|
1033
|
-
args:
|
|
1032
|
+
static fromDDPlay(
|
|
1033
|
+
args: DMDDPlay,
|
|
1034
1034
|
episodeId: string,
|
|
1035
1035
|
domain = PlatformDanmakuOnlySource.DanDanPlay,
|
|
1036
1036
|
options?: Options,
|
|
@@ -1056,7 +1056,7 @@ export class UniDM {
|
|
|
1056
1056
|
)
|
|
1057
1057
|
}
|
|
1058
1058
|
@Expose()
|
|
1059
|
-
|
|
1059
|
+
toDDPlay(): DMDDPlay {
|
|
1060
1060
|
let mode = 1
|
|
1061
1061
|
if (this.mode === Modes.Top) mode = 5
|
|
1062
1062
|
else if (this.mode === Modes.Bottom) mode = 4
|