Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
btjawa committed Mar 25, 2024
1 parent f0c560e commit ce95a8e
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 36 deletions.
14 changes: 14 additions & 0 deletions UPDATE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Updater Log

## v1.1.2

包含逻辑/BUG更新,以及新功能
- 功能: 下载相关
- FLV 支持
- 历史弹幕/实时弹幕支持 XML+ASS 下载
- 持久化存储下载记录
- 修复: 下载相关
- 优化特殊字符检测
- 优化链接获取
- 优化下载处理逻辑
- 杂项更新: 修复
- 修复一系列BUG

## v1.1.1

包含BUG更新
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bilitools",
"version": "1.1.1",
"version": "1.1.2",
"description": "bilibili工具箱,视频/番剧+伴音/音乐下载,三种登录方式,仅用作学习用途。",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -43,4 +43,4 @@
"vite-plugin-compression": "^0.5.1",
"vite-plugin-dynamic-import": "^1.5.0"
}
}
}
41 changes: 35 additions & 6 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bilitools"
version = "1.1.1"
version = "1.1.2"
description = "BiliTools"
authors = ["btjawa"]
license = "MIT"
Expand Down Expand Up @@ -30,6 +30,7 @@ tokio = { version = "1", features = ["full"] }
rand = "0.8.5"
walkdir = "2.4.0"
flate2 = "1.0.28"
ctrlc = "3.4.4"

