/steam-playtime-log

Logs playtime of Steam games.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Steam playtime logger

Logs playtime of Steam games to a local text file and/or to a Google Sheets spreadsheet.

Background

The target application is VR arcades, where game developers want to know how much their game is being played.

Steam shows playtimes in the web interface, so you could scrape the data from the webpage. Here's the display on my very actiev Steam profile:

Steam playtime on record

We get this data directly by using the Steam API. You can see what output from the API looks like in steam_api_response.txt.

Usage

  1. Get a Steam API key at http://steamcommunity.com/dev/apikey and put it in steamid
  2. If you want to save logs to Google Sheets:
    1. Follow Google's Python Quickstart
    2. Save the various JSON files in this directory
    3. Create a new spreadsheet on Google Sheets and put the ID in spreadsheet_id
  3. Create a folder called out in this directory, or change path to change where files are written
  4. Find the appIDs of the games you want to log, and put them in appids_to_log
  5. Go here and comment or uncomment the functions to write the logs to a local text file or to Google Sheets
  6. Run log_playtime.py
  7. Results:
    • By default, the filenames of the local logs are formatted like [appID] gameName.txt, eg. [440] Team Fortress 2.txt. The contents are comma-seperated values, eg.
     "Date", "Time", "Playtime (minutes)"
     "2016-12-23", "22:16:18.869231", "525"
    
    • Google Sheets output is similar.