19 Commits

Author SHA1 Message Date
Kendall Garner
fa85e2a781
Use userId in player, other fixes (#3182)
* [bugfix] player: use userId, other fixes

This PR primarily resolves #1928 by switching the foreign key of `player` from `user.user_name` to `user.id`.
There are also a few other fixes/changes:

- For some bizarre reason, `ip_address` is never returned from `read`/`get`. Change the field to `ip`, which works. Somehow
- Update `players_test.go` mock to also check for user agent, replicating the actual code
- Update `player_repository.go` `isPermitted` to check user id. I don't know how this worked before...
- tests!
- a few places referred to `typ`, when it is really `userAgent`. Change the field names

* baseRequest -> selectPlayer

* remove comment

* update migration, make all of persistence foreign key enabled

* maybe don't forget to save the file first
2024-08-03 13:37:21 -04:00
Deluan
3bc9e75b28 Evict expired items from SimpleCache 2024-06-24 17:32:34 -04:00
Deluan
3993c4d17f Upgrade to ttlcache/v3 2024-06-21 18:09:34 -04:00
Deluan
29bc17acd7 Wrap ttlcache in our own SimpleCache implementation 2024-06-21 17:21:09 -04:00
Deluan
55bff343cd Optimize SQLite3 access. Mainly separate read access from write access.
Based on tips from https://archive.is/Xfjh6#selection-257.0-278.0
2024-05-21 17:19:41 -04:00
Deluan
f7a4387d0e Bump github.com/jellydator/ttlcache/v2 to v2.11.1 2024-02-16 21:42:22 -05:00
Deluan
727632b616 Refactor play tracking 2023-02-11 18:52:28 -05:00
Deluan
9c433b5d68 Add missing context to logger calls 2022-11-04 11:30:12 -04:00
Deluan
d613b19306 Simplify Singleton usage by leveraging Go 1.18's generics 2022-07-27 12:15:05 -04:00
Deluan
053909196c More info in scrobbling logs 2021-11-02 12:25:29 -04:00
Steve Richter
a56d5bc850
Listenbrainz scrobbling (#1424)
* Refactor session_keys to its own package

* Adjust play_tracker

- Don't send external NowPlaying/Scrobble for tracks with unknown artist
- Continue to the next agent on error

* Implement ListenBrainz Agent and Auth Router

* Implement frontend for ListenBrainz linking

* Update listenBrainzRequest

- Don't marshal Player to json
- Rename Track to Title

* Return ErrRetryLater on ListenBrainz server errors

* Add tests for listenBrainzAgent

* Add tests for ListenBrainz Client

* Adjust ListenBrainzTokenDialog to handle errors better

* Refactor listenbrainz.formatListen and listenBrainzRequest structs

* Refactor agent auth_routers

* Refactor session_keys to agents package

* Add test for listenBrainzResponse

* Add tests for ListenBrainz auth_router

* Update ListenBrainzTokenDialog and auth_router

* Adjust player scrobble toggle
2021-10-30 12:17:42 -04:00
Deluan
b0fc684cb6 Fix small lint errors found by gocritic 2021-07-15 13:43:03 -04:00
Deluan
26b5e6b1b4 Better scrobble log message when buffer is disabled 2021-07-02 10:19:16 -04:00
Deluan
f49205733b Add feature flag for buffered scrobbling 2021-07-02 10:04:41 -04:00
Deluan
cfb113bd33 Disable Last.FM features based on LastFM.Enabled config option 2021-07-02 10:04:41 -04:00
Deluan
289da56f64 Implement Scrobble buffering/retrying 2021-07-02 10:04:41 -04:00
Deluan
abe8015745 Add option to disable external scrobbling per player 2021-06-23 17:55:58 -04:00
Deluan
99be8444d3 Disable completely external scrobblers if feature is disabled (DevEnableScrobble) 2021-06-23 11:01:58 -04:00
Deluan
056f0b944f Refactor: Consolidate scrobbling logic in play_tracker 2021-06-23 11:01:58 -04:00