Skip to content

✨ feat: 优化批量下载#606

Merged
imsyy merged 5 commits into
devfrom
dev-dl
Dec 2, 2025
Merged

✨ feat: 优化批量下载#606
imsyy merged 5 commits into
devfrom
dev-dl

Conversation

@kazukokawagawa
Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @kazukokawagawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the user experience and robustness of the application's download features. It introduces a visual progress indicator for batch downloads, adds an option to prevent re-downloading existing files, and provides an alternative download mechanism to address potential issues. Additionally, it refines metadata handling during downloads and expands lyric download customization options.

Highlights

  • Enhanced Download Logic: The core download functionality has been significantly updated to provide more detailed status (success, skipped, error) and includes a new option to skip downloading files that already exist locally. It also introduces a mechanism to clear existing ID3 tags before writing new metadata, preventing potential data corruption.
  • Batch Download Progress UI: A new, dedicated notification UI has been implemented for batch downloads, providing real-time progress updates including the current song being downloaded, overall percentage, transferred size, and success count. This replaces the previous message-based progress indicator.
  • Alternative Download Method: A new setting, 'Simulate Playback Download,' has been added. When enabled, the application will use the playback API (songUrl) for downloads instead of the direct download API (songDownloadUrl), which may resolve certain download issues.
  • Improved Batch Download Feedback: The batch download completion dialog now provides a more detailed list of failed songs, and a notification is displayed when a file is skipped because it already exists.
  • New Settings for Lyrics: New settings have been introduced to control the downloading of lyric translations and romaji lyrics.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kazukokawagawa kazukokawagawa changed the title Dev dl ✨ feat: 优化批量下载 Dec 2, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a significant new feature for batch downloading songs, including a UI for progress tracking and an option to use an alternative download method. It also adds the ability to skip downloading files that already exist. The changes span both the Electron main process for file handling and the Vue frontend components.

My review identifies a few areas for improvement. I've suggested a performance optimization in the file metadata handling to reduce I/O operations. I also found a UI bug in the new download notification where it disappears on hover, which I've recommended fixing. Finally, I've pointed out a potential runtime error related to a suppressed TypeScript warning that could cause downloads to fail for certain quality levels.

Comment on lines +589 to +593
&.is-hovered {
opacity: 0;
transform: translateY(10px);
pointer-events: none;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The .is-hovered style on the batch download notification causes it to become invisible and non-interactive when the user hovers over it. This is counter-intuitive and likely a bug. Users typically expect to be able to interact with notifications, or at least not have them disappear on hover. I recommend removing this style block.

Comment thread src/utils/download.ts Outdated
return { success: false, message: result.message || "获取下载链接失败" };
if (settingStore.usePlaybackForDownload) {
const levelName = songLevelData[quality].level;
// @ts-ignore
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The use of // @ts-ignore here hides a potential runtime error. The level parameter of songUrl has a specific set of allowed values, but songLevelData contains a level (dolby) that is not in this set. If a user tries to download a song with 'dolby' quality using the playback method, it will likely fail.

Instead of ignoring the TypeScript error, you should handle this case. A robust solution would be to add a runtime check to ensure levelName is valid before calling songUrl, and handle the invalid case gracefully (e.g., by showing an error message or falling back to another download method).

Comment on lines +440 to +447
let songFile = File.createFromPath(songDownload.getSavePath());
// 清除原有标签,防止脏数据(如模拟播放下载时的乱码歌词)
songFile.removeTags(TagTypes.AllTags);
songFile.save();
songFile.dispose();

// 重新读取文件以写入新标签
songFile = File.createFromPath(songDownload.getSavePath());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation for clearing and writing metadata involves saving and re-reading the file, which results in unnecessary I/O operations. You can remove the existing tags and set the new ones on the same File object before saving it once. This will be more efficient.

Suggested change
let songFile = File.createFromPath(songDownload.getSavePath());
// 清除原有标签,防止脏数据(如模拟播放下载时的乱码歌词)
songFile.removeTags(TagTypes.AllTags);
songFile.save();
songFile.dispose();
// 重新读取文件以写入新标签
songFile = File.createFromPath(songDownload.getSavePath());
const songFile = File.createFromPath(songDownload.getSavePath());
// 清除原有标签,防止脏数据(如模拟播放下载时的乱码歌词)
songFile.removeTags(TagTypes.AllTags);

@imsyy imsyy merged commit f55fbb8 into dev Dec 2, 2025
3 checks passed
@imsyy imsyy deleted the dev-dl branch December 3, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants