From d7a86b0401f00cb445e9cc411634ec38838c3461 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 26 Jun 2024 16:56:12 -0400 Subject: [PATCH 1/4] feat(youtube): Increase level of auth update logging when configured to output changes #158 Increasing to INFO makes the signal better for long-running MS processes instead of requiring logging all of DEBUG --- src/backend/sources/YTMusicSource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/sources/YTMusicSource.ts b/src/backend/sources/YTMusicSource.ts index ae3c6248..94604d2f 100644 --- a/src/backend/sources/YTMusicSource.ts +++ b/src/backend/sources/YTMusicSource.ts @@ -139,9 +139,9 @@ export default class YTMusicSource extends AbstractSource { for(const [k,v] of updated) { parts.push(`Cookie ${k}: Old => ${v.old} | New => ${v.new}`); } - this.logger.debug(`Updated Auth -->\n${parts.join('\n')}`); + this.logger.info(`Updated Auth -->\n${parts.join('\n')}`); } else { - this.logger.debug(`Updated Auth`); + this.logger.verbose(`Updated Auth`); } this.currentCreds = { -- 2.51.2 From 469847e4b7efcdce95557e25e1bb31dd5297d7a8 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 26 Jun 2024 17:16:03 -0400 Subject: [PATCH 2/4] feat(youtube): Use just-validated history as recently played on new plays #156 Rather than generating our own just use the known "good" history we just compared against to see if this improves consistency. --- src/backend/sources/YTMusicSource.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/backend/sources/YTMusicSource.ts b/src/backend/sources/YTMusicSource.ts index 94604d2f..f8b308ac 100644 --- a/src/backend/sources/YTMusicSource.ts +++ b/src/backend/sources/YTMusicSource.ts @@ -235,7 +235,6 @@ export default class YTMusicSource extends AbstractSource { this.recentlyPlayed = plays; newPlays = plays; } else { - if(playsAreSortConsistent(this.recentlyPlayed, plays)) { return newPlays; } @@ -251,20 +250,18 @@ ${humanDiff}`); } else { // new plays newPlays = [...diff].reverse(); - } + this.recentlyPlayed = plays; - if(newPlays.length > 0) { newPlays = newPlays.map((x) => ({ - data: { - ...x.data, - playDate: dayjs().startOf('minute') - }, - meta: { - ...x.meta, - newFromSource: true - } - })); - this.recentlyPlayed = newPlays.concat(this.recentlyPlayed).slice(0, 20); + data: { + ...x.data, + playDate: dayjs().startOf('minute') + }, + meta: { + ...x.meta, + newFromSource: true + } + })); } } -- 2.51.2 From 2f2eeeb13ad112c7a59f568177722e283756c476 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 28 Aug 2024 09:32:46 -0400 Subject: [PATCH 3/4] docs(youtube): Add FAQ entries for YTM auth and scrobble issues --- docsite/docs/FAQ.md | 20 ++++++++++++++++++++ docsite/docs/configuration/configuration.mdx | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docsite/docs/FAQ.md b/docsite/docs/FAQ.md index 40f9f31a..bfde8486 100644 --- a/docsite/docs/FAQ.md +++ b/docsite/docs/FAQ.md @@ -128,6 +128,18 @@ EX `http://localhost:9078/lastfm/callback` -> `http://192.168.0.220:9078/lastfm/ Deezer has discontinued support for their API and the Deezer Source is now [**deprecated.**](configuration/configuration.mdx#deezer) See [this issue for more discussion.](https://github.com/FoxxMD/multi-scrobbler/issues/175#issuecomment-2296776625) +### Youtube Music fails after some time + +The Youtube Music library relies on scraping the YTM site (pretending to be a browser) by using cookies/auth from your actual browser. It does its best to keep these up to date but since this is not an official way to access the service YTM may invalidate your access _to the authenticated session_ at any time. How this is triggered is unknown and not something multi-scrobbler can control. + +If you see errors in multi-scrobbler for YTM that contain **401** or **403** like + +``` +Error: Could not send the specified request to browse. Status code: 401 +``` + +then YTM has invalidated your access. [Follow the YTM instructions to retrieve a new set of cookies for multi-scrobbler]((configuration/configuration.mdx#youtube-music)) and then restart MS to potentially resolve the problem. See [this issue](https://github.com/FoxxMD/multi-scrobbler/issues/158) for further discussion of the problem. + ## Configuration Issues ### Config could not be parsed @@ -181,3 +193,11 @@ Refer to [Force Media Tracking](configuration/configuration.mdx#forcing-media-tr ### VLC is not scrobbling fields correctly Before reporting an issue turn on metadata logging in the MS VLC configuration, [see the VLC documentation.](configuration/configuration.mdx#vlc-information-reporting) + +### Youtube Music misses scrobbles + +In order for multi-scrobbler to accurately determine if a song has been scrobbled it needs **a source of truth.** For YTM this is a "history" list scraped from the YTM website. Unfortunately, the data in this list can be (often) inconsistent which makes it hard for multi-scrobbler to "trust" that it is correct and determine when/if new scrobbles occur. This inconsistency is not something multi-scrobbler can control -- it is a side-effect of having to use an unofficial method to access YTM (scraping). + +In order to compensate for this multi-scrobbler resets when it considers this list the "source of truth" based on if the list changes in an inconsistent way between consecutive checks. New scrobbles can only be detected when this list is "OK" as a source of truth for N+1 checks. Therefore, any new tracks that appear when the list is inconsistent will be ignored. + +See [this issue](https://github.com/FoxxMD/multi-scrobbler/issues/156#issuecomment-2312533486) for further discussion and a more detailed explanation of why this is happening and how multi-scrobbler compensates for it. diff --git a/docsite/docs/configuration/configuration.mdx b/docsite/docs/configuration/configuration.mdx index 674f88eb..5f1c10e6 100644 --- a/docsite/docs/configuration/configuration.mdx +++ b/docsite/docs/configuration/configuration.mdx @@ -563,8 +563,9 @@ After starting multi-scrobbler with credentials in-place open the dashboard (`ht :::note -* YT Music authentication is "browser based" which means your credentials may expire after a (long?) period of time OR if you log out of https://music.youtube.com. In the event this happens just repeat the steps below to get new credentials. +* YT Music authentication is "browser based" which means your credentials may expire after a (long?) period of time OR if you log out of https://music.youtube.com. In the event this happens just repeat the steps below to get new credentials. [See the FAQ](../FAQ.md#youtube-music-fails-after-some-time) for a more detailed explanation. * Communication to YT Music is **unofficial** and not supported or endorsed by Google. This means that **this integration may stop working at any time** if Google decides to change how YT Music works in the browser. + * Due to this scrobble history from YTM is often inconsistent and can cause missed scrobbles. [See the FAQ](../FAQ.md#youtube-music-misses-scrobbles) for a more detailed explanation. ::: -- 2.51.2 From a3960421d74cc12846e255a8a54f580aff5f0cb8 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 28 Aug 2024 09:35:13 -0400 Subject: [PATCH 4/4] chore: Bump version for release --- flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml | 5 ++++- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml b/flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml index 0126481b..8fcb55e1 100644 --- a/flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml +++ b/flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml @@ -22,7 +22,7 @@
  • Spotify
  • Plex (Tautulli)
  • -
  • Any subsonic-based music player (Airsonic)
  • +
  • Any subsonic-based music player (Airsonic or Navidrome)
  • Jellyfin
  • WebScrobbler
  • Mopidy
  • @@ -33,6 +33,8 @@
  • MPRIS (linux desktop)
  • Google Cast (Chromecast)
  • Musikcube
  • +
  • MPDF (Music Player Daemon)
  • +
  • VLC

and consolidate your listens (scrobbles) into one or more scrobbling servers/services:

    @@ -49,6 +51,7 @@ + diff --git a/package-lock.json b/package-lock.json index c58a9344..a79fb693 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "multi-scrobbler", - "version": "0.8.2", + "version": "0.8.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "multi-scrobbler", - "version": "0.8.2", + "version": "0.8.3", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0f127f87..8cafa658 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "multi-scrobbler", - "version": "0.8.2", + "version": "0.8.3", "type": "module", "description": "scrobble plays from multiple sources to multiple clients", "scripts": { -- 2.51.2