Skip to content

Commit

Permalink
fix: resolve list error (#173)
Browse files Browse the repository at this point in the history
fix #172
  • Loading branch information
timerring authored Feb 18, 2025
1 parent 5e5efe7 commit d9a3890
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ pip install -r requirements.txt
在配置文件 `src/config.py` 中,`SLICE_DURATION` 以秒为单位设置切片时长(不建议超过 1 分钟),在项目的自动切片功能需要使用到智谱的 [`GLM-4V-PLUS`](https://bigmodel.cn/dev/api/normal-model/glm-4) 模型,请自行[注册账号](https://www.bigmodel.cn/invite?icode=shBtZUfNE6FfdMH1R6NybGczbXFgPRGIalpycrEwJ28%3D)并申请 API Key,填写到 `src/config.py` 文件中对应的 `Your_API_KEY` 中。

#### 4. biliup-rs 登录
#### 4. biliup & bilitool 登录

首先按照 [biliup-rs](https://github.com/biliup/biliup-rs) 登录b站,登录脚本在 `src/upload/biliup` ,登录产生的`cookies.json`保留在该文件夹下即可。

然后同样通过 `bilitool login` 扫码登录(biliup 的 list 对应 api 已经失效,因此我写了 [bilitool](https://github.com/timerring/bilitool) 工具作为替换)。

[常见问题收集](https://timerring.github.io/bilive/biliup.html)

#### 5. 启动自动录制
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tiktoken==0.4.0
torch==1.11.0
triton==3.1.0
zhconv==1.4.3
bilitool
zhipuai
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ============================ Your configuration ============================
GPU_EXIST=False
# Can be pipeline, append, merge
MODEL_TYPE = "pipeline"
MODEL_TYPE = "append"
Inference_Model = "small"
# ============================ The video slice configuration ==================
AUTO_SLICE = False
Expand Down
10 changes: 5 additions & 5 deletions src/upload/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def upload_video(upload_path, yaml_file_path):
def find_bv_number(target_str, my_list):
for element in my_list:
if target_str in element:
parts = element.split('\t')
parts = element.split('|')
if len(parts) > 0:
return parts[0]
return parts[1].strip()
return None

def read_append_and_delete_lines(file_path):
Expand Down Expand Up @@ -97,10 +97,10 @@ def read_append_and_delete_lines(file_path):
return
else:
query = generate_title(upload_video_path)
result = subprocess.check_output(f"{SRC_DIR}/upload/biliup" + " -u " + f"{SRC_DIR}/upload/cookies.json" + " list", shell=True)
result = subprocess.check_output("bilitool" + " list", shell=True)
# print(result.decode("utf-8"), flush=True)
upload_list = result.decode("utf-8").splitlines()
limit_list = upload_list[:30]
bv_result = find_bv_number(query, limit_list)
bv_result = find_bv_number(query, upload_list)
if bv_result:
print(f"BV number is: {bv_result}", flush=True)
append_upload(upload_video_path, bv_result)
Expand Down

0 comments on commit d9a3890

Please sign in to comment.