diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index b138ea1..0dbb424 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -1,5 +1,19 @@ # Updater Log +## v1.1.2 + +包含逻辑/BUG更新,以及新功能 +- 功能: 下载相关 + - FLV 支持 + - 历史弹幕/实时弹幕支持 XML+ASS 下载 + - 持久化存储下载记录 +- 修复: 下载相关 + - 优化特殊字符检测 + - 优化链接获取 + - 优化下载处理逻辑 +- 杂项更新: 修复 + - 修复一系列BUG + ## v1.1.1 包含BUG更新 diff --git a/package.json b/package.json index 98ef46b..7dc1841 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bilitools", - "version": "1.1.1", + "version": "1.1.2", "description": "bilibili工具箱,视频/番剧+伴音/音乐下载,三种登录方式,仅用作学习用途。", "type": "module", "scripts": { @@ -43,4 +43,4 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-dynamic-import": "^1.5.0" } -} +} \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 30ed1f8..2faf060 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -349,9 +349,10 @@ checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" [[package]] name = "bilitools" -version = "1.1.1" +version = "1.1.2" dependencies = [ "chrono", + "ctrlc", "flate2", "futures", "lazy_static", @@ -557,6 +558,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" version = "0.4.31" @@ -811,6 +818,16 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "ctrlc" +version = "3.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345" +dependencies = [ + "nix 0.28.0", + "windows-sys 0.52.0", +] + [[package]] name = "darling" version = "0.20.3" @@ -2531,6 +2548,18 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "nix" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -5647,7 +5676,7 @@ dependencies = [ "derive-new", "libc", "log", - "nix", + "nix 0.26.4", "os_pipe", "tempfile", "thiserror", @@ -5724,7 +5753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ "gethostname", - "nix", + "nix 0.26.4", "winapi", "winapi-wsapoll", "x11rb-protocol", @@ -5736,7 +5765,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" dependencies = [ - "nix", + "nix 0.26.4", ] [[package]] @@ -5756,7 +5785,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" dependencies = [ - "nix", + "nix 0.26.4", "winapi", ] @@ -5793,7 +5822,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "nix", + "nix 0.26.4", "once_cell", "ordered-stream", "rand 0.8.5", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 29e07d1..1624d6a 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bilitools" -version = "1.1.1" +version = "1.1.2" description = "BiliTools" authors = ["btjawa"] license = "MIT" @@ -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 diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index e1bb44f..62fcde9 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -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) { @@ -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(()) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 03185bc..1260dd6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -6,7 +6,7 @@ }, "package": { "productName": "BiliTools", - "version": "1.1.1" + "version": "1.1.2" }, "tauri": { "allowlist": { diff --git a/src/scripts/renderer.js b/src/scripts/renderer.js index 70520cd..1ddfb60 100644 --- a/src/scripts/renderer.js +++ b/src/scripts/renderer.js @@ -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; @@ -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` @@ -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('硬币
' + userData.coins); - $('.user-profile-subs').html('关注数
' + format.stat(details.data.card.friend)); - $('.user-profile-fans').html('粉丝数
' + format.stat(details.data.card.fans)); - $('.user-profile-likes').html('获赞数
' + 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('硬币
' + userData.coins); + $('.user-profile-subs').html('关注数
' + format.stat(details.data.card.friend)); + $('.user-profile-fans').html('粉丝数
' + format.stat(details.data.card.fans)); + $('.user-profile-likes').html('获赞数
' + 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() {