[features]
# this feature is used for production builds or when `devPath` points to the filesystem
Expand Down
7 changes: 3 additions & 4 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ async fn push_back_queue(
#[tauri::command]
async fn process_queue(window: tauri::Window, date: String) -> Result<(), String> {
log::info!("Processing queue...");
let mut waiting_len = { WAITING_QUEUE.lock().await.len() as i64 };
loop {
if waiting_len == 0 { break; }
let max_conc = *MAX_CONCURRENT_DOWNLOADS.read().await;
let doing_len = { DOING_QUEUE.lock().await.len() as i64 };
for _ in 0..max_conc.saturating_sub(doing_len) {
Expand All @@ -354,10 +356,7 @@ async fn process_queue(window: tauri::Window, date: String) -> Result<(), String
});
}
}
let waiting_empty = { WAITING_QUEUE.lock().await.is_empty() };
if waiting_empty && DOING_QUEUE.lock().await.is_empty() {
break;
}
waiting_len -= 1;
DOWNLOAD_COMPLETED_NOTIFY.notified().await;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"package": {
"productName": "BiliTools",
"version": "1.1.1"
"version": "1.1.2"
},
"tauri": {
"allowlist": {
Expand Down
50 changes: 28 additions & 22 deletions src/scripts/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,21 @@ async function getMediaInfo(rawId, type) {
tags = basicResp.result.styles;
} else if (type == "audio") {
info = basicResp.data;
loadingBox.addClass('active');
tags = JSON.parse((new TextDecoder()).decode(pako.inflate(new Uint8Array(
(await http.fetch(`https://www.bilibili.com/audio/music-service-c/web/tag/song?sid=${id.match(/\d+/)[0]}`, {
headers: tdata.headers, responseType: http.ResponseType.Binary
})).data)))).data.map(item => item.info);
loadingBox.removeClass('active');
}
handleMediaList({ info, tags }, type);
return basicResp;
} else {
if (basicResp.code == -404 && type == "bangumi") {
loadingBox.addClass('active');
basicUrl = `https://api.bilibili.com/pugv/view/web/season?${id.startsWith('ep') ? 'ep_id' : 'season_id'}=${id.match(/\d+/)[0]}`;
const lssnResp = (await http.fetch(basicUrl, { headers: tdata.headers })).data;
loadingBox.removeClass('active');
if (lssnResp.code === 0) {
handleMediaList({ info: lssnResp.data }, "lesson");
return lssnResp;
Expand Down Expand Up @@ -745,9 +749,11 @@ function appendMediaBlock(root, audio) { // 填充视频块
}
}
getCoverBtn.on('click', async () => {
loadingBox.addClass('active');
const content = (await http.fetch(root.pic.replace(/http/g, 'https'), {
headers: tdata.headers, responseType: http.ResponseType.Binary
})).data;
loadingBox.removeClass('active');
const sel = await saveFile({
filters: [{ name: 'JPG 文件', extensions: ['jpg'] }],
defaultPath: `封面_${format.filename(isV ? root.title : audio.desc)}.jpg`
Expand Down Expand Up @@ -1055,31 +1061,31 @@ async function userProfile() {
if (!userData.isLogin) { handleLogin(); return null; }
currentElm.push(".user-profile");
$('.user-profile').addClass('active');
loadingBox.addClass('active');
const detailData = await http.fetch(`https://api.bilibili.com/x/web-interface/card?mid=${userData.mid}&photo=true`,
{ headers: tdata.headers });
if (detailData.ok) {
const details = detailData.data;
$('.user-profile-img').attr("src", details.data.space.l_img.replace("http:", "https:") + '@200h');
$('.user-profile-avatar').attr("src", details.data.card.face + '@256h');
$('.user-profile-name').html(details.data.card.name);
$('.user-profile-desc').html(details.data.card.sign);
const level = details.data.card.level_info.current_level;
const senior = details.data.card.is_senior_member;
$('.user-profile-sex').attr("src", await import(`../assets/${details.data.card.sex == "男" ? "male" : "female"}.png`).default);
$('.user-profile-level').attr("src", await (await import(`../assets/level/level${level}${senior?"_hardcore":""}.svg`)).default);
if (details.data.card.vip) {
$('.user-profile-bigvip').css("display", "block");
$('.user-profile-bigvip').attr("src", details.data.card.vip.label.img_label_uri_hans_static);
}
$('.user-profile-coins').html('<a>硬币</a><br>' + userData.coins);
$('.user-profile-subs').html('<a>关注数</a><br>' + format.stat(details.data.card.friend));
$('.user-profile-fans').html('<a>粉丝数</a><br>' + format.stat(details.data.card.fans));
$('.user-profile-likes').html('<a>获赞数</a><br>' + format.stat(details.data.like_num));
$('.user-profile-exit').off('click').on('click', async () => {
loadingBox.addClass('active');
await invoke('exit').then(() => loadingBox.removeClass('active'));
});
loadingBox.removeClass('active');
const details = detailData.data;
$('.user-profile-img').attr("src", details.data.space.l_img.replace("http:", "https:") + '@200h');
$('.user-profile-avatar').attr("src", details.data.card.face + '@256h');
$('.user-profile-name').html(details.data.card.name);
$('.user-profile-desc').html(details.data.card.sign);
const level = details.data.card.level_info.current_level;
const senior = details.data.card.is_senior_member;
$('.user-profile-sex').attr("src", await import(`../assets/${details.data.card.sex == "男" ? "male" : "female"}.png`).default);
$('.user-profile-level').attr("src", await (await import(`../assets/level/level${level}${senior?"_hardcore":""}.svg`)).default);
if (details.data.card.vip) {
$('.user-profile-bigvip').css("display", "block");
$('.user-profile-bigvip').attr("src", details.data.card.vip.label.img_label_uri_hans_static);
}
$('.user-profile-coins').html('<a>硬币</a><br>' + userData.coins);
$('.user-profile-subs').html('<a>关注数</a><br>' + format.stat(details.data.card.friend));
$('.user-profile-fans').html('<a>粉丝数</a><br>' + format.stat(details.data.card.fans));
$('.user-profile-likes').html('<a>获赞数</a><br>' + format.stat(details.data.like_num));
$('.user-profile-exit').off('click').on('click', async () => {
loadingBox.addClass('active');
await invoke('exit').then(() => loadingBox.removeClass('active'));
});
}

async function scanLogin() {
Expand Down

0 comments on commit ce95a8e

Please sign in to comment.