diff --git a/src-tauri/src/downloader/download_progress.rs b/src-tauri/src/downloader/download_progress.rs index bdde9db..c6b6b3b 100644 --- a/src-tauri/src/downloader/download_progress.rs +++ b/src-tauri/src/downloader/download_progress.rs @@ -67,6 +67,7 @@ pub struct DownloadProgress { pub create_ts: u64, pub completed_ts: Option, pub is_drm: bool, + pub is_preview: bool, } impl DownloadProgress { @@ -140,6 +141,7 @@ impl DownloadProgress { create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; Ok(progress) @@ -188,6 +190,7 @@ impl DownloadProgress { create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; Ok(progress) @@ -336,6 +339,8 @@ impl DownloadProgress { .await .context("获取视频链接失败")?; + self.is_preview = !media_url.durl.is_empty() && media_url.dash.video.is_empty(); + if video_selected && !video_completed { // 如果视频被选中且未完成,则准备视频任务 self.video_task.prepare_normal(app, &media_url).await?; @@ -352,6 +357,8 @@ impl DownloadProgress { .await .context("获取番剧视频链接失败")?; + self.is_preview = media_url.is_preview != 0; + if video_selected && !video_completed { // 如果视频被选中且未完成,则准备视频任务 self.video_task.prepare_bangumi(app, &media_url).await?; @@ -372,6 +379,7 @@ impl DownloadProgress { .context("获取课程视频链接失败")?; self.is_drm = media_url.is_drm; + self.is_preview = media_url.is_preview != 0; if video_selected && !video_completed { // 如果视频被选中且未完成,则准备视频任务 @@ -522,6 +530,7 @@ fn create_normal_progresses_for_single( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; return Ok(vec![progress]); @@ -559,6 +568,7 @@ fn create_normal_progresses_for_single( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; return Ok(vec![progress]); @@ -596,6 +606,7 @@ fn create_normal_progresses_for_single( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; progresses.push(progress); @@ -665,6 +676,7 @@ fn create_normal_progresses_for_season( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; return Ok(vec![progress]); @@ -702,6 +714,7 @@ fn create_normal_progresses_for_season( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; return Ok(vec![progress]); @@ -740,6 +753,7 @@ fn create_normal_progresses_for_season( create_ts, completed_ts: None, is_drm: false, + is_preview: false, }; progresses.push(progress); diff --git a/src/bindings.ts b/src/bindings.ts index 8ea21e3..0db7058 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -284,7 +284,7 @@ export type Dimension = { width: number; height: number; rotate: number } export type DimensionInBangumi = { height: number; rotate: number; width: number } export type DimensionInWatchLater = { width: number; height: number; rotate: number } export type DownloadEvent = { event: "Speed"; data: { speed: string } } | { event: "TaskCreate"; data: { state: DownloadTaskState; progress: DownloadProgress } } | { event: "TaskStateUpdate"; data: { task_id: string; state: DownloadTaskState } } | { event: "TaskSleeping"; data: { task_id: string; remaining_sec: number } } | { event: "TaskDelete"; data: { task_id: string } } | { event: "ProgressPreparing"; data: { task_id: string } } | { event: "ProgressUpdate"; data: { progress: DownloadProgress } } -export type DownloadProgress = { task_id: string; episode_type: EpisodeType; aid: number; bvid: string | null; cid: number; ep_id: number | null; duration: number; pub_ts: number; collection_title: string; part_title: string | null; part_order: number | null; episode_title: string; episode_order: number; up_name: string | null; up_uid: number | null; up_avatar: string | null; episode_dir: string; filename: string; video_task: VideoTask; audio_task: AudioTask; video_process_task: VideoProcessTask; subtitle_task: SubtitleTask; danmaku_task: DanmakuTask; cover_task: CoverTask; nfo_task: NfoTask; json_task: JsonTask; create_ts: number; completed_ts: number | null; is_drm: boolean } +export type DownloadProgress = { task_id: string; episode_type: EpisodeType; aid: number; bvid: string | null; cid: number; ep_id: number | null; duration: number; pub_ts: number; collection_title: string; part_title: string | null; part_order: number | null; episode_title: string; episode_order: number; up_name: string | null; up_uid: number | null; up_avatar: string | null; episode_dir: string; filename: string; video_task: VideoTask; audio_task: AudioTask; video_process_task: VideoProcessTask; subtitle_task: SubtitleTask; danmaku_task: DanmakuTask; cover_task: CoverTask; nfo_task: NfoTask; json_task: JsonTask; create_ts: number; completed_ts: number | null; is_drm: boolean; is_preview: boolean } export type DownloadTaskState = "Pending" | "Downloading" | "Paused" | "Completed" | "Failed" export type Ed = { end: number; start: number } export type EpInBangumi = { aid: number; badge: string; badge_info: BadgeInfoInBangumi; badge_type: number | null; bvid: string | null; cid: number; cover: string; dimension: DimensionInBangumi | null; duration: number | null; enable_vt: boolean; ep_id: number; from: string | null; id: number; is_view_hide: boolean; link: string; link_type: string | null; long_title: string | null; pub_time: number; pv: number; release_date: string | null; rights: RightsInBangumiEp | null; section_type: number; share_copy: string | null; share_url: string | null; short_link: string | null; showDrmLoginDialog: boolean; show_title: string | null; skip: Skip | null; status: number; subtitle: string | null; title: string; vid: string | null; icon_font: IconFont | null } diff --git a/src/panes/DownloadPane/components/DownloadProgress.vue b/src/panes/DownloadPane/components/DownloadProgress.vue index 812c8da..068274d 100644 --- a/src/panes/DownloadPane/components/DownloadProgress.vue +++ b/src/panes/DownloadPane/components/DownloadProgress.vue @@ -161,11 +161,9 @@ function handleModifyClick() { :key="p.cover_task.url" alt="" draggable="false" /> -
- 🔒DRM +
+
🔒DRM
+
试看