networkwm-js 0.1.0 → 0.1.1
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 +3 -2
- package/dist/bytemanip.d.ts.map +1 -1
- package/dist/bytemanip.js +4 -0
- package/dist/cli/decrypt-mp3.d.ts +3 -0
- package/dist/cli/decrypt-mp3.d.ts.map +1 -0
- package/dist/cli/decrypt-mp3.js +59 -0
- package/dist/cli/decrypt-oma.d.ts +2 -0
- package/dist/cli/decrypt-oma.d.ts.map +1 -0
- package/dist/cli/decrypt-oma.js +25 -0
- package/dist/cli/sign-device.d.ts +2 -0
- package/dist/cli/sign-device.d.ts.map +1 -0
- package/dist/cli/sign-device.js +30 -0
- package/dist/cli/table-file-info.d.ts +2 -0
- package/dist/cli/table-file-info.d.ts.map +1 -0
- package/dist/cli/table-file-info.js +46 -0
- package/dist/cli/tagged-oma-info.d.ts +2 -0
- package/dist/cli/tagged-oma-info.d.ts.map +1 -0
- package/dist/cli/tagged-oma-info.js +192 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +50 -0
- package/dist/codecs.d.ts +13 -0
- package/dist/codecs.d.ts.map +1 -0
- package/dist/codecs.js +40 -0
- package/dist/database-abstraction.d.ts +11 -4
- package/dist/database-abstraction.d.ts.map +1 -1
- package/dist/database-abstraction.js +84 -27
- package/dist/databases.d.ts +10 -1
- package/dist/databases.d.ts.map +1 -1
- package/dist/databases.js +2 -1
- package/dist/derive-mp3-key.d.ts +12 -0
- package/dist/derive-mp3-key.d.ts.map +1 -0
- package/dist/derive-mp3-key.js +109 -0
- package/dist/devices.d.ts +9 -2
- package/dist/devices.d.ts.map +1 -1
- package/dist/devices.js +70 -2
- package/dist/encryption.d.ts +2 -2
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +25 -12
- package/dist/filesystem/usb-mass-storage-webusb-filesystem.d.ts +2 -0
- package/dist/filesystem/usb-mass-storage-webusb-filesystem.d.ts.map +1 -1
- package/dist/filesystem/usb-mass-storage-webusb-filesystem.js +8 -1
- package/dist/helpers.d.ts +6 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +9 -8
- package/dist/id3.d.ts +7 -0
- package/dist/id3.d.ts.map +1 -1
- package/dist/id3.js +25 -1
- package/dist/init-data.d.ts +25 -14
- package/dist/init-data.d.ts.map +1 -1
- package/dist/init-data.js +23 -15
- package/dist/initialization.d.ts +3 -2
- package/dist/initialization.d.ts.map +1 -1
- package/dist/initialization.js +14 -4
- package/dist/mp3.d.ts +9 -0
- package/dist/mp3.d.ts.map +1 -0
- package/dist/mp3.js +137 -0
- package/dist/tables.d.ts +1 -0
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +3 -0
- package/dist/tagged-oma.d.ts +3 -2
- package/dist/tagged-oma.d.ts.map +1 -1
- package/dist/tagged-oma.js +72 -33
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +70 -0
- package/dist/utils.d.ts +6 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +35 -12
- package/package.json +8 -4
- package/dist/functions.d.ts +0 -12
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -73
package/dist/helpers.js
CHANGED
|
@@ -7,27 +7,28 @@ const utils_1 = require("./utils");
|
|
|
7
7
|
const devices_1 = require("./devices");
|
|
8
8
|
const initialization_1 = require("./initialization");
|
|
9
9
|
function resolvePathFromGlobalIndex(globalTrackIndex) {
|
|
10
|
-
return (0, utils_1.join)('OMGAUDIO', '
|
|
10
|
+
return (0, utils_1.join)('OMGAUDIO', `10F${(globalTrackIndex >> 8).toString(16).padStart(2, '0')}`, '1000' + globalTrackIndex.toString(16).padStart(4, '0').toUpperCase() + '.OMA');
|
|
11
11
|
}
|
|
12
12
|
exports.resolvePathFromGlobalIndex = resolvePathFromGlobalIndex;
|
|
13
|
-
async function createNWJSFS(
|
|
13
|
+
async function createNWJSFS(device) {
|
|
14
|
+
var _a, _b;
|
|
14
15
|
// Connect into the HiMD codebase
|
|
15
|
-
const fs = new filesystem_1.UMSCNWJSFilesystem(
|
|
16
|
+
const fs = new filesystem_1.UMSCNWJSFilesystem(device.dev);
|
|
16
17
|
await fs.init();
|
|
17
|
-
await (0, initialization_1.initializeIfNeeded)(fs);
|
|
18
|
+
await (0, initialization_1.initializeIfNeeded)(fs, (_b = (_a = device.definition.databaseParameters) === null || _a === void 0 ? void 0 : _a.initLayers) !== null && _b !== void 0 ? _b : []);
|
|
18
19
|
return fs;
|
|
19
20
|
}
|
|
20
21
|
exports.createNWJSFS = createNWJSFS;
|
|
21
22
|
async function openNewDeviceNode() {
|
|
22
|
-
let legacyDevice
|
|
23
|
+
let legacyDevice, definition = null;
|
|
23
24
|
for (let dev of devices_1.DeviceIds) {
|
|
24
25
|
legacyDevice = (0, usb_1.findByIds)(dev.vendorId, dev.productId);
|
|
25
26
|
if (legacyDevice) {
|
|
26
|
-
|
|
27
|
+
definition = dev;
|
|
27
28
|
break;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
if (!legacyDevice) {
|
|
31
|
+
if (!legacyDevice || !definition) {
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
34
|
legacyDevice.open();
|
|
@@ -42,6 +43,6 @@ async function openNewDeviceNode() {
|
|
|
42
43
|
}
|
|
43
44
|
const webUsbDevice = (await usb_1.WebUSBDevice.createInstance(legacyDevice));
|
|
44
45
|
await webUsbDevice.open();
|
|
45
|
-
return { dev: webUsbDevice,
|
|
46
|
+
return { dev: webUsbDevice, definition };
|
|
46
47
|
}
|
|
47
48
|
exports.openNewDeviceNode = openNewDeviceNode;
|
package/dist/id3.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InboundTrackMetadata } from './databases';
|
|
1
2
|
export interface ID3Tag {
|
|
2
3
|
id: string;
|
|
3
4
|
flags: number;
|
|
@@ -15,4 +16,10 @@ export declare function readSynchsafeInt32(data: DataView, offset: number): [num
|
|
|
15
16
|
export declare function parse(buffer: Uint8Array): ID3Tags;
|
|
16
17
|
export declare function serialize(tags: ID3Tags): Uint8Array;
|
|
17
18
|
export declare function encodeUTF16BEStringEA3(source: string, includeType?: boolean): Uint8Array;
|
|
19
|
+
export declare function encodeSonyWeirdString(type: string, data: string): Uint8Array;
|
|
20
|
+
export declare function createCommonID3Tags(titleInfo: InboundTrackMetadata): {
|
|
21
|
+
id: string;
|
|
22
|
+
contents: Uint8Array;
|
|
23
|
+
flags: number;
|
|
24
|
+
}[];
|
|
18
25
|
//# sourceMappingURL=id3.d.ts.map
|
package/dist/id3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id3.d.ts","sourceRoot":"","sources":["../src/id3.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"id3.d.ts","sourceRoot":"","sources":["../src/id3.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAiB,MAAM,aAAa,CAAC;AAGlE,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACpB,OAAO,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAYnF;AAKD,wBAAgB,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CA+CjD;AAWD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAuCnD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,UAAO,cAgCxE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAM/D;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,oBAAoB;;;;IAYlE"}
|
package/dist/id3.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeUTF16BEStringEA3 = exports.serialize = exports.parse = exports.readSynchsafeInt32 = void 0;
|
|
3
|
+
exports.createCommonID3Tags = exports.encodeSonyWeirdString = exports.encodeUTF16BEStringEA3 = exports.serialize = exports.parse = exports.readSynchsafeInt32 = void 0;
|
|
4
4
|
const bytemanip_1 = require("./bytemanip");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
5
6
|
function readSynchsafeInt32(data, offset) {
|
|
6
7
|
let value = 0;
|
|
7
8
|
let byte;
|
|
@@ -135,3 +136,26 @@ function encodeUTF16BEStringEA3(source, includeType = true) {
|
|
|
135
136
|
return new Uint8Array(rawArr);
|
|
136
137
|
}
|
|
137
138
|
exports.encodeUTF16BEStringEA3 = encodeUTF16BEStringEA3;
|
|
139
|
+
function encodeSonyWeirdString(type, data) {
|
|
140
|
+
return (0, utils_1.concatUint8Arrays)([
|
|
141
|
+
encodeUTF16BEStringEA3(type),
|
|
142
|
+
new Uint8Array([0, 0]),
|
|
143
|
+
encodeUTF16BEStringEA3(data, false),
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
146
|
+
exports.encodeSonyWeirdString = encodeSonyWeirdString;
|
|
147
|
+
function createCommonID3Tags(titleInfo) {
|
|
148
|
+
var _a;
|
|
149
|
+
return [
|
|
150
|
+
{ id: "TIT2", contents: encodeUTF16BEStringEA3(titleInfo.title), flags: 0 },
|
|
151
|
+
{ id: "TPE1", contents: encodeUTF16BEStringEA3(titleInfo.artist), flags: 0 },
|
|
152
|
+
{ id: "TALB", contents: encodeUTF16BEStringEA3(titleInfo.album), flags: 0 },
|
|
153
|
+
{ id: "TALB", contents: encodeUTF16BEStringEA3(titleInfo.album), flags: 0 },
|
|
154
|
+
{ id: "TCON", contents: encodeUTF16BEStringEA3(titleInfo.genre), flags: 0 },
|
|
155
|
+
{ id: "TXXX", contents: encodeSonyWeirdString("OMG_TPE1S", titleInfo.artist), flags: 0 },
|
|
156
|
+
{ id: "TXXX", contents: encodeSonyWeirdString("OMG_TRACK", ((_a = titleInfo.trackNumber) !== null && _a !== void 0 ? _a : 0) + ''), flags: 0 },
|
|
157
|
+
{ id: "TXXX", contents: encodeSonyWeirdString("OMG_ALBMS", titleInfo.album), flags: 0 },
|
|
158
|
+
{ id: "TXXX", contents: encodeSonyWeirdString("OMG_TIT2S", titleInfo.title), flags: 0 },
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
exports.createCommonID3Tags = createCommonID3Tags;
|
package/dist/init-data.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export declare type InitializationLayer = {
|
|
2
|
+
[fileName: string]: Uint8Array;
|
|
3
|
+
};
|
|
4
|
+
export declare const LAYERS: {
|
|
5
|
+
root: {
|
|
6
|
+
"00010021.DAT": Uint8Array;
|
|
7
|
+
"00GTRLST.DAT": Uint8Array;
|
|
8
|
+
"01TREE01.DAT": Uint8Array;
|
|
9
|
+
"01TREE02.DAT": Uint8Array;
|
|
10
|
+
"01TREE03.DAT": Uint8Array;
|
|
11
|
+
"01TREE04.DAT": Uint8Array;
|
|
12
|
+
"02TREINF.DAT": Uint8Array;
|
|
13
|
+
"03GINF01.DAT": Uint8Array;
|
|
14
|
+
"03GINF02.DAT": Uint8Array;
|
|
15
|
+
"03GINF03.DAT": Uint8Array;
|
|
16
|
+
"03GINF04.DAT": Uint8Array;
|
|
17
|
+
"04CNTINF.DAT": Uint8Array;
|
|
18
|
+
"05CHINDC.DAT": Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
stick_gtrlst: {
|
|
21
|
+
"00GTRLST.DAT": Uint8Array;
|
|
22
|
+
};
|
|
23
|
+
needs_cid: {
|
|
24
|
+
"05CIDLST.DAT": Uint8Array;
|
|
25
|
+
};
|
|
15
26
|
};
|
|
16
27
|
//# sourceMappingURL=init-data.d.ts.map
|
package/dist/init-data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-data.d.ts","sourceRoot":"","sources":["../src/init-data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"init-data.d.ts","sourceRoot":"","sources":["../src/init-data.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;CAsBlB,CAAC"}
|
package/dist/init-data.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"02TREINF.DAT": new Uint8Array([71, 84, 73, 70, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 71, 84, 70, 66, 0, 0, 0, 32, 0, 0, 31, 0, 0, 0, 0, 0, 71, 84, 70, 66, 0, 4, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 128, 84, 73, 84, 50, 0, 2, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
exports.LAYERS = void 0;
|
|
4
|
+
exports.LAYERS = {
|
|
5
|
+
root: {
|
|
6
|
+
"00010021.DAT": new Uint8Array([69, 75, 66, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 33, 0, 0, 0, 0, 117, 235, 254, 220, 201, 194, 217, 63, 114, 198, 213, 235, 134, 217, 169, 116, 248, 95, 111, 33, 222, 191, 41, 17, 0, 0, 0, 12, 0, 0, 0, 32, 0, 0, 0, 52, 164, 146, 65, 95, 128, 0, 0, 0, 0, 0, 0, 0, 18, 163, 225, 187, 118, 162, 176, 132, 191, 20, 46, 122, 172, 121, 207, 233, 240, 92, 183, 254, 222, 60, 148, 1, 120, 74, 113, 141, 159, 247, 244, 177, 0, 0, 0, 5, 1, 0, 0, 0, 1, 0, 0, 40, 49, 194, 220, 160, 49, 239, 65, 172, 233, 23, 239, 231, 77, 180, 222, 111, 60, 32, 165, 189, 50, 161, 207, 18, 140, 212, 9, 192, 107, 206, 87, 138, 206, 145, 95, 175, 136, 43, 92, 84]),
|
|
7
|
+
"00GTRLST.DAT": new Uint8Array([71, 84, 76, 84, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 83, 89, 83, 66, 0, 0, 0, 48, 0, 0, 0, 112, 0, 0, 0, 0, 71, 84, 76, 66, 0, 0, 0, 160, 0, 0, 1, 80, 0, 0, 0, 0, 83, 89, 83, 66, 0, 1, 0, 80, 208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 67, 79, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
8
|
+
"01TREE01.DAT": new Uint8Array([84, 82, 69, 69, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 48, 0, 0, 0, 16, 0, 0, 0, 0, 84, 80, 76, 66, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84, 80, 76, 66, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
9
|
+
"01TREE02.DAT": new Uint8Array([84, 82, 69, 69, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 48, 0, 0, 0, 16, 0, 0, 0, 0, 84, 80, 76, 66, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84, 80, 76, 66, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
10
|
+
"01TREE03.DAT": new Uint8Array([84, 82, 69, 69, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 48, 0, 0, 0, 16, 0, 0, 0, 0, 84, 80, 76, 66, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 76, 66, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 84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|
+
"03GINF02.DAT": new Uint8Array([71, 80, 73, 70, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 32, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
15
|
+
"03GINF03.DAT": new Uint8Array([71, 80, 73, 70, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 32, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
16
|
+
"03GINF04.DAT": new Uint8Array([71, 80, 73, 70, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 32, 0, 0, 0, 16, 0, 0, 0, 0, 71, 80, 70, 66, 0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
17
|
+
"04CNTINF.DAT": new Uint8Array([67, 78, 73, 70, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 67, 78, 70, 66, 0, 0, 0, 32, 0, 0, 0, 16, 0, 0, 0, 0, 67, 78, 70, 66, 0, 0, 2, 144, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
18
|
+
"05CHINDC.DAT": new Uint8Array([67, 72, 73, 68, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 67, 73, 68, 66, 0, 0, 0, 32, 0, 0, 0, 16, 0, 0, 0, 0, 67, 73, 68, 66, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
19
|
+
},
|
|
20
|
+
stick_gtrlst: {
|
|
21
|
+
"00GTRLST.DAT": new Uint8Array([71, 84, 76, 84, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 83, 89, 83, 66, 0, 0, 0, 48, 0, 0, 0, 112, 0, 0, 0, 0,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0, 48, 0, 0, 0, 0, 0, 0, 0, 0]),
|
|
25
|
+
},
|
|
18
26
|
};
|
package/dist/initialization.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HiMDFilesystem } from "himd-js";
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import { LAYERS } from "./init-data";
|
|
3
|
+
export declare function initializeNW(filesystem: HiMDFilesystem, initLayers: (keyof typeof LAYERS)[]): Promise<void>;
|
|
4
|
+
export declare function initializeIfNeeded(filesystem: HiMDFilesystem, initLayers: (keyof typeof LAYERS)[]): Promise<void>;
|
|
4
5
|
//# sourceMappingURL=initialization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialization.d.ts","sourceRoot":"","sources":["../src/initialization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"initialization.d.ts","sourceRoot":"","sources":["../src/initialization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAuB,MAAM,EAAE,MAAM,aAAa,CAAC;AAY1D,wBAAsB,YAAY,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,MAAM,OAAO,MAAM,CAAC,EAAE,iBAiBjG;AAED,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,MAAM,OAAO,MAAM,CAAC,EAAE,iBAMvG"}
|
package/dist/initialization.js
CHANGED
|
@@ -4,11 +4,21 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.initializeIfNeeded = exports.initializeNW = void 0;
|
|
6
6
|
const init_data_1 = require("./init-data");
|
|
7
|
-
|
|
7
|
+
function constructFinalContents(layerNames) {
|
|
8
|
+
const currentOverlayed = { ...init_data_1.LAYERS.root };
|
|
9
|
+
for (const layer of layerNames) {
|
|
10
|
+
for (const [name, value] of Object.entries(init_data_1.LAYERS[layer])) {
|
|
11
|
+
currentOverlayed[name] = value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return currentOverlayed;
|
|
15
|
+
}
|
|
16
|
+
async function initializeNW(filesystem, initLayers) {
|
|
8
17
|
// mkdir the root dir
|
|
9
18
|
await filesystem.mkdir("/OMGAUDIO");
|
|
10
19
|
console.log("Initializing the walkman...");
|
|
11
|
-
|
|
20
|
+
const initData = constructFinalContents(initLayers);
|
|
21
|
+
for (let [name, contents] of Object.entries(initData)) {
|
|
12
22
|
console.log(`Initializing ${name}...`);
|
|
13
23
|
const file = await filesystem.open(`/OMGAUDIO/${name}`, 'rw');
|
|
14
24
|
await file.write(contents);
|
|
@@ -22,11 +32,11 @@ async function initializeNW(filesystem) {
|
|
|
22
32
|
console.log(`Initializing complete!`);
|
|
23
33
|
}
|
|
24
34
|
exports.initializeNW = initializeNW;
|
|
25
|
-
async function initializeIfNeeded(filesystem) {
|
|
35
|
+
async function initializeIfNeeded(filesystem, initLayers) {
|
|
26
36
|
const rootContents = await filesystem.list("/");
|
|
27
37
|
if (!rootContents.find(e => e.type === 'directory' && e.name === '/OMGAUDIO')) {
|
|
28
38
|
// This is an uninitialized NW.
|
|
29
|
-
await initializeNW(filesystem);
|
|
39
|
+
await initializeNW(filesystem, initLayers);
|
|
30
40
|
}
|
|
31
41
|
}
|
|
32
42
|
exports.initializeIfNeeded = initializeIfNeeded;
|
package/dist/mp3.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NWCodecInfo } from './codecs';
|
|
2
|
+
import { InboundTrackMetadata } from './databases';
|
|
3
|
+
export declare function generateMP3CodecField(mp3Data: Uint8Array): {
|
|
4
|
+
codec: NWCodecInfo;
|
|
5
|
+
duration: number;
|
|
6
|
+
frames: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function createMP3OMAFile(index: number, metadata: InboundTrackMetadata, rawFile: Uint8Array, deviceKey: number, codec: NWCodecInfo): Uint8Array;
|
|
9
|
+
//# sourceMappingURL=mp3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mp3.d.ts","sourceRoot":"","sources":["../src/mp3.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,WAAW,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAiB,MAAM,aAAa,CAAC;AAmBlE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAsFnH;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,UAAU,CAoCtJ"}
|
package/dist/mp3.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMP3OMAFile = exports.generateMP3CodecField = void 0;
|
|
4
|
+
const mp3_parser_1 = require("mp3-parser");
|
|
5
|
+
const bytemanip_1 = require("./bytemanip");
|
|
6
|
+
const codecs_1 = require("./codecs");
|
|
7
|
+
const id3_1 = require("./id3");
|
|
8
|
+
const encryption_1 = require("./encryption");
|
|
9
|
+
const HIMD_MP3_VAR_VERSION = 0x40;
|
|
10
|
+
const HIMD_MP3_VAR_LAYER = 0x20;
|
|
11
|
+
const HIMD_MP3_VAR_BITRATE = 0x10;
|
|
12
|
+
const HIMD_MP3_VAR_SRATE = 0x08;
|
|
13
|
+
const HIMD_MP3_VAR_CHMODE = 0x04;
|
|
14
|
+
const HIMD_MP3_VAR_PREEMPH = 0x02;
|
|
15
|
+
const MP3_SAMPLE_RATE_TABLE = [
|
|
16
|
+
[11.025, 12, 8],
|
|
17
|
+
[],
|
|
18
|
+
[22.05, 24, 16],
|
|
19
|
+
[44.1, 48, 32],
|
|
20
|
+
];
|
|
21
|
+
const ONE_CHANNEL_SAMPLES_IN_FRAME = 576;
|
|
22
|
+
function generateMP3CodecField(mp3Data) {
|
|
23
|
+
// Generate flags:
|
|
24
|
+
const view = new DataView(mp3Data.buffer);
|
|
25
|
+
const findRootSection = (type) => (0, mp3_parser_1.readTags)(view).filter((e) => e._section.type === type)[0];
|
|
26
|
+
let frame = findRootSection('frame');
|
|
27
|
+
let mpegVers = 3, mpegLayer = 1, mpegBitrate = 9, mpegSampleRate = 0, mpegChMode = 0, mpegPreemph = 0, flags = 0x80, frameCount = 0, totalDuration = 0, firstTime = true;
|
|
28
|
+
for (;;) {
|
|
29
|
+
++frameCount;
|
|
30
|
+
let blockMpegVersion = (view.getUint8(frame.header._section.offset + 1) >> 3) & 0x03, //binary(frame.header.mpegAudioVersionBits),
|
|
31
|
+
blockMpegLayer = (view.getUint8(frame.header._section.offset + 1) >> 1) & 0x03, //binary(frame.header.layerDescriptionBits),
|
|
32
|
+
blockMpegBitrate = (view.getUint8(frame.header._section.offset + 2) >> 4) & 0x0f, //binary(frame.header.bitrateBits),
|
|
33
|
+
blockMpegSampleRate = (view.getUint8(frame.header._section.offset + 2) >> 2) & 0x03, //binary(frame.header.samplingRateBits),
|
|
34
|
+
blockMpegChannelMode = (view.getUint8(frame.header._section.offset + 3) >> 6) & 0x03, //binary(frame.header.channelModeBits),
|
|
35
|
+
blockMpegPreemph = view.getUint8(frame.header._section.offset + 3) & 0x03;
|
|
36
|
+
if (firstTime) {
|
|
37
|
+
mpegVers = blockMpegVersion;
|
|
38
|
+
mpegLayer = blockMpegLayer;
|
|
39
|
+
mpegBitrate = blockMpegBitrate;
|
|
40
|
+
mpegSampleRate = blockMpegSampleRate;
|
|
41
|
+
mpegChMode = blockMpegChannelMode;
|
|
42
|
+
mpegPreemph = blockMpegPreemph;
|
|
43
|
+
firstTime = false;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (blockMpegVersion !== mpegVers) {
|
|
47
|
+
flags |= HIMD_MP3_VAR_VERSION;
|
|
48
|
+
mpegVers = Math.min(mpegVers, blockMpegVersion); /* smaller num -> higher version */
|
|
49
|
+
}
|
|
50
|
+
if (blockMpegLayer !== mpegLayer) {
|
|
51
|
+
flags |= HIMD_MP3_VAR_LAYER;
|
|
52
|
+
mpegLayer = Math.min(mpegLayer, blockMpegLayer); /* smaller num -> higher layer */
|
|
53
|
+
}
|
|
54
|
+
if (blockMpegBitrate !== mpegBitrate) {
|
|
55
|
+
/* TODO: check whether "free-form" streams need special handling */
|
|
56
|
+
flags |= HIMD_MP3_VAR_BITRATE;
|
|
57
|
+
mpegBitrate = Math.max(mpegBitrate, blockMpegBitrate);
|
|
58
|
+
}
|
|
59
|
+
if (blockMpegSampleRate !== mpegSampleRate) {
|
|
60
|
+
flags |= HIMD_MP3_VAR_SRATE;
|
|
61
|
+
/* "1" is highest (48), "0" is medium (44), "2" is lowest (32) */
|
|
62
|
+
if (mpegSampleRate !== 1) {
|
|
63
|
+
if (blockMpegSampleRate === 1)
|
|
64
|
+
mpegSampleRate = blockMpegSampleRate;
|
|
65
|
+
else
|
|
66
|
+
mpegSampleRate = Math.min(mpegSampleRate, blockMpegSampleRate);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (blockMpegChannelMode !== mpegChMode) {
|
|
70
|
+
/* TODO: find out how to choose "maximal" mode */
|
|
71
|
+
flags |= HIMD_MP3_VAR_CHMODE;
|
|
72
|
+
}
|
|
73
|
+
if (blockMpegPreemph !== mpegPreemph) {
|
|
74
|
+
/* TODO: find out how to choose "maximal" preemphasis */
|
|
75
|
+
flags |= HIMD_MP3_VAR_PREEMPH;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const channelCount = (mpegChMode & 0b10) === 0 ? 2 : 1;
|
|
79
|
+
totalDuration += ONE_CHANNEL_SAMPLES_IN_FRAME * channelCount / MP3_SAMPLE_RATE_TABLE[blockMpegVersion][blockMpegSampleRate];
|
|
80
|
+
let nextFrameIndex = frame._section.nextFrameIndex;
|
|
81
|
+
if (!nextFrameIndex)
|
|
82
|
+
break;
|
|
83
|
+
frame = (0, mp3_parser_1.readFrame)(view, nextFrameIndex);
|
|
84
|
+
if (frame === null)
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
const mp3CodecInfo = new Uint8Array(3 + 4 + 4);
|
|
88
|
+
mp3CodecInfo[0] = flags;
|
|
89
|
+
mp3CodecInfo[1] = (mpegVers << 6) | (mpegLayer << 4) | mpegBitrate;
|
|
90
|
+
mp3CodecInfo[2] = (mpegSampleRate << 6) | (mpegChMode << 4) | (mpegPreemph << 2);
|
|
91
|
+
mp3CodecInfo.set((0, bytemanip_1.writeUint32)(Math.floor(totalDuration)), 3);
|
|
92
|
+
mp3CodecInfo.set((0, bytemanip_1.writeUint32)(Math.floor(frameCount)), 7);
|
|
93
|
+
return {
|
|
94
|
+
codec: {
|
|
95
|
+
codecId: codecs_1.NWCodec.MP3, codecInfo: mp3CodecInfo, complete: true
|
|
96
|
+
},
|
|
97
|
+
duration: totalDuration,
|
|
98
|
+
frames: frameCount,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
exports.generateMP3CodecField = generateMP3CodecField;
|
|
102
|
+
function createMP3OMAFile(index, metadata, rawFile, deviceKey, codec) {
|
|
103
|
+
// Strip all ID3 tags from the source MP3 file
|
|
104
|
+
let cursor = 0;
|
|
105
|
+
const rawDataView = new DataView(rawFile.buffer);
|
|
106
|
+
const ID3_MAGIC = new TextEncoder().encode("ID3");
|
|
107
|
+
while (ID3_MAGIC.every((e, i) => rawFile[cursor + i] === e)) {
|
|
108
|
+
// We're in an ID3 section
|
|
109
|
+
const length = (0, id3_1.readSynchsafeInt32)(rawDataView, cursor + 6)[0];
|
|
110
|
+
cursor += 10 + length;
|
|
111
|
+
}
|
|
112
|
+
// Cursor points to the start of the first MP3 frame in this file.
|
|
113
|
+
// Create the new and compliant ID3 tag set from metadata
|
|
114
|
+
const rootID3 = (0, id3_1.serialize)({
|
|
115
|
+
version: { major: 3, minor: 0 },
|
|
116
|
+
flags: 0,
|
|
117
|
+
tags: [
|
|
118
|
+
...(0, id3_1.createCommonID3Tags)(metadata),
|
|
119
|
+
{ id: 'TXXX', flags: 0, contents: (0, id3_1.encodeSonyWeirdString)("OMG_FPRCA1", " ") },
|
|
120
|
+
{ id: 'TXXX', flags: 0, contents: (0, id3_1.encodeSonyWeirdString)("OMG_FCRCA1", " ") },
|
|
121
|
+
{ id: 'TXXX', flags: 0, contents: (0, id3_1.encodeSonyWeirdString)("OMG_TRLDA", "1982/01/01 00:00:00") },
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
const formatHeader = (0, codecs_1.createEA3Header)(codec, 0xFFFE, 2);
|
|
125
|
+
const finalFileBuffer = new Uint8Array(rootID3.length + formatHeader.length + rawFile.length - cursor);
|
|
126
|
+
finalFileBuffer.set(rootID3, 0);
|
|
127
|
+
finalFileBuffer.set(formatHeader, rootID3.length);
|
|
128
|
+
const finalDataView = new DataView(finalFileBuffer.buffer);
|
|
129
|
+
const key = (0, encryption_1.getMP3EncryptionKey)(deviceKey, index);
|
|
130
|
+
let finalBufferCursor = rootID3.length + formatHeader.length;
|
|
131
|
+
for (; cursor < rawFile.length - 7; cursor += 8, finalBufferCursor += 8) {
|
|
132
|
+
finalDataView.setUint32(finalBufferCursor, rawDataView.getUint32(cursor) ^ key);
|
|
133
|
+
finalDataView.setUint32(finalBufferCursor + 4, rawDataView.getUint32(cursor + 4) ^ key);
|
|
134
|
+
}
|
|
135
|
+
return finalFileBuffer;
|
|
136
|
+
}
|
|
137
|
+
exports.createMP3OMAFile = createMP3OMAFile;
|
package/dist/tables.d.ts
CHANGED
package/dist/tables.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,QAAQ,EAAE,kBAAkB,EAAE,CAAA;CACjC;AAED,wBAAgB,UAAU,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,CA0CnE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,UAAO,GAAG,UAAU,CAuDzF"}
|
package/dist/tables.js
CHANGED
|
@@ -55,6 +55,9 @@ function serializeTable(tableFile, writeSecondLength = true) {
|
|
|
55
55
|
if (contentLength % 16 !== 0) {
|
|
56
56
|
contentLength += 16 - (contentLength % 16);
|
|
57
57
|
}
|
|
58
|
+
if (tableFile.classes[i]._overrideMinimalClassLength) {
|
|
59
|
+
contentLength = Math.max(contentLength, tableFile.classes[i]._overrideMinimalClassLength);
|
|
60
|
+
}
|
|
58
61
|
if (tableFile.classes[i].classLength < contentLength) {
|
|
59
62
|
let difference = contentLength - tableFile.classes[i].classLength;
|
|
60
63
|
tableFile.classes[i].classLength = contentLength;
|
package/dist/tagged-oma.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HiMDCodec, HiMDFile } from "himd-js";
|
|
2
|
-
import { TrackMetadata } from './databases';
|
|
3
|
-
export declare function createTaggedEncryptedOMA(rawData: Uint8Array, titleInfo:
|
|
2
|
+
import { InboundTrackMetadata, TrackMetadata } from './databases';
|
|
3
|
+
export declare function createTaggedEncryptedOMA(rawData: Uint8Array, titleInfo: InboundTrackMetadata, codec: {
|
|
4
4
|
codecId: HiMDCodec;
|
|
5
5
|
codecInfo: Uint8Array;
|
|
6
6
|
}): {
|
|
@@ -9,4 +9,5 @@ export declare function createTaggedEncryptedOMA(rawData: Uint8Array, titleInfo:
|
|
|
9
9
|
duration: number;
|
|
10
10
|
};
|
|
11
11
|
export declare function updateMetadata(file: HiMDFile, titleInfo: TrackMetadata): Promise<void>;
|
|
12
|
+
export declare function decryptOMA(omaFile: Uint8Array): Uint8Array;
|
|
12
13
|
//# sourceMappingURL=tagged-oma.d.ts.map
|
package/dist/tagged-oma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagged-oma.d.ts","sourceRoot":"","sources":["../src/tagged-oma.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,SAAS,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"tagged-oma.d.ts","sourceRoot":"","sources":["../src/tagged-oma.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5E,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAqGlE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAC;;;;EAchJ;AAeD,wBAAsB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,iBA+B5E;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAyD1D"}
|