Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Aug 28, 2024
2 parents 0fed96f + a396042 commit e80ad81
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 20 deletions.
20 changes: 20 additions & 0 deletions docsite/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
3 changes: 2 additions & 1 deletion docsite/docs/configuration/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

:::

Expand Down
5 changes: 4 additions & 1 deletion flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ul>
<li>Spotify</li>
<li>Plex (Tautulli)</li>
<li>Any subsonic-based music player (Airsonic)</li>
<li>Any subsonic-based music player (Airsonic or Navidrome)</li>
<li>Jellyfin</li>
<li>WebScrobbler</li>
<li>Mopidy</li>
Expand All @@ -33,6 +33,8 @@
<li>MPRIS (linux desktop)</li>
<li>Google Cast (Chromecast)</li>
<li>Musikcube</li>
<li>MPDF (Music Player Daemon)</li>
<li>VLC</li>
</ul>
<p>and consolidate your listens (scrobbles) into one or more scrobbling servers/services:</p>
<ul>
Expand All @@ -49,6 +51,7 @@
</screenshot>
</screenshots>
<releases>
<release version="0.8.3" date="2024-08-28"/>
<release version="0.8.2" date="2024-08-20"/>
<release version="0.8.1" date="2024-07-17"/>
<release version="0.8.0" date="2024-07-08"/>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
27 changes: 12 additions & 15 deletions src/backend/sources/YTMusicSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -235,7 +235,6 @@ export default class YTMusicSource extends AbstractSource {
this.recentlyPlayed = plays;
newPlays = plays;
} else {

if(playsAreSortConsistent(this.recentlyPlayed, plays)) {
return newPlays;
}
Expand All @@ -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
}
}));
}
}

Expand Down

0 comments on commit e80ad81

Please sign in to comment.