1
0
Fork 0
mirror of synced 2024-07-03 13:40:47 +12:00
Rare/rare/utils/models.py

41 lines
1.1 KiB
Python
Raw Normal View History

2021-03-09 05:20:28 +13:00
import os
2021-06-20 02:22:30 +12:00
from dataclasses import field, dataclass
from multiprocessing import Queue
2021-03-09 05:20:28 +13:00
2021-08-17 08:50:31 +12:00
from custom_legendary.downloader.manager import DLManager
2021-08-18 02:05:00 +12:00
from custom_legendary.models.downloading import AnalysisResult, ConditionCheckResult
2021-08-17 08:50:31 +12:00
from custom_legendary.models.game import Game, InstalledGame
2021-03-09 05:20:28 +13:00
2021-08-18 01:09:46 +12:00
@dataclass
class InstallOptionsModel:
2021-06-20 02:22:30 +12:00
app_name: str
base_path: str = os.path.expanduser("~/legendary")
max_workers: int = os.cpu_count() * 2
repair: bool = False
no_install: bool = False
ignore_space_req: bool = False
force: bool = False
sdl_list: list[str] = field(default_factory=lambda: [''])
2021-06-20 02:22:30 +12:00
@dataclass
class InstallDownloadModel:
2021-06-20 02:22:30 +12:00
dlmanager: DLManager
analysis: AnalysisResult
game: Game
igame: InstalledGame
repair: bool
repair_file: str
2021-08-18 02:05:00 +12:00
res: ConditionCheckResult
2021-06-20 02:22:30 +12:00
@dataclass
class InstallQueueItemModel:
2021-06-20 02:22:30 +12:00
status_q: Queue = None
download: InstallDownloadModel = None
options: InstallOptionsModel = None
def __bool__(self):
return (self.status_q is not None) and (self.download is not None) and (self.options is not None)