aboutsummaryrefslogtreecommitdiff
path: root/internal/scrobbler/scrobbler.go (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-10-10scrobbler: 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.
2021-10-10mpd-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.
2021-10-10scrobbler: 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.
2021-10-10mpd: 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.
2021-10-10mpd: rename function to create the playerFranck Cuny1-1/+1
2021-10-09scrobbler: 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.
2021-10-09scrobbler: 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.