Fix left click action on minecraft player count
This commit is contained in:
parent
3bd5496658
commit
2b7f89d69a
|
@ -202,13 +202,16 @@ in
|
||||||
pass
|
pass
|
||||||
print(result)
|
print(result)
|
||||||
'';
|
'';
|
||||||
click-left = "" + pkgs.writers.writePython3 "minecraft_status" { libraries = [ pkgs.python3.pkgs.mcstatus ]; flakeIgnore = [ "E722" ]; } ''
|
click-left = "" + pkgs.writers.writePython3 "minecraft_status" { libraries = with pkgs.python3.pkgs; [ mcstatus notify2 ]; flakeIgnore = [ "E722" ]; } ''
|
||||||
from mcstatus import MinecraftServer as JavaServer
|
from mcstatus import MinecraftServer as JavaServer
|
||||||
import os
|
import notify2
|
||||||
|
|
||||||
pvv = JavaServer.lookup("minecraft.pvv.ntnu.no")
|
pvv = JavaServer.lookup("minecraft.pvv.ntnu.no")
|
||||||
dods = JavaServer.lookup("mc.dodsorf.as")
|
dods = JavaServer.lookup("mc.dodsorf.as")
|
||||||
|
|
||||||
|
pvv_status = None
|
||||||
|
dods_status = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pvv_status = pvv.status()
|
pvv_status = pvv.status()
|
||||||
dods_status = dods.status()
|
dods_status = dods.status()
|
||||||
|
@ -216,15 +219,23 @@ in
|
||||||
pass
|
pass
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
if pvv_status.players.sample is not None:
|
if pvv_status is not None:
|
||||||
result += "PVV\n"
|
result += "PVV: "
|
||||||
for player in pvv_status.players.sample:
|
for player in pvv_status.players.sample:
|
||||||
result += player
|
result += player.name
|
||||||
os.exec("notify-send", "Minecraft Server Status", result)
|
result += "\n"
|
||||||
|
if dods_status is not None:
|
||||||
|
result += "DODS: "
|
||||||
|
for player in dods_status.players.sample:
|
||||||
|
result += player.name
|
||||||
|
result += "\n"
|
||||||
|
|
||||||
|
notify2.init('Minecraft Server Status')
|
||||||
|
n = notify2.Notification("Minecraft Server Status", result)
|
||||||
|
n.show()
|
||||||
'';
|
'';
|
||||||
interval = 10;
|
interval = 10;
|
||||||
format = " <label>";
|
format = " <label>";
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue