bilisum 1.13.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 +11 -0
- package/bin/bilisum.js +111 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# BiliSum
|
|
2
|
+
|
|
3
|
+
`bilisum` is the npx helper for BiliSum, an AI video summarizer and knowledge-base tool for Bilibili, YouTube, and local videos.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx bilisum
|
|
7
|
+
npx bilisum release
|
|
8
|
+
npx bilisum docker
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The desktop app is distributed through GitHub Releases. The npx package stays small and points users to the latest release or Docker quick start.
|
package/bin/bilisum.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync, spawn } = require("node:child_process");
|
|
4
|
+
const { existsSync, readFileSync } = require("node:fs");
|
|
5
|
+
const { join } = require("node:path");
|
|
6
|
+
|
|
7
|
+
const RELEASES_URL = "https://github.com/lycohana/BiliSum/releases/latest";
|
|
8
|
+
const REPO_URL = "https://github.com/lycohana/BiliSum";
|
|
9
|
+
const DOCKER_IMAGE = "lycohana/bilisum:latest";
|
|
10
|
+
|
|
11
|
+
function readVersion() {
|
|
12
|
+
const packagePath = join(__dirname, "..", "package.json");
|
|
13
|
+
if (!existsSync(packagePath)) {
|
|
14
|
+
return "unknown";
|
|
15
|
+
}
|
|
16
|
+
return JSON.parse(readFileSync(packagePath, "utf8")).version || "unknown";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function printHelp() {
|
|
20
|
+
const version = readVersion();
|
|
21
|
+
console.log(`BiliSum ${version}`);
|
|
22
|
+
console.log("");
|
|
23
|
+
console.log("AI 视频总结与知识库工具,深度优化 B 站体验,同时支持 YouTube 和本地视频。");
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log("Usage:");
|
|
26
|
+
console.log(" npx bilisum Show this help");
|
|
27
|
+
console.log(" npx bilisum --version Print package version");
|
|
28
|
+
console.log(" npx bilisum release Open the latest GitHub release");
|
|
29
|
+
console.log(" npx bilisum docker Print a Docker quick-start command");
|
|
30
|
+
console.log("");
|
|
31
|
+
console.log(`Latest release: ${RELEASES_URL}`);
|
|
32
|
+
console.log(`Repository: ${REPO_URL}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function printDockerCommand() {
|
|
36
|
+
console.log("Docker quick start:");
|
|
37
|
+
console.log("");
|
|
38
|
+
console.log(`docker run --rm -it -p 3838:3838 -v bilisum-data:/data ${DOCKER_IMAGE}`);
|
|
39
|
+
console.log("");
|
|
40
|
+
console.log("Then open http://127.0.0.1:3838");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function openUrl(url) {
|
|
44
|
+
const platform = process.platform;
|
|
45
|
+
const command = platform === "win32" ? "cmd" : platform === "darwin" ? "open" : "xdg-open";
|
|
46
|
+
const args = platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const child = spawn(command, args, {
|
|
50
|
+
detached: true,
|
|
51
|
+
stdio: "ignore",
|
|
52
|
+
windowsHide: true,
|
|
53
|
+
});
|
|
54
|
+
child.on("error", () => {
|
|
55
|
+
console.log(url);
|
|
56
|
+
});
|
|
57
|
+
child.unref();
|
|
58
|
+
console.log(`Opened ${url}`);
|
|
59
|
+
} catch {
|
|
60
|
+
console.log(url);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isDockerAvailable() {
|
|
65
|
+
try {
|
|
66
|
+
execFileSync("docker", ["--version"], { stdio: "ignore" });
|
|
67
|
+
return true;
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function main() {
|
|
74
|
+
const [command] = process.argv.slice(2);
|
|
75
|
+
|
|
76
|
+
if (!command || command === "help" || command === "-h" || command === "--help") {
|
|
77
|
+
printHelp();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (command === "version" || command === "-v" || command === "--version") {
|
|
82
|
+
console.log(readVersion());
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (command === "release" || command === "releases" || command === "download") {
|
|
87
|
+
openUrl(RELEASES_URL);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (command === "repo" || command === "github") {
|
|
92
|
+
openUrl(REPO_URL);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (command === "docker") {
|
|
97
|
+
printDockerCommand();
|
|
98
|
+
if (!isDockerAvailable()) {
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log("Docker was not detected on this machine.");
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.error(`Unknown command: ${command}`);
|
|
106
|
+
console.error("");
|
|
107
|
+
printHelp();
|
|
108
|
+
process.exitCode = 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bilisum",
|
|
3
|
+
"version": "1.13.1",
|
|
4
|
+
"description": "BiliSum npx launcher for release downloads and Docker usage.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"bilisum": "bin/bilisum.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/lycohana/BiliSum.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/lycohana/BiliSum/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/lycohana/BiliSum#readme",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"bilisum",
|
|
25
|
+
"bilibili",
|
|
26
|
+
"video-summary",
|
|
27
|
+
"ai-summary",
|
|
28
|
+
"rag",
|
|
29
|
+
"knowledge-base"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|