From 94b404c57e838f3fa0fc366db1c6926e42ff2dbf Mon Sep 17 00:00:00 2001 From: XiaoMiku01 Date: Mon, 3 Feb 2025 19:03:44 +0800 Subject: [PATCH] =?UTF-8?q?Dev=20=E9=80=82=E9=85=8D=20biliup/biliup-rs#186?= =?UTF-8?q?=20=20=E6=B5=8B=E8=AF=95=E8=BE=B9=E5=BD=95=E8=BE=B9=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8A=9F=E8=83=BD=20(#1140)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix * 适配 biliup/biliup-rs#186 extra_fields * dev 边录边上传功能初版 * 修复下载器错误 * 实现同步编辑投稿功能 * 上传模板标题格式化 * fix * 默认分p大小2G * 重写了对列 * 修改输出队列机制 * 多线程上传有bug * 修复异常阻塞和多线程上传bug * reset * fix * 修复线程池异常 * 添加额外字段支持;增加同步下载器选项;去除无用日志;修复B站FLV流小概率无法获取;去掉B站弹幕重复登录态验证。 * 删除补0测戳 * 调整 ffmpeg header 参数位置 * 添加同步保存到本地的配置项 和 运行分段后自定义命令 * 添加缺失的投稿参数 * 添加边录边传保存目录项 * 格式化 * 修正 webup_sync 上传线路选择 * 修复 webup_sync 的 submit_web * 修正参数错误 * 删除多余代码 * 删除多余代码 --------- Co-authored-by: xxxxuanran --- app/lib/api-streamer.ts | 1 + app/ui/TemplateFields.tsx | 120 ++++- app/ui/plugins/global.tsx | 60 ++- app/upload-manager/add/page.tsx | 1 + app/upload-manager/edit/page.tsx | 1 + biliup/Danmaku/bilibili.py | 32 +- biliup/database/db.py | 4 +- biliup/database/models.py | 1 + biliup/engine/download.py | 95 +++- biliup/engine/sync_downloader.py | 249 +++++++++ biliup/plugins/bili_webup_sync.py | 810 ++++++++++++++++++++++++++++++ biliup/plugins/bilibili.py | 67 +-- biliup/plugins/biliuprs.py | 7 +- biliup/plugins/inke.py | 2 +- biliup/plugins/stream_gears.py | 8 +- biliup/web/__init__.py | 1 + 16 files changed, 1371 insertions(+), 88 deletions(-) create mode 100644 biliup/engine/sync_downloader.py create mode 100644 biliup/plugins/bili_webup_sync.py diff --git a/app/lib/api-streamer.ts b/app/lib/api-streamer.ts index ca695d1..305b2f0 100644 --- a/app/lib/api-streamer.ts +++ b/app/lib/api-streamer.ts @@ -88,6 +88,7 @@ export interface StudioEntity { open_elec: number; credits: Credit[]; uploader: string; + extra_fields?: string; } export interface LiveStreamerEntity { diff --git a/app/ui/TemplateFields.tsx b/app/ui/TemplateFields.tsx index 0b4282c..b7a5b47 100644 --- a/app/ui/TemplateFields.tsx +++ b/app/ui/TemplateFields.tsx @@ -1,4 +1,4 @@ -import React, { useState, useMemo, useEffect } from 'react' +import React, { useState, useMemo, useEffect, useCallback } from 'react' import { FormFCChild } from '@douyinfe/semi-ui/lib/es/form' import { IconChevronDown, @@ -18,6 +18,8 @@ import { Notification, ScrollList, ScrollItem, + // TextArea, + useFormState, } from '@douyinfe/semi-ui' import useSWR from 'swr' import { BiliType, fetcher, StudioEntity } from '../lib/api-streamer' @@ -181,7 +183,36 @@ const TemplateFields: React.FC> setSelectedMinutes(Math.floor(minutes / 5) * 5) } } - }, [formApi]) + }, [formApi]); + + // useEffect(() => { + // const extraFieldsList = formApi.getValue('extra_fields_list') as Array<{key: string; value: string}>; + // if (!extraFieldsList?.length) return; + + // const extraFieldsObj = extraFieldsList.reduce((tempObj: Record, item) => { + // if (item?.key && item?.value !== undefined) { + // tempObj[item.key] = !isNaN(Number(item.value)) ? Number(item.value) : item.value; + // } + // return tempObj; + // }, {}); + // formApi.setValue('extra_fields', JSON.stringify(extraFieldsObj)); + // }, []); + + // useEffect(() => { + // const extraFields = formApi.getValue('extra_fields'); + // if (extraFields) { + // try { + // const parsedFields = JSON.parse(extraFields); + // const fieldsList = Object.entries(parsedFields).map(([key, value]) => ({ + // key, + // value: String(value) + // })); + // formApi.setValue('extra_fields_list', fieldsList); + // } catch (e) { + // console.error('解析 extra_fields 失败:', e); + // } + // } + // }, []); return ( <> @@ -290,6 +321,91 @@ const TemplateFields: React.FC> maxCount={2000} showClear /> +