Rene Luria c4d9236b16 feat: make config_section a global CLI option
Users can now specify --config-section once at the beginning of the command instead of repeating it for each subcommand. Also bumped version to v0.5.0 for this new feature.
2025-08-19 09:25:50 +02:00
2024-11-01 10:07:04 +01:00
2025-08-14 12:56:32 +02:00
2025-03-12 11:15:45 +01:00
2024-11-01 10:41:39 +01:00

myice

introduction

With this tool, you can fetch kids' schedules from MyIce and generate the PDFs you need.

install

with uv:

uv tool install --extra-index-url https://gitea.parano.ch/api/packages/herel/pypi/simple/ myice

with pipx:

pipx install --extra-index-url https://gitea.parano.ch/api/packages/herel/pypi/simple/ myice

configuration

Create a myice.ini file with your credentials:

[default]
username = your_email@example.com
password = your_password
userid = 12345
token = your_api_token
club_id = 172

You can also create multiple sections for different users:

[default]
username = user1@example.com
password = password1
userid = 12345
token = token1
club_id = 172

[second_kid]
username = charlie@example.com
password = password2
userid = 67890
token = token2
club_id = 186

Note: The userid, token, and club_id fields are optional. If you don't have them, the tool can fetch them automatically using the mobile-login command (see below).

To fetch the token and club_id using mobile-login:

myice mobile-login

This will output the necessary information that you can add to your myice.ini file.

web interface

The tool includes a web interface that can be accessed by running the web API server:

uv run fastapi run myice/webapi.py

Then open your browser at http://localhost:8000. The web interface allows you to:

  • Select between different configured accounts
  • View upcoming games and practices
  • See detailed information about events including player rosters

The web API provides the following endpoints:

  • /schedule - Get the schedule for a specific account
  • /game/{game_id} - Get details for a specific game
  • /accounts - Get a list of available accounts
  • /health - Health check endpoint

All endpoints (except /health) require an Authorization header with a Bearer token. For development purposes, you can use abc as the token.

mobile functions

The tool includes several mobile API functions that interact with MyIce's mobile API:

  • myice mobile-login - Authenticate and get authentication tokens
  • myice mobile - Fetch game data using the mobile API
  • myice mobile-game {game_id} - Get detailed information about a specific game

These functions can be useful for debugging or when the regular web interface is not available.

fetch schedule

myice schedule -o schedule.json

To use a specific configuration section:

myice schedule -o schedule.json --config-section isaac

data

listing

To fetch events for U13 Elite for example:

 myice search "U13 (Elite)"
[576653] 2024-11-04 practice 17:00-> 17:00
practice: Off-Ice Patinoire des Vernets - Patinoire Extérieure

[572066] 2024-11-04 practice 18:00-> 18:00
practice: On-Ice Patinoire des Vernets - Patinoire Extérieure

[576652] 2024-11-05 practice 18:00-> 18:00
practice: Off-Ice Patinoire des Vernets - Patinoire Extérieure

[572068] 2024-11-05 practice 19:15-> 19:15
practice: On-Ice Patinoire des Vernets - Patinoire Extérieure

[576655] 2024-11-08 practice 18:00-> 18:00
practice: Off-Ice Patinoire des Vernets - Patinoire Extérieure

[572073] 2024-11-08 practice 19:15-> 19:15
practice: On-Ice Patinoire des Vernets - Patinoire Extérieure

[117015] 2024-11-02 game 12:15-> 12:15
game: Saison HC Ajoie

And we retrieve the match roster:

match

To get the roster for the match against Ajoie, the ID is 117015:

 myice game 117015
Opening file game_117015.pdf

To use a specific configuration section:

 myice game 117015 --config-section isaac

practice

And for a practice roster:

 myice practice 561855
Opening file practice_561855.pdf

To use a specific configuration section:

 myice practice 561855 --config-section isaac

AI

 myice ai
> prochain match u13 top ?
< Le prochain match de l'équipe U13 Top se déroulera le dimanche 10 novembre 2024 contre HC Ajoie à la Raffeisen Arena de Porrentruy. Le match débutera à 14h00 et se terminera à 16h15.
> et les u13 a ?
< Le prochain match de l'équipe U13 A se déroulera le samedi 9 novembre 2024 contre HC Vallorbe à P. du Frézillon, 1337 Vallorbe VD. Le match débutera à 13h00 et se terminera à 15h00. Le prochain match à domicile de l'équipe U13 A se déroulera le dimanche 10 novembre 2024 contre CP Meyrin à Les Vernets, Glace extérieure, 1227 Les Acacias GE. Le match débutera à 13h00 et se terminera à 15h00.

To use a specific configuration section:

 myice ai --config-section isaac
Description
myice parsing
Readme 1.1 MiB
Languages
HTML 50.6%
Python 47%
Dockerfile 1.8%
Shell 0.5%