Skip to content

The only downloader you need. 下载器的集大成者。

refactor(config): 将数据存储路径从AppLocalDataLocation更改为GenericDataLocation

XiaoYouChRefc2c0cee236
diff --git a/Ghost-Downloader-3.py b/Ghost-Downloader-3.py
index b68453cf..3ab3f712 100644
--- a/Ghost-Downloader-3.py
+++ b/Ghost-Downloader-3.py
@@ -11,7 +11,7 @@ from app.supports.config import cfg
# import orjson
# sys.modules['json'] = orjson
-appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)
+appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)
qconfig.load(f"{appLocalDataLocation}/GhostDownloader/UserConfig.json", cfg)
if cfg.get(cfg.dpiScale) != 0:
diff --git a/app/supports/application.py b/app/supports/application.py
index ac29c2bc..1ea238b7 100644
--- a/app/supports/application.py
+++ b/app/supports/application.py
@@ -16,7 +16,7 @@ class SingletonApplication(QApplication):
super().__init__(argv)
self.key = key
- appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)
+ appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)
logger.add(f"{appLocalDataLocation}/GhostDownloader/GhostDownloader.log", rotation="512 KB", enqueue=True)
logger.info(
f"Ghost Downloader v{VERSION} is Launched at {strftime('%Y-%m-%d %H:%M:%S', localtime(time()))}")
diff --git a/app/supports/recorder.py b/app/supports/recorder.py
index 131dad82..e56b767d 100644
--- a/app/supports/recorder.py
+++ b/app/supports/recorder.py
@@ -10,7 +10,7 @@ from app.bases.models import Task
class TaskRecorder:
def __init__(self):
- appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)
+ appLocalDataLocation = QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)
recordFile = Path(f"{appLocalDataLocation}/GhostDownloader/Memory.log")
if not recordFile.exists():
recordFile.parent.mkdir(parents=True, exist_ok=True)
diff --git a/features/ffmpeg_pack/config.py b/features/ffmpeg_pack/config.py
index 0b1a4666..fd4034e8 100644
--- a/features/ffmpeg_pack/config.py
+++ b/features/ffmpeg_pack/config.py
@@ -108,7 +108,7 @@ class FFmpegInstallFolderCard(SettingCard):
self._updatePath(folder)
def _restoreDefault(self):
- self._updatePath(f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)}/GhostDownloader/FFmpeg")
+ self._updatePath(f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)}/GhostDownloader/FFmpeg")
class FFmpegRuntimeCard(SettingCard):
@@ -171,7 +171,7 @@ class FFmpegRuntimeCard(SettingCard):
class FFmpegConfig(PackConfig):
- installFolder = ConfigItem("FFmpeg", "InstallFolder", f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)}/GhostDownloader/FFmpeg", FolderValidator())
+ installFolder = ConfigItem("FFmpeg", "InstallFolder", f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)}/GhostDownloader/FFmpeg", FolderValidator())
def loadSettingCards(self, settingPage: "SettingPage"):
self.ffmpegGroup = SettingCardGroup(self.tr("FFmpeg"), settingPage.container)
diff --git a/features/m3u8_pack/config.py b/features/m3u8_pack/config.py
index c4cc5042..a36a1ac6 100644
--- a/features/m3u8_pack/config.py
+++ b/features/m3u8_pack/config.py
@@ -128,7 +128,7 @@ class M3U8InstallFolderCard(SettingCard):
self._updatePath(folder)
def _restoreDefault(self):
- defaultPath = f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)}/GhostDownloader/M3U8DL"
+ defaultPath = f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)}/GhostDownloader/M3U8DL"
self._updatePath(defaultPath)
@@ -195,7 +195,7 @@ class M3U8Config(PackConfig):
installFolder = ConfigItem(
"M3U8",
"InstallFolder",
- f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.AppLocalDataLocation)}/GhostDownloader/M3U8DL",
+ f"{QStandardPaths.writableLocation(QStandardPaths.StandardLocation.GenericDataLocation)}/GhostDownloader/M3U8DL",
FolderValidator(),
)
outputFormat = OptionsConfigItem("M3U8", "OutputFormat", "mp4", OptionsValidator(["mp4", "mkv"]))