Add a print for a watching message in the output window

This commit is contained in:
DevilXD committed 2022-12-15 11:36:46 +01:00
1 parent cb8d76b602
commit 751178c04c
7 files changed
+16 -18

No files matched your search

+1 -1
View File
@@ -1,6 +1,7 @@
{
"status": {
"terminated": "\nAnwendung gestoppt.\nFenster schließen, um die Anwendung zu beenden",
"watching": "{channel} wid zugesehen",
"goes_online": "{channel} ist ONLINE gegangen, wechseln...",
"goes_offline": "{channel} ist OFFLINE gegangen, wechseln...",
"claimed_drop": "Drop abgeholt: {drop}",
@@ -36,7 +37,6 @@
"idle": "Im Leerlauf",
"exiting": "Beenden...",
"terminated": "Abgebrochen",
"watching": "{channel} wid zugesehen",
"cleanup": "Kanäle aufräumen..",
"gathering": "Kanäle sammeln...",
"switching": "Wechsel des Kanals...",
+1 -1
View File
@@ -1,6 +1,7 @@
{
"status": {
"terminated": "\nLa aplicación se ha detenido.\nPor favor, cierre la aplicación.",
"watching": "Mirando el canal: {channel}",
"goes_online": "El canal {channel} se ha conectado, cambiando...",
"goes_offline": "El canal {channel} se ha desconectado, cambiando...",
"claimed_drop": "Drop reclamado: {drop}",
@@ -36,7 +37,6 @@
"idle": "En espera...",
"exiting": "Saliendo...",
"terminated": "Aplicación suspendida.",
"watching": "Mirando el canal {channel}",
"cleanup": "Limpiando canales...",
"gathering": "Buscando canales en vivo...",
"switching": "Cambiando de canal...",
+1 -1
View File
@@ -1,6 +1,7 @@
{
"status": {
"terminated": "\nAplicacao Finalizada.\nFeche a janela para sair do programa.",
"watching": "Assistindo o: {channel}",
"goes_online": "{channel} esta ONLINE, Mudando...",
"goes_offline": "{channel} ficou OFFLINE, Mudando...",
"claimed_drop": "Coletou o drop: {drop}",
@@ -36,7 +37,6 @@
"idle": "Em espera",
"exiting": "Saindo",
"terminated": "Finalizado",
"watching": "Assistindo o {channel}",
"cleanup": "Limpando os Canais...",
"gathering": "Coletando Canais...",
"switching": "Mudando o canal...",
+2 -2
View File
@@ -1,6 +1,7 @@
{
"status": {
"terminated": "\nAplikace byla ukončena.",
"watching": "Sledování kanálu: {channel}",
"goes_online": "Kanál {channel} je online, přepínám...",
"goes_offline": "Kanál {channel} je offline, přepínám na další...",
"claimed_drop": "Drop vyzvednut: {drop}",
@@ -26,13 +27,12 @@
"output": "Výstup",
"status": {
"name": "Status",
"idle": "Dokončeno načítání",
"idle": "Dokončeno načítání",
"exiting": "Ukončování...",
"terminated": "Aplikace ukončena",
"cleanup": "Čištění...",
"gathering": "Vyhledávání dostupného živého kanálu...",
"switching": "Přepínám mezi kanály...",
"watching": "Sledování kanálu {channel}",
"fetching_inventory": "Načítání inventáře...",
"fetching_campaigns": "Načítání dropů...",
"adding_campaigns": "Přidávám dropy... {counter}"
+1 -1
View File
@@ -1,6 +1,7 @@
{
"status": {
"terminated": "\n应用程序已终止,请关闭窗口以退出应用程序。",
"watching": "正在观看: {channel}",
"goes_online": "{channel} 该频道已上线, 正在切换...",
"goes_offline": "{channel} 该频道已离线, 正在切换...",
"claimed_drop": "领取的掉宝: {drop}",
@@ -39,7 +40,6 @@
"cleanup": "清除频道中...",
"gathering": "搜索直播频道...",
"switching": "切换直播频道中...",
"watching": "正在观看 {channel}",
"fetching_inventory": "获取库存中...",
"fetching_campaigns": "获取掉宝活动...",
"adding_campaigns": "将掉宝活动列表添加至库存... {counter}"
+2 -2
View File
@@ -13,6 +13,7 @@ if TYPE_CHECKING:
class StatusMessages(TypedDict):
terminated: str
watching: str
goes_online: str
goes_offline: str
claimed_drop: str
@@ -54,7 +55,6 @@ class GUIStatus(TypedDict):
cleanup: str
gathering: str
switching: str
watching: str
fetching_inventory: str
fetching_campaigns: str
adding_campaigns: str
@@ -216,6 +216,7 @@ class Translation(TypedDict):
default_translation: Translation = {
"status": {
"terminated": "\nApplication Terminated.\nClose the window to exit the application.",
"watching": "Watching: {channel}",
"goes_online": "{channel} goes ONLINE, switching...",
"goes_offline": "{channel} goes OFFLINE, switching...",
"claimed_drop": "Claimed drop: {drop}",
@@ -258,7 +259,6 @@ default_translation: Translation = {
"idle": "Idle",
"exiting": "Exiting...",
"terminated": "Terminated",
"watching": "Watching {channel}",
"cleanup": "Cleaning up channels...",
"gathering": "Gathering channels...",
"switching": "Switching the channel...",
+8 -10
View File
@@ -879,7 +879,7 @@ class Twitch:
if watching_channel is not None:
new_watching: Channel | None = channels.get(watching_channel.id)
if new_watching is not None and self.can_watch(new_watching):
self.watch(new_watching)
self.watch(new_watching, update_status=False)
else:
# we've removed a channel we were watching
self.stop_watching()
@@ -923,15 +923,12 @@ class Twitch:
if new_watching is not None:
# if we have a better switch target - do so
self.watch(new_watching)
self.gui.status.update(
_("gui", "status", "watching").format(channel=new_watching.name)
)
# break the state change chain by clearing the flag
self._state_change.clear()
elif watching_channel is not None:
# otherwise, continue watching what we had before
self.gui.status.update(
_("gui", "status", "watching").format(channel=watching_channel.name)
_("status", "watching").format(channel=watching_channel.name)
)
# break the state change chain by clearing the flag
self._state_change.clear()
@@ -1097,9 +1094,13 @@ class Twitch:
and channel.acl_based > watching_channel.acl_based
)
def watch(self, channel: Channel):
def watch(self, channel: Channel, *, update_status: bool = True):
self.gui.channels.set_watching(channel)
self.watching_channel.set(channel)
if update_status:
status_text = _("status", "watching").format(channel=channel.name)
self.print(status_text)
self.gui.status.update(status_text)
def stop_watching(self):
self.gui.clear_drop()
@@ -1179,11 +1180,8 @@ class Twitch:
self.can_watch(channel) # we can watch the channel
and self.should_switch(channel) # and we should!
):
self.watch(channel)
self.print(_("status", "goes_online").format(channel=channel.name))
self.gui.status.update(
_("gui", "status", "watching").format(channel=channel.name)
)
self.watch(channel)
else:
logger.info(f"{channel.name} goes ONLINE")
else: