Revert "Marking nowPlaying in smapi setPlayedSeconds handler so does not mark when sonos pre-caches a track (#57)" (#66)

This reverts commit c312778e13.
This commit is contained in:
Simon J
2021-10-16 14:51:07 +11:00
committed by GitHub
parent a64947f603
commit a3a30455d0
4 changed files with 63 additions and 152 deletions

View File

@@ -914,26 +914,16 @@ function bindSmapiSoapServiceToExpress(
.then(({ musicLibrary, type, typeId }) => {
switch (type) {
case "track":
return musicLibrary
.track(typeId)
.then(({ duration }) => {
if (
(duration < 30 && +seconds >= 10) ||
(duration >= 30 && +seconds >= 30)
) {
return musicLibrary.scrobble(typeId);
} else {
return Promise.resolve(true);
}
})
.then(() => {
if (+seconds > 0) {
return musicLibrary.nowPlaying(typeId);
} else {
return Promise.resolve(true);
}
});
break;
return musicLibrary.track(typeId).then(({ duration }) => {
if (
(duration < 30 && +seconds >= 10) ||
(duration >= 30 && +seconds >= 30)
) {
return musicLibrary.scrobble(typeId);
} else {
return Promise.resolve(true);
}
});
default:
logger.info("Unsupported scrobble", { id, seconds });
return Promise.resolve(true);