riot-clojure
This is a simple tool for using Riot Games public API. Those APIs are HUGE and provide a lot of information, but this tool is focused in the time data of matches.
The objetive of this tool is extract the playing time of one player. Taking the starting and ending timestamps we can create a chronogram with the time spent playing.
This simple program needs two API keys: one for LOL and another one for TFT. You can obtain a developer key from https://developer.riotgames.com/. Developer keys are valid for 24 hours only, but you can refresh the key easily from the developer's web site.
By default, the application searchs for the API key in the environment variables
LOL_API and TFT_API. If you prefer to provide the key via parameter, you must use --lol-api-key or
--tft-api-key parameters.
Features
Those features are implemented in v1.1
- Call the API with development or production keys
- Get a list of matches
- Get matches between two dates
- Check if player is currently playing
- Show the match's data in several formats:
- Fancy ASCII table (by default)
- Simple ASCII table
- Clojure native EDN format
- JSON
- CSV
- Select data fields to show
- Format dates and durations
- Show the result of the match (win/loss)
- Bulk request for hundred of matches
- Generate native executables
Goals
Goals for version 1.1:
- Simplify CLI options and parameters
- Calculate simple statistics: win/loss rate, hours played every day, etc.
- Get more data and delete some unused fields
- Clean and refactor some code
- Logging
- Get only LOL or TFT data
- Use Gitea Actions
Goals of the project, ordered from easiest to hardest:
- Take API key from environment
- Call the API to get basic player data
- Make the call to the API flexible
- Obtain list of past matches
- Obtain list of current matches
- Process app parameters
- By default, search for player's name and tag
- Take API key from parameter
- Use PUUID instead of name and tag
- Output as simple EDN data with timestamps
- Output as simple EDN data with local datetimes
- Output as JSON with timestamps
- Output as JSON with local datetimes
- Output as ASCII table with localdatetimes
- By default, output timestamps and local datetimes, and provide parameters to select the output data.
- Only checks if it's playing just now
- Win / Loss match
- Distribution as uberjar
- Distribution as native Linux executable
- Unit tests: move "comment" manual tests to real unit tests
- Output as a graphical chronogram or calendar.
- Simple web server
- Universal player search
- Simple API to get JSON data
- Simple endpoint to tell if it's playing just now
Installation
Download release from https://git.rcorral.es/ruben/riot-clojure/releases.
Usage
Using the Java uberjar
$ java -jar riot-clojure-0.1.0-standalone.jar [args]
Using the linux native image: $ ./riot [args]
Both are equivalent. In the examples we will use the native image, because is shorter.
Options
Run the application without params or wich -? param to show all options:
$ ./riot -?
Examples
Show all matches from a march the 1st (in ISO format):
$ ./riot t <username> <tag> -s "2025-03-01"
Get te same data in CSV and store it in a file:
$ ./riot t <username> <tag> -s "2025-03-01" -o csv > results.csv
Don't format durations, show them in seconds
$ ./riot t <username> <tag> -s "2025-03-01" --no-format-durations
License
MIT License
Copyright (c) 2025 ruben
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.