feat(core): integrate mediago-core as new download type
Add mediago-core (caorushizi/mediago-core) as a fourth download type alongside m3u8, bilibili, and direct. This enables HLS/DASH streaming downloads using the custom Go-based downloader. Changes span the full integration path: dependency download config, Go Core backend (type, schema, CLI flag, binary map), binary resolution for Electron/Server, shared TypeScript types, i18n labels, UI dropdown, dev scripts, and Dockerfile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,4 +113,5 @@ CMD ["mediago-core", \
|
||||
"--m3u8-bin=/app/deps/N_m3u8DL-RE", \
|
||||
"--bilibili-bin=/app/deps/BBDown", \
|
||||
"--direct-bin=/app/deps/gopeed", \
|
||||
"--mediago-bin=/app/deps/mediago", \
|
||||
"--ffmpeg-bin=/app/deps/ffmpeg"]
|
||||
|
||||
@@ -59,6 +59,7 @@ type AppConfig struct {
|
||||
M3U8Bin string `json:"m3u8_bin"`
|
||||
BilibiliBin string `json:"bilibili_bin"`
|
||||
DirectBin string `json:"direct_bin"`
|
||||
MediagoBin string `json:"mediago_bin"`
|
||||
MaxRunner int `json:"max_runner"`
|
||||
LocalDir string `json:"local_dir"`
|
||||
DeleteSegments bool `json:"delete_segments"`
|
||||
@@ -337,6 +338,7 @@ func initConfig() *AppConfig {
|
||||
flag.StringVar(&cfg.M3U8Bin, "m3u8-bin", cfg.M3U8Bin, "M3U8 downloader binary path")
|
||||
flag.StringVar(&cfg.BilibiliBin, "bilibili-bin", cfg.BilibiliBin, "Bilibili downloader binary path")
|
||||
flag.StringVar(&cfg.DirectBin, "direct-bin", cfg.DirectBin, "Direct downloader binary path")
|
||||
flag.StringVar(&cfg.MediagoBin, "mediago-bin", cfg.MediagoBin, "MediaGo downloader binary path")
|
||||
flag.StringVar(&cfg.SchemaPath, "schema-path", cfg.SchemaPath, "Path to the download schema config.json")
|
||||
flag.StringVar(&cfg.Port, "port", cfg.Port, "Server port")
|
||||
flag.StringVar(&cfg.LocalDir, "local-dir", cfg.LocalDir, "Default download directory")
|
||||
@@ -390,6 +392,7 @@ func getBinaryMap(cfg *AppConfig) map[core.DownloadType]string {
|
||||
core.TypeM3U8: cfg.M3U8Bin,
|
||||
core.TypeBilibili: cfg.BilibiliBin,
|
||||
core.TypeDirect: cfg.DirectBin,
|
||||
core.TypeMediago: cfg.MediagoBin,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,25 @@ func DefaultSchemas() SchemaList {
|
||||
IsLive: "检测到直播流",
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: "mediago",
|
||||
Args: map[string]ArgSpec{
|
||||
"url": {ArgsName: []string{}},
|
||||
"localDir": {ArgsName: []string{"--save-dir", "--tmp-dir"}},
|
||||
"name": {ArgsName: []string{"--save-name"}},
|
||||
"headers": {ArgsName: []string{"--header"}},
|
||||
"deleteSegments": {ArgsName: []string{"--del-after-done"}},
|
||||
"proxy": {ArgsName: []string{"--proxy"}},
|
||||
"__common__": {ArgsName: []string{"--no-log", "--auto-select", "--thread-count", "8"}},
|
||||
},
|
||||
ConsoleReg: ConsoleReg{
|
||||
Percent: `([\d.]+)%`,
|
||||
Speed: `([\d.]+[GMK]Bps)`,
|
||||
Error: "ERROR",
|
||||
Start: "保存文件名:",
|
||||
IsLive: "检测到直播流",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ const (
|
||||
TypeM3U8 DownloadType = "m3u8"
|
||||
TypeBilibili DownloadType = "bilibili"
|
||||
TypeDirect DownloadType = "direct"
|
||||
TypeMediago DownloadType = "mediago"
|
||||
)
|
||||
|
||||
// TaskID is the unique identifier for a task
|
||||
|
||||
@@ -32,6 +32,7 @@ export const devConfig = {
|
||||
m3u8_bin: `${config.DEPS_DIR}/${platformKey}/N_m3u8DL-RE${exeExt}`,
|
||||
bilibili_bin: `${config.DEPS_DIR}/${platformKey}/BBDown${exeExt}`,
|
||||
direct_bin: `${config.DEPS_DIR}/${platformKey}/gopeed${exeExt}`,
|
||||
mediago_bin: `${config.DEPS_DIR}/${platformKey}/mediago${exeExt}`,
|
||||
ffmpeg_bin: `${config.DEPS_DIR}/${platformKey}/ffmpeg${exeExt}`,
|
||||
max_runner: 3,
|
||||
local_dir: `${homeDir}/downloads`,
|
||||
|
||||
@@ -26,6 +26,7 @@ export async function dev() {
|
||||
`-bilibili-bin=${devConfig.bilibili_bin}`,
|
||||
`-m3u8-bin=${devConfig.m3u8_bin}`,
|
||||
`-direct-bin=${devConfig.direct_bin}`,
|
||||
`-mediago-bin=${devConfig.mediago_bin}`,
|
||||
`-ffmpeg-bin=${devConfig.ffmpeg_bin}`,
|
||||
];
|
||||
await runCommand("go", args, { description: "Start development server" });
|
||||
|
||||
@@ -68,6 +68,7 @@ export class DownloaderServer extends EventEmitter {
|
||||
`-m3u8-bin=${deps.n_m3u8dl_re}`,
|
||||
`-bilibili-bin=${deps.bbdown}`,
|
||||
`-direct-bin=${deps.gopeed}`,
|
||||
`-mediago-bin=${deps.mediago}`,
|
||||
`-ffmpeg-bin=${deps.ffmpeg}`,
|
||||
`-db-path=${opts.dbPath}`,
|
||||
`-config-dir=${path.dirname(opts.dbPath)}`,
|
||||
|
||||
@@ -60,6 +60,7 @@ export function resolveDepsBinaries(): {
|
||||
n_m3u8dl_re: string;
|
||||
bbdown: string;
|
||||
gopeed: string;
|
||||
mediago: string;
|
||||
} {
|
||||
let binDir: string;
|
||||
|
||||
@@ -77,6 +78,7 @@ export function resolveDepsBinaries(): {
|
||||
n_m3u8dl_re: path.resolve(binDir, `N_m3u8DL-RE${ext}`),
|
||||
bbdown: path.resolve(binDir, `BBDown${ext}`),
|
||||
gopeed: path.resolve(binDir, `gopeed${ext}`),
|
||||
mediago: path.resolve(binDir, `mediago${ext}`),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ export function resolveDepsBinaries(): {
|
||||
n_m3u8dl_re: string;
|
||||
bbdown: string;
|
||||
gopeed: string;
|
||||
mediago: string;
|
||||
} {
|
||||
let binDir: string;
|
||||
|
||||
@@ -80,5 +81,6 @@ export function resolveDepsBinaries(): {
|
||||
n_m3u8dl_re: path.resolve(binDir, `N_m3u8DL-RE${ext}`),
|
||||
bbdown: path.resolve(binDir, `BBDown${ext}`),
|
||||
gopeed: path.resolve(binDir, `gopeed${ext}`),
|
||||
mediago: path.resolve(binDir, `mediago${ext}`),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ const runner = new ServiceRunner({
|
||||
`--m3u8-bin=${deps.n_m3u8dl_re}`,
|
||||
`--bilibili-bin=${deps.bbdown}`,
|
||||
`--direct-bin=${deps.gopeed}`,
|
||||
`--mediago-bin=${deps.mediago}`,
|
||||
`--db-path=${DB_PATH}`,
|
||||
`--config-dir=${DATA_DIR}`,
|
||||
],
|
||||
|
||||
@@ -317,6 +317,10 @@ export default forwardRef<DownloadFormRef, DownloadFormProps>(
|
||||
label: t("bilibiliMedia"),
|
||||
value: "bilibili",
|
||||
},
|
||||
{
|
||||
label: t("mediagoMedia"),
|
||||
value: "mediago",
|
||||
},
|
||||
{
|
||||
label: t("direct"),
|
||||
value: "direct",
|
||||
@@ -456,6 +460,7 @@ export default forwardRef<DownloadFormRef, DownloadFormProps>(
|
||||
{(formInstance) => {
|
||||
if (
|
||||
formInstance.getFieldValue("type") !== "m3u8" &&
|
||||
formInstance.getFieldValue("type") !== "mediago" &&
|
||||
!formInstance.getFieldValue("batch")
|
||||
) {
|
||||
return null;
|
||||
|
||||
@@ -15,6 +15,7 @@ export enum DownloadType {
|
||||
M3U8 = "m3u8",
|
||||
Bilibili = "bilibili",
|
||||
Direct = "direct",
|
||||
Mediago = "mediago",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,6 +160,7 @@ export const en = {
|
||||
pleaseEnterCorrectBatchList: "Please enter correct batch list",
|
||||
streamMedia: "Stream Media (m3u8)",
|
||||
bilibiliMedia: "Bilibili Media",
|
||||
mediagoMedia: "MediaGo Download",
|
||||
checkUpdate: "Check Update",
|
||||
allowBetaVersion: "Allow Beta Version",
|
||||
updateModal: "Update",
|
||||
|
||||
@@ -154,6 +154,7 @@ export const zh = {
|
||||
pleaseEnterCorrectBatchList: "请输入正确的批量列表",
|
||||
streamMedia: "流媒体(m3u8)",
|
||||
bilibiliMedia: "哔哩哔哩",
|
||||
mediagoMedia: "MediaGo 下载",
|
||||
checkUpdate: "检查更新",
|
||||
allowBetaVersion: "允许升级测试版本",
|
||||
updateModal: "更新",
|
||||
|
||||
@@ -67,6 +67,7 @@ export enum DownloadType {
|
||||
m3u8 = "m3u8",
|
||||
bilibili = "bilibili",
|
||||
direct = "direct",
|
||||
mediago = "mediago",
|
||||
}
|
||||
|
||||
export interface DownloadParams {
|
||||
|
||||
@@ -73,5 +73,25 @@
|
||||
"default": "gopeed",
|
||||
"win32": "gopeed.exe"
|
||||
}
|
||||
},
|
||||
"mediago": {
|
||||
"repo": "caorushizi/mediago-core",
|
||||
"version": "v0.1.0",
|
||||
"assets": {
|
||||
"darwin-x64": "mediago-v0.1.0-darwin-amd64.tar.gz",
|
||||
"darwin-arm64": "mediago-v0.1.0-darwin-arm64.tar.gz",
|
||||
"linux-x64": "mediago-v0.1.0-linux-amd64.tar.gz",
|
||||
"linux-arm64": "mediago-v0.1.0-linux-arm64.tar.gz",
|
||||
"win32-x64": "mediago-v0.1.0-windows-amd64.zip",
|
||||
"win32-arm64": "mediago-v0.1.0-windows-arm64.zip"
|
||||
},
|
||||
"binaryName": {
|
||||
"default": "mediago",
|
||||
"win32": "mediago.exe"
|
||||
},
|
||||
"extractBinary": {
|
||||
"default": "mediago",
|
||||
"win32": "mediago.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user