This python script will show notifications of increasing online player count for multiplayer games hosted with the valve master server. This is useful for games with a low player count that have sporadic activity; you can be informed when and how many people are playing without leaving the game running or needing to check a website.
You will specifically need libnotify, python-valve, and psutil. The other modules that are used should come with a default python install:
sudo pacman -S libnotify (use your distro's package manager)
sudo pip install python-valve
sudo pip install psutil
Basic usage:
python valvePlayerQuery <gamedir> <minPlayers> <refreshRate> <retries>
<gamedir>
The ID string of the game, found by searching https://steamdb.info for the game, and looking under "Information"
<minPlayers>
Minimum player count before we display notification
<refreshRate>
Minutes before querying the master server again
<retries>
Number of times to retry connecting to the master server on timeout
Optionally you may place a small image called "<gamedir>.png" in the same location as the script. This image will appear on the notification, allowing you to easily identify different notifications for different games.
Demonstrating "daemonized" usage for Fistful of Frags where we are only alerted if the current player count exceeds 20, the player count is retrieved on a 10 minute cycle, and if our initial query fails we try again 3 times before waiting for the next cycle:
setsid python valvePlayerQuery.py fof 20 10 3 >/dev/null 2>&1
Everything besides the notification library is cross-platform. The notification lib could be replaced with pyQT to make it completely cross-platform, otherwise you'll have to settle for looking at the output in a terminal.
This repository is licensed under the MIT License