Skip to content

Commit

Permalink
添加自动清空下载地址和文件名称的功能 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyiYo committed Feb 22, 2025
1 parent 3f51ddd commit ea1bc09
Show file tree
Hide file tree
Showing 8 changed files with 786 additions and 769 deletions.
10 changes: 4 additions & 6 deletions app/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ class Config(QConfig):
""" Config of application """

# download
saveFolder = ConfigItem("Download", "SaveFolder", QStandardPaths.writableLocation(
QStandardPaths.DownloadLocation), FolderValidator())
m3u8dlPath = ConfigItem("Download", "M3U8DLPath", str(Path(
f"tools/N_m3u8DL-RE{EXE_SUFFIX}").absolute()))
ffmpegPath = ConfigItem("Download", "FFmpegPath", str(Path(
f"tools/ffmpeg{EXE_SUFFIX}").absolute()))
saveFolder = ConfigItem("Download", "SaveFolder", QStandardPaths.writableLocation(QStandardPaths.DownloadLocation), FolderValidator())
m3u8dlPath = ConfigItem("Download", "M3U8DLPath", str(Path(f"tools/N_m3u8DL-RE{EXE_SUFFIX}").absolute()))
ffmpegPath = ConfigItem("Download", "FFmpegPath", str(Path(f"tools/ffmpeg{EXE_SUFFIX}").absolute()))
autoResetLink = ConfigItem("Download", "AutoResetLink", False, BoolValidator())

# main window
micaEnabled = ConfigItem("MainWindow", "MicaEnabled", isWin11(), BoolValidator())
Expand Down
1,212 changes: 609 additions & 603 deletions app/common/resource.py

Large diffs are not rendered by default.

Binary file modified app/resource/i18n/app.zh_CN.qm
Binary file not shown.
160 changes: 80 additions & 80 deletions app/resource/i18n/app.zh_CN.ts

Large diffs are not rendered by default.

Binary file modified app/resource/i18n/app.zh_HK.qm
Binary file not shown.
160 changes: 80 additions & 80 deletions app/resource/i18n/app.zh_HK.ts

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions app/view/home_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..components.config_card import BasicConfigCard, AdvanceConfigCard, ProxyConfigCard, LiveConfigCard, DecryptionConfigCard

from ..service.m3u8dl_service import m3u8Service
from ..common.config import cfg
from ..common.signal_bus import signalBus


Expand Down Expand Up @@ -107,6 +108,10 @@ def _onDownloadButtonClicked(self):
parent=self
)
button.clicked.connect(signalBus.switchToTaskInterfaceSig)

if cfg.get(cfg.autoResetLink):
self.basicSettingCard.urlLineEdit.clear()
self.basicSettingCard.fileNameLineEdit.clear()
else:
w = InfoBar.error(
self.tr("Task failed"),
Expand Down
8 changes: 8 additions & 0 deletions app/view/setting_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ def __init__(self, parent=None):
cfg.get(cfg.saveFolder),
self.downloadGroup
)
self.autoResetLinkCard = SwitchSettingCard(
FIF.CLEAR_SELECTION,
self.tr('Auto reset link'),
self.tr('The url and name of line edit will be cleared after download'),
configItem=cfg.autoResetLink,
parent=self.downloadGroup
)
self.m3u8dlPathCard = PushSettingCard(
self.tr("Choose"),
":/app/images/M3U8DL.png",
Expand Down Expand Up @@ -174,6 +181,7 @@ def __initLayout(self):
self.downloadGroup.addSettingCard(self.saveFolderCard)
self.downloadGroup.addSettingCard(self.m3u8dlPathCard)
self.downloadGroup.addSettingCard(self.ffmpegPathCard)
self.downloadGroup.addSettingCard(self.autoResetLinkCard)

self.updateSoftwareGroup.addSettingCard(self.updateOnStartUpCard)

Expand Down

0 comments on commit ea1bc09

Please sign in to comment.