mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-09-07 00:27:46 +08:00
refactor: 移除一些前端用不到的command
This commit is contained in:
@@ -9,10 +9,7 @@ use crate::{
|
||||
extensions::AppHandleExt,
|
||||
logger,
|
||||
types::{
|
||||
bangumi_info::{BangumiInfo, EpInBangumi},
|
||||
bangumi_media_url::BangumiMediaUrl,
|
||||
cheese_info::CheeseInfo,
|
||||
cheese_media_url::CheeseMediaUrl,
|
||||
bangumi_info::EpInBangumi,
|
||||
create_download_task_params::CreateDownloadTaskParams,
|
||||
fav_folders::FavFolders,
|
||||
fav_info::FavInfo,
|
||||
@@ -22,8 +19,6 @@ use crate::{
|
||||
get_normal_info_params::GetNormalInfoParams,
|
||||
get_user_video_info_params::GetUserVideoInfoParams,
|
||||
normal_info::NormalInfo,
|
||||
normal_media_url::NormalMediaUrl,
|
||||
player_info::PlayerInfo,
|
||||
qrcode_data::QrcodeData,
|
||||
qrcode_status::QrcodeStatus,
|
||||
search_params::SearchParams,
|
||||
@@ -37,12 +32,6 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
@@ -143,34 +132,6 @@ pub async fn get_normal_info(
|
||||
Ok(normal_info)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_bangumi_info(
|
||||
app: AppHandle,
|
||||
params: GetBangumiInfoParams,
|
||||
) -> CommandResult<BangumiInfo> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let bangumi_info = bili_client
|
||||
.get_bangumi_info(params)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取番剧视频信息失败", err))?;
|
||||
Ok(bangumi_info)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_cheese_info(
|
||||
app: AppHandle,
|
||||
params: GetCheeseInfoParams,
|
||||
) -> CommandResult<CheeseInfo> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let cheese_info = bili_client
|
||||
.get_cheese_info(params)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取课程视频信息失败", err))?;
|
||||
Ok(cheese_info)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_user_video_info(
|
||||
@@ -185,54 +146,6 @@ pub async fn get_user_video_info(
|
||||
Ok(user_video_info)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_normal_url(
|
||||
app: AppHandle,
|
||||
bvid: String,
|
||||
cid: i64,
|
||||
) -> CommandResult<NormalMediaUrl> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let media_url = bili_client
|
||||
.get_normal_url(&bvid, cid)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取普通视频url失败", err))?;
|
||||
Ok(media_url)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_bangumi_url(app: AppHandle, cid: i64) -> CommandResult<BangumiMediaUrl> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let media_url = bili_client
|
||||
.get_bangumi_url(cid)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取番剧视频url失败", err))?;
|
||||
Ok(media_url)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_cheese_url(app: AppHandle, ep_id: i64) -> CommandResult<CheeseMediaUrl> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let media_url = bili_client
|
||||
.get_cheese_url(ep_id)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取课程视频url失败", err))?;
|
||||
Ok(media_url)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_player_info(app: AppHandle, aid: i64, cid: i64) -> CommandResult<PlayerInfo> {
|
||||
let bili_client = app.get_bili_client();
|
||||
let player_info = bili_client
|
||||
.get_player_info(aid, cid)
|
||||
.await
|
||||
.map_err(|err| CommandError::from("获取播放器信息失败", err))?;
|
||||
Ok(player_info)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[specta::specta]
|
||||
pub async fn get_fav_folders(app: AppHandle, uid: i64) -> CommandResult<FavFolders> {
|
||||
|
||||
@@ -34,20 +34,13 @@ fn generate_context() -> tauri::Context<Wry> {
|
||||
pub fn run() {
|
||||
let builder = tauri_specta::Builder::<Wry>::new()
|
||||
.commands(tauri_specta::collect_commands![
|
||||
greet,
|
||||
get_config,
|
||||
save_config,
|
||||
generate_qrcode,
|
||||
get_qrcode_status,
|
||||
get_user_info,
|
||||
get_normal_info,
|
||||
get_bangumi_info,
|
||||
get_cheese_info,
|
||||
get_user_video_info,
|
||||
get_normal_url,
|
||||
get_bangumi_url,
|
||||
get_cheese_url,
|
||||
get_player_info,
|
||||
get_fav_folders,
|
||||
get_fav_info,
|
||||
get_watch_later_info,
|
||||
|
||||
Reference in New Issue
Block a user