aboutsummaryrefslogtreecommitdiff
path: root/tools/mpd-stats/internal/scrobbler/scrobbler.go (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-10-24ref(tools/mpd-stats): delete the projectFranck Cuny1-118/+0
It's been moved to its own repository at https://github.com/fcuny/mpd-stats Update the list of repositories managed by terraform.
2022-06-11mpd: we only want events from the player subsystemFranck Cuny1-1/+1
Store the name of the subsystem in a constant, add some comments on where to find the list.
2022-06-11scrobbler: read mpd status before processing songFranck Cuny1-4/+21
If the status of the player is "stop", we don't have a new song to handle. In this case, if there's a current song, let's update the status and clear our state. Closes #1.
2022-06-11scrobbler: record how long a song was playedFranck Cuny1-1/+15
Add a column `playtime` to the records table to keep track of how long a song was played. With this information, in the future, we will be able to sum up how long we listen to music, but also which songs were skipped.
2022-06-11scrobbler: use helper function EqualAttrsFranck Cuny1-3/+1
To compare the current attributes with the current record, we can use the helper `EqualAttrs` which will tell us if we need to create a new record or not.
2022-06-11mpd-stats: pass database path to the scrobblerFranck Cuny1-4/+27
When creating a scrobbler, we provide the path to the database. The scrobbler then get a handler to the database. When a new record is created, we persist it to the database using the `save` function.
2022-06-11scrobbler: add functions to create and run itFranck Cuny1-18/+24
Add a new function to create a scrobbler. The function takes care of creating the mpd client. Add a function to run the scrobbler, which takes care of creating a new record when needed. This will simplify the interface for the caller, as all they really care about is: create the scrobbler, close it when we're done, and collect songs information while we listen to our music.
2022-06-11mpd: add function `Close` to the playerFranck Cuny1-2/+5
Let's close both the watcher and the client, instead of leaking this interface to the user.
2022-06-11mpd: rename function to create the playerFranck Cuny1-1/+1
2022-06-11scrobbler: create a record on new songFranck Cuny1-5/+27
When we receive an event from the player, we look if the song is different from the previous one, and we create a new record if that's the case. If the song is similar, there's nothing to do.
2022-06-11scrobbler: watch for events and print song detailsFranck Cuny1-0/+35
We create a module "mpd" to interact with our MPD instance. For now we only have a single function to create a new client, which creates an actual client for mpd (and we ping the instance every 30 seconds), and a watcher to receive new events. The tool "scrobbler" then wait for new events and display songs information.