@purpleproser/soundboard-downloader-cli 1.4.0 → 1.5.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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This changelog is automatically generated by [release-please](https://github.com/google-github-actions/release-please-action).
4
4
 
5
+ ## [1.5.0](https://github.com/blacksagres/soundboard-downloader-cli/compare/v1.4.0...v1.5.0) (2026-02-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * download multiple files ([c2e257c](https://github.com/blacksagres/soundboard-downloader-cli/commit/c2e257cc6e9916679c86c902609fb328431cebbd))
11
+
5
12
  ## [1.4.0](https://github.com/blacksagres/soundboard-downloader-cli/compare/v1.3.0...v1.4.0) (2026-02-20)
6
13
 
7
14
 
package/dist/main.js CHANGED
@@ -6,6 +6,7 @@ const ora_1 = require("ora");
6
6
  const prompts_1 = require("@inquirer/prompts");
7
7
  const open_1 = require("open");
8
8
  const file_downloader_service_1 = require("./service/file-downloader.service");
9
+ const selection_utils_1 = require("./utils/selection-utils");
9
10
  process.on("uncaughtException", (error) => {
10
11
  if (error instanceof Error && error.name === "ExitPromptError") {
11
12
  console.log("👋 see ya!");
@@ -29,58 +30,98 @@ process.on("uncaughtException", (error) => {
29
30
  const sounds = await (0, my_instants_service_1.getSoundNodes)(answer);
30
31
  spinner.stop();
31
32
  console.log(`🎉 Found ${sounds.length} sound${sounds.length !== 1 ? 's' : ''}!`);
32
- const selection = await (0, prompts_1.select)({
33
- message: "🎵 Which one to download? (use the keyboard arrows to navigate, search for something directly)",
33
+ const rawSelections = await (0, prompts_1.checkbox)({
34
+ message: "🎵 Which sounds to download? (use space to select multiple, arrows to navigate, search for something directly)",
34
35
  pageSize: 30,
35
36
  choices: sounds.map((sound) => ({
36
37
  name: `${sound.label} 🎵`,
37
38
  value: `${sound.label}||${sound.download_url}`,
38
39
  })),
39
40
  });
40
- const [label, downloadUrl] = selection.split("||");
41
- if (!downloadUrl) {
42
- throw new ReferenceError(`There is no download URL for: ${label}`);
43
- }
44
- const actions = [
41
+ // Parse and validate selections
42
+ const selections = (0, selection_utils_1.parseSelections)(rawSelections);
43
+ const multipleSelected = (0, selection_utils_1.isMultipleSelection)(selections);
44
+ // Determine available actions based on selection count
45
+ let actions = [
45
46
  {
46
47
  name: "💾 Download",
47
48
  value: "action:download",
48
49
  },
49
- {
50
- name: "▶️ Play",
51
- value: "action:play",
52
- },
53
- {
54
- name: "🔗 Show download URL (you can pipe this to other commands)",
55
- value: "action:show-url",
56
- },
57
50
  ];
51
+ // For single selection, add additional options
52
+ if (!multipleSelected) {
53
+ actions = [
54
+ ...actions,
55
+ {
56
+ name: "▶️ Play",
57
+ value: "action:play",
58
+ },
59
+ {
60
+ name: "🔗 Show download URL (you can pipe this to other commands)",
61
+ value: "action:show-url",
62
+ }
63
+ ];
64
+ }
58
65
  const action = await (0, prompts_1.select)({
59
- message: `Selected: ${label}`,
66
+ message: (0, selection_utils_1.getSelectionMessage)(selections),
60
67
  choices: actions,
61
68
  });
62
- if (action === "action:show-url") {
63
- console.log(downloadUrl);
69
+ if (action === "action:show-url" && !multipleSelected) {
70
+ const firstSelection = (0, selection_utils_1.getFirstSelection)(selections);
71
+ if (firstSelection) {
72
+ console.log(firstSelection.downloadUrl);
73
+ }
64
74
  }
65
- if (action === "action:play") {
66
- (0, open_1.default)(downloadUrl);
75
+ if (action === "action:play" && !multipleSelected) {
76
+ const firstSelection = (0, selection_utils_1.getFirstSelection)(selections);
77
+ if (firstSelection) {
78
+ (0, open_1.default)(firstSelection.downloadUrl);
79
+ }
67
80
  }
68
81
  if (action === "action:download") {
69
- const downloadSpinner = (0, ora_1.default)({
70
- text: "Downloading file...",
82
+ const totalDownloads = selections.length;
83
+ let completedDownloads = 0;
84
+ let failedDownloads = 0;
85
+ const failedFiles = [];
86
+ const masterSpinner = (0, ora_1.default)({
87
+ text: `Preparing to download ${totalDownloads} file${totalDownloads !== 1 ? 's' : ''}...`,
71
88
  color: "cyan",
72
89
  spinner: "growHorizontal",
73
90
  }).start();
74
- const downloadFileName = downloadUrl.split("/").pop();
75
- if (!downloadFileName) {
76
- throw new ReferenceError(`Could not find download file name for: [${downloadUrl}], could it be a malformed link?`);
91
+ // Process all downloads sequentially
92
+ for (const [index, selection] of selections.entries()) {
93
+ masterSpinner.text = `Downloading ${selection.label} (${index + 1}/${totalDownloads})...`;
94
+ try {
95
+ const downloadFileName = selection.downloadUrl.split("/").pop();
96
+ if (!downloadFileName) {
97
+ throw new ReferenceError(`Could not find download file name for: [${selection.downloadUrl}], could it be a malformed link?`);
98
+ }
99
+ // Download directly to current working directory
100
+ await (0, file_downloader_service_1.downloadFile)(selection.downloadUrl, {
101
+ destination: downloadFileName,
102
+ });
103
+ completedDownloads++;
104
+ masterSpinner.text = `Downloaded ${completedDownloads}/${totalDownloads} files...`;
105
+ }
106
+ catch (error) {
107
+ failedDownloads++;
108
+ failedFiles.push(selection.label);
109
+ masterSpinner.text = `Error downloading ${selection.label} (${completedDownloads} successful, ${failedDownloads} failed)`;
110
+ console.error(`\nFailed to download ${selection.label}:`, error instanceof Error ? error.message : String(error));
111
+ }
112
+ }
113
+ // Final summary - only show once at the end
114
+ masterSpinner.stop();
115
+ if (failedDownloads === 0) {
116
+ console.log(`✅ Download complete! All ${completedDownloads} file${completedDownloads !== 1 ? 's' : ''} downloaded successfully.`);
117
+ }
118
+ else {
119
+ console.log(`⚠️ Download partially complete: ${completedDownloads} successful, ${failedDownloads} failed.`);
120
+ if (failedFiles.length > 0) {
121
+ console.log("\nFailed files:");
122
+ failedFiles.forEach(file => console.log(` - ${file}`));
123
+ }
77
124
  }
78
- // Download directly to current working directory
79
- (0, file_downloader_service_1.downloadFile)(downloadUrl, {
80
- destination: downloadFileName,
81
- onStart: () => downloadSpinner.start(),
82
- onFinish: () => downloadSpinner.stop(),
83
- });
84
125
  }
85
126
  })();
86
127
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -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AAC;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -13,7 +13,6 @@ const downloadFile = (url, config) => {
13
13
  file.on("finish", () => {
14
14
  file.close();
15
15
  config.onFinish?.();
16
- console.log("Download Completed");
17
16
  });
18
17
  });
19
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"file-downloader.service.js","sourceRoot":"","sources":["../../src/service/file-downloader.service.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,yBAAyB;AAElB,MAAM,YAAY,GAAG,CAC1B,GAAW,EACX,MAIC,EACD,EAAE;IACF,MAAM,IAAI,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,QAAQ;QAC/B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACnB,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAvBW,QAAA,YAAY,gBAuBvB"}
1
+ {"version":3,"file":"file-downloader.service.js","sourceRoot":"","sources":["../../src/service/file-downloader.service.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,yBAAyB;AAElB,MAAM,YAAY,GAAG,CAC1B,GAAW,EACX,MAIC,EACD,EAAE;IACF,MAAM,IAAI,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,QAAQ;QAC/B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACnB,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrB,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAtBW,QAAA,YAAY,gBAsBvB"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /**
3
+ * Utility functions for handling sound selections
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseSelections = parseSelections;
7
+ exports.getSelectionMessage = getSelectionMessage;
8
+ exports.isMultipleSelection = isMultipleSelection;
9
+ exports.getFirstSelection = getFirstSelection;
10
+ /**
11
+ * Parse selections from the checkbox format into structured objects
12
+ * @param selections Array of strings in format "label||downloadUrl"
13
+ * @returns Array of SoundSelection objects
14
+ * @throws Error if any selection is malformed
15
+ */
16
+ function parseSelections(selections) {
17
+ if (selections.length === 0) {
18
+ throw new Error("No sounds selected. Please select at least one sound.");
19
+ }
20
+ return selections.map((selection, index) => {
21
+ const parts = selection.split("||");
22
+ if (parts.length < 2 || !parts[1]) {
23
+ throw new Error(`Invalid selection format at index ${index}: ${selection}`);
24
+ }
25
+ const label = parts[0] || `Unknown sound ${index + 1}`;
26
+ return {
27
+ label: label,
28
+ downloadUrl: parts[1]
29
+ };
30
+ });
31
+ }
32
+ /**
33
+ * Get a safe message for the selection prompt
34
+ * @param selections Parsed selections
35
+ * @returns Appropriate message string
36
+ */
37
+ function getSelectionMessage(selections) {
38
+ if (selections.length === 0) {
39
+ return "Selected: Unknown";
40
+ }
41
+ const firstSelection = selections[0];
42
+ if (selections.length === 1 && firstSelection) {
43
+ return `Selected: ${firstSelection.label}`;
44
+ }
45
+ else {
46
+ return `Selected ${selections.length} sounds`;
47
+ }
48
+ }
49
+ /**
50
+ * Determine if multiple sounds are selected
51
+ * @param selections Parsed selections
52
+ * @returns true if multiple selections, false otherwise
53
+ */
54
+ function isMultipleSelection(selections) {
55
+ return selections.length > 1;
56
+ }
57
+ /**
58
+ * Safely get the first selection
59
+ * @param selections Parsed selections
60
+ * @returns First selection or undefined if empty
61
+ */
62
+ function getFirstSelection(selections) {
63
+ return selections[0];
64
+ }
65
+ //# sourceMappingURL=selection-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-utils.js","sourceRoot":"","sources":["../../src/utils/selection-utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAaH,0CAmBC;AAOD,kDAUC;AAOD,kDAEC;AAOD,8CAEC;AA5DD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,UAAoB;IAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEpC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,KAAK,SAAS,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,iBAAiB,KAAK,GAAG,CAAC,EAAE,CAAC;QAEvD,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,UAA4B;IAC9D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IACD,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACrC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,EAAE,CAAC;QAC9C,OAAO,aAAa,cAAc,CAAC,KAAK,EAAE,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,UAAU,CAAC,MAAM,SAAS,CAAC;IAChD,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,UAA4B;IAC9D,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,UAA4B;IAC5D,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleproser/soundboard-downloader-cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Easily download sounds from myinstants.com using this interactive CLI tool",
5
5
  "license": "MIT",
6
6
  "publishConfig": {