gerdur 2.11.2 → 2.12.0
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/CHANGELOG.md +22 -0
- package/dist/package.json +2 -2
- package/dist/src/lib/download-track.js +25 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.12.0 - 2026-08-31
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Downloads no longer hold the track in memory.** The final stage was
|
|
8
|
+
temp file -> `readFileSync` -> `addTrackTags` (which allocates the file again,
|
|
9
|
+
plus another copy to strip Deezer's existing tag) -> `writeFileSync`. It is now
|
|
10
|
+
a single streamed pass — **temp file -> decrypt -> tag -> destination** — using
|
|
11
|
+
`gerdur-core@2.15.0`'s `resolveTagModel` + `createTagStream`. Peak memory per
|
|
12
|
+
concurrent download drops from ~2-3x the track size to roughly a couple of
|
|
13
|
+
2048-byte stripes plus the cover art, which matters most with `-c 8` on FLAC.
|
|
14
|
+
Output is byte-identical.
|
|
15
|
+
- The intermediate `.dec` temp file is gone — decryption is now a stage in that
|
|
16
|
+
same pipeline rather than a separate pass over the whole file.
|
|
17
|
+
- Tracks are written to `<name>.part` and renamed on success, so an interrupted
|
|
18
|
+
or failed run can no longer leave a half-written file where a real track
|
|
19
|
+
should be.
|
|
20
|
+
|
|
21
|
+
Verified end to end against live downloads: MP3 (ID3v2.3, all frames, 324 kbps)
|
|
22
|
+
and FLAC (STREAMINFO / SEEKTABLE / VORBIS_COMMENT / 2x PICTURE / PADDING, 16-bit
|
|
23
|
+
44.1 kHz) both decode with zero errors under ffmpeg.
|
|
24
|
+
|
|
3
25
|
## 2.11.2 - 2026-08-31
|
|
4
26
|
|
|
5
27
|
### Changed
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gerdur",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Command-line music downloader for Deezer (Spotify/Tidal links resolved via ISRC matching) with automatic MP3/FLAC tagging, synced lyrics and a side-effect-free programmatic API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deezer",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"adm-zip": "^0.5.16",
|
|
64
64
|
"chalk": "^4.1.2",
|
|
65
65
|
"commander": "^9.5.0",
|
|
66
|
-
"gerdur-core": "^2.
|
|
66
|
+
"gerdur-core": "^2.15.0",
|
|
67
67
|
"dot-prop": "^6.0.1",
|
|
68
68
|
"got": "^11.8.6",
|
|
69
69
|
"gradient-string": "^2.0.2",
|
|
@@ -13,7 +13,6 @@ const log_update_1 = __importDefault(require("log-update"));
|
|
|
13
13
|
const chalk_1 = __importDefault(require("chalk"));
|
|
14
14
|
const signale_1 = __importDefault(require("../lib/signale"));
|
|
15
15
|
const util_2 = require("./util");
|
|
16
|
-
const decrypt_1 = require("./decrypt");
|
|
17
16
|
const pipeline = (0, util_1.promisify)(stream_1.default.pipeline);
|
|
18
17
|
const simulate = process.env.SIMULATE;
|
|
19
18
|
/** media-API format string -> gerdur's numeric quality */
|
|
@@ -142,17 +141,6 @@ const downloadTrack = async ({ track, quality, info, coverSizes, path, totalTrac
|
|
|
142
141
|
(0, log_update_1.default)(signale_1.default.info(`Downloading ${track.SNG_TITLE} ${message}\n ${bar(transferred)} | ${humanSizeTotal}MiB`));
|
|
143
142
|
}
|
|
144
143
|
}), (0, fs_1.createWriteStream)(tmpfile, { flags: 'a', autoClose: true }));
|
|
145
|
-
let outFile;
|
|
146
|
-
if (trackData.isEncrypted) {
|
|
147
|
-
(0, log_update_1.default)(signale_1.default.pending('Decrypting ' + track.SNG_TITLE + ' by ' + track.ART_NAME));
|
|
148
|
-
const decfile = tmpfile + '.dec';
|
|
149
|
-
await (0, decrypt_1.decryptFileToFile)(tmpfile, decfile, track.SNG_ID); // streamed — ~one stripe in memory
|
|
150
|
-
outFile = (0, fs_1.readFileSync)(decfile);
|
|
151
|
-
(0, fs_1.unlinkSync)(decfile);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
outFile = (0, fs_1.readFileSync)(tmpfile);
|
|
155
|
-
}
|
|
156
144
|
let enrichedCover;
|
|
157
145
|
if (enrich && track.ISRC && !simulate) {
|
|
158
146
|
try {
|
|
@@ -167,12 +155,12 @@ const downloadTrack = async ({ track, quality, info, coverSizes, path, totalTrac
|
|
|
167
155
|
}
|
|
168
156
|
}
|
|
169
157
|
(0, log_update_1.default)(signale_1.default.pending('Tagging ' + track.SNG_TITLE + ' by ' + track.ART_NAME));
|
|
170
|
-
|
|
158
|
+
// Resolve the metadata first, without touching the audio — the tags are then
|
|
159
|
+
// written by a stream, so the track is never held in memory.
|
|
160
|
+
const model = await (0, gerdur_core_1.resolveTagModel)(track, {
|
|
171
161
|
coverSize,
|
|
172
162
|
...(enrichedCover ? { cover: enrichedCover } : {}),
|
|
173
163
|
});
|
|
174
|
-
// Delete temporary file now
|
|
175
|
-
(0, fs_1.unlinkSync)(tmpfile);
|
|
176
164
|
(0, log_update_1.default)(signale_1.default.pending('Saving ' + track.SNG_TITLE + ' by ' + track.ART_NAME));
|
|
177
165
|
if (!simulate) {
|
|
178
166
|
// Create directory if not exists
|
|
@@ -180,12 +168,32 @@ const downloadTrack = async ({ track, quality, info, coverSizes, path, totalTrac
|
|
|
180
168
|
if (!(0, fs_1.existsSync)(dir)) {
|
|
181
169
|
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
182
170
|
}
|
|
183
|
-
//
|
|
184
|
-
|
|
171
|
+
// One pass: temp file -> decrypt -> tag -> destination. Peak memory is a
|
|
172
|
+
// couple of stripes plus the cover, instead of the whole track two or
|
|
173
|
+
// three times over. `.part` then rename so an interrupted run never
|
|
174
|
+
// leaves a half-written track behind.
|
|
175
|
+
const partPath = savePath + '.part';
|
|
176
|
+
const stages = [(0, fs_1.createReadStream)(tmpfile)];
|
|
177
|
+
if (trackData.isEncrypted) {
|
|
178
|
+
stages.push((0, gerdur_core_1.createDecryptStream)(track.SNG_ID));
|
|
179
|
+
}
|
|
180
|
+
stages.push((0, gerdur_core_1.createTagStream)(model), (0, fs_1.createWriteStream)(partPath));
|
|
181
|
+
try {
|
|
182
|
+
await pipeline(...stages);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
if ((0, fs_1.existsSync)(partPath)) {
|
|
186
|
+
(0, fs_1.unlinkSync)(partPath);
|
|
187
|
+
}
|
|
188
|
+
throw err;
|
|
189
|
+
}
|
|
190
|
+
(0, fs_1.renameSync)(partPath, savePath);
|
|
185
191
|
if (lrc !== false && model.lyricsSynced) {
|
|
186
192
|
(0, fs_1.writeFileSync)(savePath.replace(/\.(mp3|flac)$/i, '.lrc'), model.lyricsSynced);
|
|
187
193
|
}
|
|
188
194
|
}
|
|
195
|
+
// Delete temporary file now
|
|
196
|
+
(0, fs_1.unlinkSync)(tmpfile);
|
|
189
197
|
// Print sucess info
|
|
190
198
|
(0, log_update_1.default)(signale_1.default.success(`${isFallback ? chalk_1.default.yellow('[Fallback] ') : ''}${track.SNG_TITLE} by ${track.ART_NAME}`));
|
|
191
199
|
log_update_1.default.done();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gerdur",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Command-line music downloader for Deezer (Spotify/Tidal links resolved via ISRC matching) with automatic MP3/FLAC tagging, synced lyrics and a side-effect-free programmatic API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deezer",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"adm-zip": "^0.5.16",
|
|
64
64
|
"chalk": "^4.1.2",
|
|
65
65
|
"commander": "^9.5.0",
|
|
66
|
-
"gerdur-core": "^2.
|
|
66
|
+
"gerdur-core": "^2.15.0",
|
|
67
67
|
"dot-prop": "^6.0.1",
|
|
68
68
|
"got": "^11.8.6",
|
|
69
69
|
"gradient-string": "^2.0.2",
|