|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | import logging |
| 3 | +import platform |
3 | 4 | import sys |
4 | 5 |
|
5 | 6 | import coloredlogs |
|
13 | 14 | from fastflix.models.fastflix_app import FastFlixApp |
14 | 15 | from fastflix.program_downloads import ask_for_ffmpeg, grab_stable_ffmpeg |
15 | 16 | from fastflix.resources import main_icon, breeze_styles_path |
16 | | -from fastflix.shared import file_date, message, latest_fastflix, DEVMODE |
| 17 | +from fastflix.shared import file_date, message, latest_fastflix, DEVMODE, yes_no_message |
17 | 18 | from fastflix.widgets.container import Container |
18 | 19 | from fastflix.widgets.progress_bar import ProgressBar, Task |
| 20 | +from fastflix.gpu_detect import automatic_rigaya_download |
19 | 21 |
|
20 | 22 | logger = logging.getLogger("fastflix") |
21 | 23 |
|
@@ -169,6 +171,7 @@ def app_setup( |
169 | 171 | app.fastflix.config = Config() |
170 | 172 | init_fastflix_directories(app) |
171 | 173 | init_logging(app) |
| 174 | + logger.debug(f"GUI logging initialized, saving to {app.fastflix.log_path}") |
172 | 175 | upgraded = app.fastflix.config.upgrade_check() |
173 | 176 | if upgraded: |
174 | 177 | # No translation will be possible in this case |
@@ -215,6 +218,19 @@ def app_setup( |
215 | 218 |
|
216 | 219 | logger.setLevel(app.fastflix.config.logging_level) |
217 | 220 |
|
| 221 | + if platform.system() == "Windows": |
| 222 | + if app.fastflix.config.auto_gpu_check is None: |
| 223 | + app.fastflix.config.auto_gpu_check = yes_no_message( |
| 224 | + "Do you want FastFlix to automatically detect your GPUs and download the optional encoders for them?\n\nThis will include downloading 7zip on Windows platform.", |
| 225 | + title="Allow Optional Downloads", |
| 226 | + ) |
| 227 | + if app.fastflix.config.auto_gpu_check: |
| 228 | + ProgressBar( |
| 229 | + app, [Task(name=t("Detect GPUs"), command=automatic_rigaya_download)], signal_task=True, can_cancel=True |
| 230 | + ) |
| 231 | + |
| 232 | + app.fastflix.config.save() |
| 233 | + |
218 | 234 | startup_tasks = [ |
219 | 235 | Task(t("Gather FFmpeg version"), ffmpeg_configuration), |
220 | 236 | Task(t("Gather FFprobe version"), ffprobe_configuration), |
@@ -246,7 +262,6 @@ def start_app(worker_queue, status_queue, log_queue, queue_list, queue_lock, por |
246 | 262 | # import tracemalloc |
247 | 263 | # |
248 | 264 | # tracemalloc.start() |
249 | | - |
250 | 265 | app = app_setup( |
251 | 266 | enable_scaling=enable_scaling, |
252 | 267 | portable_mode=portable_mode, |
|
0 commit comments