he/they

fm-tui: a Terminal-based User Interface for fotmob

- 2023.08.12 -
okay so i like football dont i? i need to know a lot of results and have live-updated league tables and cup brackets. for that i have been using fotmob for quite a while now, i use the android app so i get notifications of upcoming matches, transfers, goals, red cards, and (mainly) lineups.
because i can get my shit sat down i discovered that fotmob has sort of an open API from which i can retrieve the data myself (is important to know that when i discovered this i didnt know what to do with it) so after i tried to use jq(1) i spent some hours learning to use the requests and json modules for python and actually made a couple of scripts:

result of python script showing ongoing games at the instant of taking the screenshot

actual first thing i managed to do. no arguments no nothing, i dont even know if this makes the request or is using a local json.

result of python script showing Brasileirão table and current round's matches as for august 12th, 2023

this is the pinacle of what i made, the full table of any league (given the id that fotmob uses), coloured according to its qualification position AND the matches from the current round. (im eventually posting code for this but i dont want to make this page morbiusly lengthy :p)
i dont plan to do much more, maybe add form or something but im so content with this result.

result of python script showing starting lineups for Athletic Club - Real Madrid 2023/24 La Liga season, week 1, bad formatted

this is where i left it for lineups, obviously my intention was to have just eleven lines + subsistutions but i moved on to tables before i figured how to do it in python
objective: have each team's XI side by side and symbols representing goals, cards and subsitutions next to the names

i never managed to bundle all of this inside a single app, i even spent two whole hours trying to make it able to know when the "league" is actually a league, a cup with league phase or cup with only direct elimination. somewhere in the files is the version that i made work with the World Cup and J. League Cup but yeah, its a separate thing you need to run.

my plan now, then, is to do this in C, which i control tons more. im learning how to use json-c but i dont know how to do the same requests thing or anything (i barely know python so im a C expert in comparison) im posting a copy of what i got right now but i want to make a journal of this cause i actually think this is a project ill enjoy and finish some time.


- 2023.08.18 -

after barely touching this for a week and fighting my life against json-c and libcurl i managed to replicate most of the original league-py in C
because i still have not created a git repo im still posting a copy to the neocities tree.

result of c reimplementation of the league-py script showing the classification of Brazilian Serie A in August 19, 2023

this is mostly the same as what the python script as before, but now its c so i feel better about it.
i dont think benchmarking is important right now because the program in its first steps, BUT using hyperfine i get 220.8ms (± 117.1ms) mean time for the c program vs 521.8ms (± 385.5ms) in python, so around 2.3 times faster :3

ill continue working on it and thinking again everything when i try to use curses and displaying is completely different.

- 2023.08.24 -

result of c implementation of the ali.py script showing lineups for AFC CL qualy fase match between korean icheon united and vietnamese hai phong

in between i almost recreated the lineups script with C but for some reason it keeps messing up names. to probably has to do with how i use memset or something.

LaLiga table after matchday 2 in a blank terminal window

i managed to do the league table in ncurses, forgetting that there where qualificatoin colours before. this code makes the curl requests in a different way (a separate function makes the requests and saves result to a string) so it can be called multiple times.

- 2023.09.17 -

lineup for LaLiga matchday 6 FC Barcelona 5-0 Real Betis showing subsitution times, goals, assists and cards

anyways never updated this but i finally got what i wanted the lineup screen to look like. i prepared everything to start a gh repo and then casually read the "The use of automatic services (robots, crawler, indexing etc.) as well as other methods for systematic or regular use is not permitted." at the bottom of fotmob's page, got scared and never published it.
i managed to understand how color works on ncurses and realised i needed and realised i in fact messed up some memsets and left NULL bytes here and there and also absolutely never freed any memory :3
shirt numbers on benched players are still messed up sometimes (and this time i have no idea why could it be) and puting player info is a massive if-hell (i tried to delegate into functions for eatch case, one function for subbed in and subbed out home and away, etc. but got hit in the face with enough sigfaults i gave up). i wanted it to be a whole tui with user input and display result + status but im so lazy omg im happy with this
anyways here is the code file as always ^w^

more at tw/dauthubleis and m/dauthubleis

hosted by neocities