mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-26 07:08:04 +00:00
Force the drops_enabled flag to True
This commit is contained in:
@@ -37,7 +37,7 @@ class Stream:
|
||||
self.channel: Channel = channel
|
||||
self.broadcast_id = int(id)
|
||||
self.viewers: int = viewers
|
||||
self.drops_enabled: bool = False
|
||||
self.drops_enabled: bool = True
|
||||
self.game: Game | None = Game(game) if game else None
|
||||
self.title: str = title
|
||||
self._stream_url: URLType | None = None
|
||||
|
||||
51
twitch.py
51
twitch.py
@@ -1584,29 +1584,29 @@ class Twitch:
|
||||
task.cancel()
|
||||
raise
|
||||
# for all channels with an active stream, check the available drops as well
|
||||
acl_available_drops_map: dict[int, list[JsonType]] = {}
|
||||
available_gql_ops: list[GQLOperation] = [
|
||||
GQL_OPERATIONS["AvailableDrops"].with_variables({"channelID": str(channel_id)})
|
||||
for channel_id, channel_data in acl_streams_map.items()
|
||||
if channel_data["stream"] is not None # only do this for ONLINE channels
|
||||
]
|
||||
available_gql_tasks: list[asyncio.Task[list[JsonType]]] = [
|
||||
asyncio.create_task(self.gql_request(available_gql_chunk))
|
||||
for available_gql_chunk in chunk(available_gql_ops, 20)
|
||||
]
|
||||
try:
|
||||
for coro in asyncio.as_completed(available_gql_tasks):
|
||||
response_list = await coro
|
||||
for response_json in response_list:
|
||||
available_info: JsonType = response_json["data"]["channel"]
|
||||
acl_available_drops_map[int(available_info["id"])] = (
|
||||
available_info["viewerDropCampaigns"] or []
|
||||
)
|
||||
except Exception:
|
||||
# asyncio.as_completed doesn't cancel tasks on errors
|
||||
for task in available_gql_tasks:
|
||||
task.cancel()
|
||||
raise
|
||||
# acl_available_drops_map: dict[int, list[JsonType]] = {}
|
||||
# available_gql_ops: list[GQLOperation] = [
|
||||
# GQL_OPERATIONS["AvailableDrops"].with_variables({"channelID": str(channel_id)})
|
||||
# for channel_id, channel_data in acl_streams_map.items()
|
||||
# if channel_data["stream"] is not None # only do this for ONLINE channels
|
||||
# ]
|
||||
# available_gql_tasks: list[asyncio.Task[list[JsonType]]] = [
|
||||
# asyncio.create_task(self.gql_request(available_gql_chunk))
|
||||
# for available_gql_chunk in chunk(available_gql_ops, 20)
|
||||
# ]
|
||||
# try:
|
||||
# for coro in asyncio.as_completed(available_gql_tasks):
|
||||
# response_list = await coro
|
||||
# for response_json in response_list:
|
||||
# available_info: JsonType = response_json["data"]["channel"]
|
||||
# acl_available_drops_map[int(available_info["id"])] = (
|
||||
# available_info["viewerDropCampaigns"] or []
|
||||
# )
|
||||
# except Exception:
|
||||
# # asyncio.as_completed doesn't cancel tasks on errors
|
||||
# for task in available_gql_tasks:
|
||||
# task.cancel()
|
||||
# raise
|
||||
for channel in channels:
|
||||
channel_id = channel.id
|
||||
if channel_id not in acl_streams_map:
|
||||
@@ -1614,5 +1614,6 @@ class Twitch:
|
||||
channel_data = acl_streams_map[channel_id]
|
||||
if channel_data["stream"] is None:
|
||||
continue
|
||||
available_drops: list[JsonType] = acl_available_drops_map[channel_id]
|
||||
channel.external_update(channel_data, available_drops)
|
||||
# available_drops: list[JsonType] = acl_available_drops_map[channel_id]
|
||||
# channel.external_update(channel_data, available_drops)
|
||||
channel.external_update(channel_data, [])
|
||||
|
||||
Reference in New Issue
Block a user