Remove the counter from the fetching campaigns step

This commit is contained in:
DevilXD committed 2022-11-22 09:02:20 +01:00
1 parent 0f538482c7
commit d308fad51c
5 files changed
+12 -18

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@
"gathering": "Kanäle sammeln...", "gathering": "Kanäle sammeln...",
"switching": "Wechsel des Kanals...", "switching": "Wechsel des Kanals...",
"fetching_inventory": "Lade Inventar...", "fetching_inventory": "Lade Inventar...",
"fetching_campaigns": "Lade Kampagnen... {counter}", "fetching_campaigns": "Lade Kampagnen...",
"adding_campaigns": "Kampagnen dem Inventar hinzufügen... {counter}" "adding_campaigns": "Kampagnen dem Inventar hinzufügen... {counter}"
}, },
"tabs": { "tabs": {
+1 -1
View File
@@ -34,7 +34,7 @@
"switching": "Přepínám mezi kanály...", "switching": "Přepínám mezi kanály...",
"watching": "Sledování kanálu {channel}", "watching": "Sledování kanálu {channel}",
"fetching_inventory": "Načítání inventáře...", "fetching_inventory": "Načítání inventáře...",
"fetching_campaigns": "Načítání dropů... {counter}", "fetching_campaigns": "Načítání dropů...",
"adding_campaigns": "Přidávám dropy... {counter}" "adding_campaigns": "Přidávám dropy... {counter}"
}, },
"tabs": { "tabs": {
+1 -1
View File
@@ -34,7 +34,7 @@
"switching": "切换直播频道中...", "switching": "切换直播频道中...",
"watching": "正在观看 {channel}", "watching": "正在观看 {channel}",
"fetching_inventory": "获取库存中...", "fetching_inventory": "获取库存中...",
"fetching_campaigns": "获取掉宝活动... {counter}", "fetching_campaigns": "获取掉宝活动...",
"adding_campaigns": "将掉宝活动列表添加至库存... {counter}" "adding_campaigns": "将掉宝活动列表添加至库存... {counter}"
}, },
"tabs": { "tabs": {
+2 -3
View File
@@ -242,7 +242,7 @@ default_translation: Translation = {
"gathering": "Gathering channels...", "gathering": "Gathering channels...",
"switching": "Switching the channel...", "switching": "Switching the channel...",
"fetching_inventory": "Fetching inventory...", "fetching_inventory": "Fetching inventory...",
"fetching_campaigns": "Fetching campaigns... {counter}", "fetching_campaigns": "Fetching campaigns...",
"adding_campaigns": "Adding campaigns to inventory... {counter}", "adding_campaigns": "Adding campaigns to inventory... {counter}",
}, },
"tabs": { "tabs": {
@@ -392,8 +392,7 @@ class Translator:
# if we're in dev, update the template English.json file # if we're in dev, update the template English.json file
if not IS_PACKAGED: if not IS_PACKAGED:
default_langpath = LANG_PATH.joinpath(f"{DEFAULT_LANG}.json") default_langpath = LANG_PATH.joinpath(f"{DEFAULT_LANG}.json")
if not default_langpath.exists(): json_save(default_langpath, default_translation)
json_save(default_langpath, default_translation)
self._translation["language_name"] = DEFAULT_LANG self._translation["language_name"] = DEFAULT_LANG
# load available translation names # load available translation names
for filepath in LANG_PATH.glob("*.json"): for filepath in LANG_PATH.glob("*.json"):
+7 -12
View File
@@ -1375,24 +1375,19 @@ class Twitch:
if c["status"] in applicable_statuses # that are currently not expired if c["status"] in applicable_statuses # that are currently not expired
} }
# fetch detailed data for each campaign, in chunks # fetch detailed data for each campaign, in chunks
for i, chunk_coro in enumerate( # specifically use an intermediate list per a Python bug
# specifically use an intermediate list per a Python bug # https://github.com/python/cpython/issues/88342
# https://github.com/python/cpython/issues/88342 status_update(_("gui", "status", "fetching_campaigns"))
asyncio.as_completed([ for chunk_coro in asyncio.as_completed(
[
self.fetch_campaigns(campaigns_chunk) self.fetch_campaigns(campaigns_chunk)
for campaigns_chunk in chunk(available_campaigns.items(), 20) for campaigns_chunk in chunk(available_campaigns.items(), 20)
]), ]
start=1,
): ):
status_update(
_("gui", "status", "fetching_campaigns").format(
counter=f"({i}/{len(available_campaigns)})"
)
)
chunk_campaigns_data = await chunk_coro chunk_campaigns_data = await chunk_coro
# merge the inventory and campaigns datas together # merge the inventory and campaigns datas together
inventory_data = self._merge_data(inventory_data, chunk_campaigns_data) inventory_data = self._merge_data(inventory_data, chunk_campaigns_data)
# # use it to create campaign objects # use the merged data to create campaign objects
campaigns: list[DropsCampaign] = [ campaigns: list[DropsCampaign] = [
DropsCampaign(self, campaign_data, claimed_benefits) DropsCampaign(self, campaign_data, claimed_benefits)
for campaign_data in inventory_data.values() for campaign_data in inventory_data.values()