Fixed subsonic scrobble command + internal scrobbler: do not record listen that have been played for less than 5s

This commit is contained in:
emeric
2021-04-08 14:11:09 +02:00
parent 4cf60f7b8b
commit 42e9403b55
9 changed files with 45 additions and 47 deletions
@@ -35,15 +35,19 @@ namespace Scrobbling
{}
void
InternalScrobbler::listenStarted(const Listen& listen)
InternalScrobbler::listenStarted(const Listen& /*listen*/)
{
addListen(listen, Wt::WDateTime::currentDateTime());
// nothing to do
}
void
InternalScrobbler::listenFinished(const Listen& /*event*/, std::chrono::seconds /* duration */)
InternalScrobbler::listenFinished(const Listen& listen, std::optional<std::chrono::seconds> duration)
{
// nothing to do
// record tracks that have been played for at least of few seconds...
if (duration && *duration < std::chrono::seconds {5})
return;
addListen(listen, Wt::WDateTime::currentDateTime());
}
void