Force the drops_enabled flag to True
This commit is contained in:
1 parent
64c1b93b5b
commit
7b95818add
2 files changed
+27
-26
No files matched your search
+1
-1
@@ -37,7 +37,7 @@ class Stream:
|
|||||||
self.channel: Channel = channel
|
self.channel: Channel = channel
|
||||||
self.broadcast_id = int(id)
|
self.broadcast_id = int(id)
|
||||||
self.viewers: int = viewers
|
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.game: Game | None = Game(game) if game else None
|
||||||
self.title: str = title
|
self.title: str = title
|
||||||
self._stream_url: URLType | None = None
|
self._stream_url: URLType | None = None
|
||||||
|
|||||||
@@ -1584,29 +1584,29 @@ class Twitch:
|
|||||||
task.cancel()
|
task.cancel()
|
||||||
raise
|
raise
|
||||||
# for all channels with an active stream, check the available drops as well
|
# for all channels with an active stream, check the available drops as well
|
||||||
acl_available_drops_map: dict[int, list[JsonType]] = {}
|
# acl_available_drops_map: dict[int, list[JsonType]] = {}
|
||||||
available_gql_ops: list[GQLOperation] = [
|
# available_gql_ops: list[GQLOperation] = [
|
||||||
GQL_OPERATIONS["AvailableDrops"].with_variables({"channelID": str(channel_id)})
|
# GQL_OPERATIONS["AvailableDrops"].with_variables({"channelID": str(channel_id)})
|
||||||
for channel_id, channel_data in acl_streams_map.items()
|
# for channel_id, channel_data in acl_streams_map.items()
|
||||||
if channel_data["stream"] is not None # only do this for ONLINE channels
|
# if channel_data["stream"] is not None # only do this for ONLINE channels
|
||||||
]
|
# ]
|
||||||
available_gql_tasks: list[asyncio.Task[list[JsonType]]] = [
|
# available_gql_tasks: list[asyncio.Task[list[JsonType]]] = [
|
||||||
asyncio.create_task(self.gql_request(available_gql_chunk))
|
# asyncio.create_task(self.gql_request(available_gql_chunk))
|
||||||
for available_gql_chunk in chunk(available_gql_ops, 20)
|
# for available_gql_chunk in chunk(available_gql_ops, 20)
|
||||||
]
|
# ]
|
||||||
try:
|
# try:
|
||||||
for coro in asyncio.as_completed(available_gql_tasks):
|
# for coro in asyncio.as_completed(available_gql_tasks):
|
||||||
response_list = await coro
|
# response_list = await coro
|
||||||
for response_json in response_list:
|
# for response_json in response_list:
|
||||||
available_info: JsonType = response_json["data"]["channel"]
|
# available_info: JsonType = response_json["data"]["channel"]
|
||||||
acl_available_drops_map[int(available_info["id"])] = (
|
# acl_available_drops_map[int(available_info["id"])] = (
|
||||||
available_info["viewerDropCampaigns"] or []
|
# available_info["viewerDropCampaigns"] or []
|
||||||
)
|
# )
|
||||||
except Exception:
|
# except Exception:
|
||||||
# asyncio.as_completed doesn't cancel tasks on errors
|
# # asyncio.as_completed doesn't cancel tasks on errors
|
||||||
for task in available_gql_tasks:
|
# for task in available_gql_tasks:
|
||||||
task.cancel()
|
# task.cancel()
|
||||||
raise
|
# raise
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
channel_id = channel.id
|
channel_id = channel.id
|
||||||
if channel_id not in acl_streams_map:
|
if channel_id not in acl_streams_map:
|
||||||
@@ -1614,5 +1614,6 @@ class Twitch:
|
|||||||
channel_data = acl_streams_map[channel_id]
|
channel_data = acl_streams_map[channel_id]
|
||||||
if channel_data["stream"] is None:
|
if channel_data["stream"] is None:
|
||||||
continue
|
continue
|
||||||
available_drops: list[JsonType] = acl_available_drops_map[channel_id]
|
# available_drops: list[JsonType] = acl_available_drops_map[channel_id]
|
||||||
channel.external_update(channel_data, available_drops)
|
# channel.external_update(channel_data, available_drops)
|
||||||
|
channel.external_update(channel_data, [])
|
||||||
Reference in new issue
Block a user