Implement idle argument
This commit is contained in:
1 parent
88d7ffa520
commit
2c6ee2939e
2 files changed
+9
-3
No files matched your search
@@ -20,6 +20,7 @@ class ParsedArgs(argparse.Namespace):
|
|||||||
_debug_ws: bool
|
_debug_ws: bool
|
||||||
_debug_gql: bool
|
_debug_gql: bool
|
||||||
log: bool
|
log: bool
|
||||||
|
idle: bool
|
||||||
tray: bool
|
tray: bool
|
||||||
debug: bool
|
debug: bool
|
||||||
game: Optional[str]
|
game: Optional[str]
|
||||||
@@ -66,6 +67,7 @@ parser.add_argument("--debug", dest="debug", action="store_true")
|
|||||||
parser.add_argument("--debug-ws", dest="_debug_ws", action="store_true")
|
parser.add_argument("--debug-ws", dest="_debug_ws", action="store_true")
|
||||||
parser.add_argument("--debug-gql", dest="_debug_gql", action="store_true")
|
parser.add_argument("--debug-gql", dest="_debug_gql", action="store_true")
|
||||||
parser.add_argument("-g", "--game", default=None)
|
parser.add_argument("-g", "--game", default=None)
|
||||||
|
parser.add_argument("--idle", action="store_true")
|
||||||
parser.add_argument("--tray", action="store_true")
|
parser.add_argument("--tray", action="store_true")
|
||||||
parser.add_argument("-l", "--log", action="store_true")
|
parser.add_argument("-l", "--log", action="store_true")
|
||||||
options: ParsedArgs = parser.parse_args(namespace=ParsedArgs())
|
options: ParsedArgs = parser.parse_args(namespace=ParsedArgs())
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class Twitch:
|
|||||||
def __init__(self, options: ParsedArgs):
|
def __init__(self, options: ParsedArgs):
|
||||||
self.options = options
|
self.options = options
|
||||||
# State management
|
# State management
|
||||||
self._state: State = State.INVENTORY_FETCH
|
self._state: State = State.IDLE
|
||||||
self._state_change = asyncio.Event()
|
self._state_change = asyncio.Event()
|
||||||
self.game: Optional[Game] = None
|
self.game: Optional[Game] = None
|
||||||
self.inventory: Dict[Game, List[DropsCampaign]] = {}
|
self.inventory: Dict[Game, List[DropsCampaign]] = {}
|
||||||
@@ -192,8 +192,6 @@ class Twitch:
|
|||||||
add_game = True
|
add_game = True
|
||||||
if add_game:
|
if add_game:
|
||||||
games.append(game)
|
games.append(game)
|
||||||
self.change_state(State.GAME_SELECT)
|
|
||||||
elif self._state is State.GAME_SELECT:
|
|
||||||
# 'games' has all games we can mine drops for
|
# 'games' has all games we can mine drops for
|
||||||
# if it's empty, there's no point in continuing
|
# if it's empty, there's no point in continuing
|
||||||
if not games:
|
if not games:
|
||||||
@@ -202,6 +200,12 @@ class Twitch:
|
|||||||
# only start the websocket after we confirm there are drops to mine
|
# only start the websocket after we confirm there are drops to mine
|
||||||
await self.websocket.start()
|
await self.websocket.start()
|
||||||
self.gui.games.set_games(games)
|
self.gui.games.set_games(games)
|
||||||
|
if self.options.idle:
|
||||||
|
self.options.idle = False
|
||||||
|
self.change_state(State.IDLE)
|
||||||
|
else:
|
||||||
|
self.change_state(State.GAME_SELECT)
|
||||||
|
elif self._state is State.GAME_SELECT:
|
||||||
self.game = self.gui.games.get_selection()
|
self.game = self.gui.games.get_selection()
|
||||||
# pre-display the active drop without a countdown
|
# pre-display the active drop without a countdown
|
||||||
active_drop = self.get_active_drop()
|
active_drop = self.get_active_drop()
|
||||||
|
|||||||
Reference in new issue
Block a user