Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Jan 29, 2024
2 parents 4bd996e + 210a74c commit b941ff0
Show file tree
Hide file tree
Showing 144 changed files with 11,339 additions and 22,992 deletions.
1 change: 0 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"require": ["./register.js", "source-map-support/register"],
"reporter": "dot"
}
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
alpine-base \
avahi \
avahi-tools \
git \
nodejs \
npm \
Expand Down Expand Up @@ -57,7 +59,8 @@ FROM base as app
#COPY --chown=abc:abc package.json yarn.lock ./
COPY --chown=abc:abc package*.json ./
COPY --chown=abc:abc patches ./patches
COPY --from=build --chown=abc:abc /app/build /app/build
COPY --from=build --chown=abc:abc /app/dist /app/dist
COPY --from=build --chown=abc:abc /app/src /app/src
COPY --from=base /usr/local/bin /usr/local/bin
COPY --from=base /usr/local/lib /usr/local/lib

Expand All @@ -75,8 +78,6 @@ ENV IS_DOCKER=true
RUN npm install --omit=dev \
&& npm cache clean --force \
&& chown -R abc:abc node_modules \
&& rm -rf node_modules/ts-node \
&& rm -rf node_modules/typescript \
&& rm -rf node_modules/@types

ARG webPort=9078
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ A javascript app to scrobble music you listened to, to [Maloja](https://github.c
* [Mopidy](/docsite/docs/configuration/configuration.md#mopidy)
* [JRiver](/docsite/docs/configuration/configuration.md#jriver)
* [Kodi](/docsite/docs/configuration/configuration.md#kodi)
* [Google Cast (Chromecast)](/docsite/docs/configuration/configuration.md#google-cast--chromecast-)
* Supports scrobbling to many **Clients**
* [Maloja](/docsite/docs/configuration/configuration.md#maloja)
* [Last.fm](/docsite/docs/configuration/configuration.md#lastfm)
Expand Down
4 changes: 2 additions & 2 deletions codeshift/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function transformer(
if(hasNoExt) {
const dirFiles = fs.readdirSync(dir)
filenameFromDir = dirFiles.find(x => path.parse(x).name === pathInfo.name);
if(filenameFromDir !== undefined) {
if(filenameFromDir === undefined) {
fileExists = false;
isRelative = false;
} else {
Expand Down Expand Up @@ -159,7 +159,7 @@ export default function transformer(
}
break;
default:
transformedImport = combineDirFile(pathInfo.dir, `.${derivedTT}`); // path.join(pathInfo.root, dir, pathInfo.name, `.${derivedTT}`);
transformedImport = combineDirFile(pathInfo.dir, `${path.parse(filenameFromDir).name}.${derivedTT}`); // path.join(pathInfo.root, dir, pathInfo.name, `.${derivedTT}`);
break;
}

Expand Down
11 changes: 11 additions & 0 deletions config/chromecast.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name": "MyCast",
"data": {
"blacklistedDevices": [],
"whitelistedDevices": [],
"blacklistedApps": [],
"whitelistedApps": []
}
}
]
3 changes: 2 additions & 1 deletion docker/root/etc/s6-overlay/s6-rc.d/svc-node/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# NODE_ARGS can be passed by ENV in docker command like "docker run foxxmd/multi-scrobbler -e NODE_ARGS=--optimize_for_size"
echo -e "\nmulti-scrobbler is starting!"
export NODE_ENV=production
cd /app || exit
exec \
s6-setuidgid abc /usr/bin/node $NODE_ARGS /app/build/server.js
s6-setuidgid abc /usr/bin/node $NODE_ARGS /app/node_modules/.bin/tsx /app/src/backend/index.ts
28 changes: 28 additions & 0 deletions docsite/docs/FAQ.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- TOC -->
* [Connection Issues](#connection-issues)
* [Plex/Tautulli/Jellyfin don't connect](#plextautullijellyfin-dont-connect)
* [Jellyfin has warnings about undefined or missing data](#jellyfin-has-warnings-about-undefined-or-missing-data)
Expand All @@ -8,6 +9,9 @@
* [Scrobbling Issues](#scrobbling-issues)
* [Last.fm does not scrobble tracks with multiple artists correctly](#lastfm-does-not-scrobble-tracks-with-multiple-artists-correctly)
* [Jellyfin does not scrobble tracks with multiple artists correctly](#jellyfin-does-not-scrobble-tracks-with-multiple-artists-correctly)
* [Google Cast track information is missing/incorrect or MS player has weird times](#google-cast-track-information-is-missingincorrect-or-ms-player-has-weird-times)
* [Google Cast device does not track media](#google-cast-device-does-not-track-media)
<!-- TOC -->

# Connection Issues

Expand Down Expand Up @@ -151,3 +155,27 @@ Multi-scrobbler works the same was the official Spotify-Last.fm integration work
## Jellyfin does not scrobble tracks with multiple artists correctly

This is a limitation caused by the [Jellyfin webhook plugin](https://github.com/FoxxMD/multi-scrobbler/issues/70#issuecomment-1443804712) only sending the first artist to multi-scrobbler. This issues needs to be [fixed upstream on the Jellyfin webhook repository.](https://github.com/jellyfin/jellyfin-plugin-webhook/issues/166)

## Google Cast track information is missing/incorrect or MS player has weird times

The Google Cast integration relies on a few common fields in the data it receives from your casting device. Every platform that can cast (Spotify, Pandora, etc...) *should* use these fields the same but there are slight differences between their implementations that may confuse multi-scrobbler. Specific platforms may also return more information in non-common fields that are undocumented.

To diagnose these issues you [**must enable payload logging**](configuration/configuration.md#cast-troubleshooting) for your google cast Source, run MS, and then include logs with this output from that run. Without the raw data logged from your cast device it will be nearly impossible to resolve your issue.

## Google Cast device does not track media

It is likely the app playing on the cast device is incorrectly reporting the media type as **not music**.

MS logs will tell you what type the media is reported as with lines like:

```
My Artist - Example Track has 'unknown' media type and allowUnknownMedia=false, will not track
```

Refer to [Allow Unknown Media Type](configuration/configuration.md#allow-unknown-media-type) section to fix this

```
My Artist - Example Track has 'movie' media type so will not track
```

Refer to [Force Media Tracking](configuration/configuration.md#forcing-media-tracking) section to fix this
134 changes: 132 additions & 2 deletions docsite/docs/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ title: Overview

# Configuration

<!-- TOC -->
* [Overview](#overview)
* [ENV-Based Configuration](#env-based-configuration)
* [File-Based Configuration](#file-based-configuration)
* [All-in-One File Configuration](#all-in-one-file-configuration)
* [Specific File Configuration](#specific-file-configuration)
* [Application Options](#application-options)
* [Base URL](#base-url)
* [Source Configurations](#source-configurations)
* [Spotify](#spotify)
* [Plex](#plex)
Expand All @@ -20,18 +23,26 @@ title: Overview
* [Listenbrainz (Source)](#listenbrainz--source-)
* [Deezer](#deezer)
* [Youtube Music](#youtube-music)
* [MPRIS (Linux Desktop)](#mpris)
* [MPRIS](#mpris)
* [Mopidy](#mopidy)
* [JRiver](#jriver)
* [Kodi](#kodi)
* [WebScrobbler](#webscrobbler)
* [Multiple Users](#multiple-users)
* [Google Cast (Chromecast)](#google-cast--chromecast-)
* [Connecting Devices](#connecting-devices)
* [What Media Does MS Scrobble?](#what-media-does-ms-scrobble)
* [Cast Troubleshooting](#cast-troubleshooting)
* [Client Configurations](#client-configurations)
* [Maloja](#maloja)
* [Last.fm](#lastfm)
* [Listenbrainz](#listenbrainz)
* [Monitoring](#monitoring)
* [Webhooks](#webhook-configurations)
* [Webhook Configurations](#webhook-configurations)
* [Gotify](#gotify)
* [Ntfy](#ntfy)
* [Health Endpoint](#health-endpoint)
<!-- TOC -->

# Overview

Expand Down Expand Up @@ -694,6 +705,125 @@ MS can be configured to only scrobble, or NOT scrobble, from some WS connectors.

See [`webscrobbler.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/webscrobbler.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FWebScrobblerSourceConfig/%23%2Fdefinitions%2FWebScrobblerData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json)

## [Google Cast (Chromecast)](https://www.google.com/chromecast/built-in/)

If your media device can be **Cast** to using this button ![Chromecast Icon](https://upload.wikimedia.org/wikipedia/commons/2/26/Chromecast_cast_button_icon.svg) on your phone/computer then multi-scrobbler can monitor it in order to scrobble music you play.

**Note:** This source relies on common, **basic** music data provided by the cast device which will always be less exhaustive than data parsed from full source integrations. If there is an existing [Source](#source-configurations) it is recommended to configure for it and blacklist the app on Google Cast, rather than relying solely on Google Cast for scrobbling.

### Connecting Devices

Cast devices can be manually configured using [File-based configuration](#file-based-14) OR automatically discovered using **mDNS.**

##### mDNS Discovery

The host machine running multi-scrobbler must be configured to allow [mDNS traffic on port 5353/UDP](https://book.hacktricks.xyz/network-services-pentesting/5353-udp-multicast-dns-mdns).

##### Linux

**Docker**

The host machine must have [avahi-daemon](https://avahi.org/) running to circumvent limitations with DNS resolution due to musl in Alpine. Most major linux distributions package avahi and many have it built-in. Once avahi is running you must pass D-Bus and the avahi daemon socket to your container like so:

```
docker run ... -v /var/run/dbus:/var/run/dbus -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket ... foxxmd/multi-scrobbler
```

**Flatpak/Nodejs**

No additional steps are required.

##### Windows

**Docker**

Unsupported at this time.

**Nodejs**

No additional steps are required.

### What Media Does MS Scrobble?

Cast devices report what type of media the current activity is [(see `metadata` property here)](https://developers.google.com/cast/docs/media/messages#MediaInformation). The reported type is dependent on the application playing the media to correctly report it, the cast device does not magically know what the media is. If an application does not report a type it is always classified as `unknown`.

**By default, MS will only track media that is reported as `MusicTrack`.**

#### Allow Unknown Media Type

Media with an Unknown (`Generic`) media type can be explicitly allowed by setting `"allowUnknownMedia": true` in the [file-based configuration.](#file-based-14) This can also be configured to only allow unknown media types for specific applications by using a list of application names like:

```json5
// in chromecast.json or config.json sources
[
{
"name": "MyCast",
"type": "chromecast",
"data": {
// only allow unknown if app name contains any of these phrases
"allowUnknownMedia": ["smarttube", "default media receiver"]
},
}
]
```

#### Forcing Media Tracking

MS can be forced to track media from an application regardless of media type. This is useful if an application incorrectly reports a media type you are sure should be music. Set `"forceMediaRecognitionOn"` in the [file-based configuration.](#file-based-14) to a list of application names that should always be tracked like:

```json5
// in chromecast.json or config.json sources
[
{
"name": "MyCast",
"type": "chromecast",
"data": {
// media from applications that contains these phrases will always be tracked, regardless of media type reported
"forceMediaRecognitionOn": ["smarttube", "default media receiver"]
},
}
]
```


### Cast Troubleshooting

Please include any/all logs with raw output if there are any errors encountered as this is critical to diagnosing issues.

To diagnose bad/incomplete track information or strange MS player behavior please turn on **payload logging** and include log output of the source running to help diagnose this issue:

```json5
// in chromecast.json or config.json sources
[
{
"name": "MyCast",
"type": "chromecast",
"data": {
//...
},
"options": {
"logPayload": true
}
}
]
```

### ENV-Based

Note: [Manually configuring cast device connections](#connecting-devices) is only available through [File-based config.](#file-based-14)

| Environmental Variable | Required? | Default | Description |
|------------------------|-----------|---------|--------------------------------------------------------------------------------------|
| CC_ENABLE | No | | Set to 'true' to enable Cast monitoring without needing to define other ENVs |
| CC_WHITELIST_DEVICES | No | | Only scrobble from these Cast devices. Comma-delimited list. EX mini-home, family-tv |
| CC_BLACKLIST_DEVICES | No | | Do not scrobble from these Cast devices. Comma-delimited list |
| CC_WHITELIST_APPS | No | | Only scrobble from these casted Apps. Comma-delimited list. EX spotify, pandora |
| CC_BLACKLIST_APPS | No | | Do not scrobble from these casted Apps. Comma-delimited list |

### File-Based

See [`chromecast.json.example`](https://github.com/FoxxMD/multi-scrobbler/blob/master/config/chromecast.json.example) or [explore the schema with an example and live editor/validator](https://json-schema.app/view/%23%2Fdefinitions%2FChromecastSourceConfig/%23%2Fdefinitions%2FChromecastData?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fmulti-scrobbler%2Fmaster%2Fsrc%2Fbackend%2Fcommon%2Fschema%2Fsource.json)

# Client Configurations

## [Maloja](https://github.com/krateng/maloja)
Expand Down
1 change: 1 addition & 0 deletions docsite/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ A javascript app to scrobble music you listened to, to [Maloja](https://github.c
* [Mopidy](docs/configuration#mopidy)
* [JRiver](docs/configuration#jriver)
* [Kodi](docs/configuration#kodi)
* [Google Cast (Chromecast)](/docs/configuration#google-cast--chromecast-)
* Supports scrobbling to many **Clients**
* [Maloja](docs/configuration#maloja)
* [Last.fm](docs/configuration#lastfm)
Expand Down
2 changes: 1 addition & 1 deletion flatpak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ From MS project root:

```shell
cd flatpak
flatpak-builder --repo=/home/yourUser/multi-scrobbler-repo /home/yourUser/multi-scrobbler-build io.github.foxxmd.multiscrobbler.yml --force-clean
flatpak-builder --repo=/home/yourUser/multi-scrobbler-flatpak/repo --state-dir=/home/yourUser/multi-scrobbler-flatpak/state /home/yourUser/multi-scrobbler-flatpak/build io.github.foxxmd.multiscrobbler.yml --force-clean --install --user
```
Add `--install --user` to have the app installed immediately.
# 5. Run (Locally)
Expand Down
3 changes: 3 additions & 0 deletions flatpak/io.github.foxxmd.multiscrobbler.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
<li>Plex (Tautulli)</li>
<li>Any subsonic-based music player (Airsonic)</li>
<li>Jellyfin</li>
<li>WebScrobbler</li>
<li>Mopidy</li>
<li>Deezer</li>
<li>JRiver</li>
<li>Kodi</li>
<li>Webscrobbler</li>
<li>Youtube Music</li>
<li>MPRIS (linux desktop)</li>
<li>Google Cast (Chromecast)</li>
</ul>
<p>and consolidate your listens (scrobbles) into one or more scrobbling servers/services:</p>
<ul>
Expand All @@ -43,6 +45,7 @@
</screenshot>
</screenshots>
<releases>
<release version="0.6.4" date="2024-01-29"/>
<release version="0.6.3" date="2024-01-10"/>
<release version="0.6.2" date="2023-11-29"/>
<release version="0.6.1" date="2023-10-24"/>
Expand Down
24 changes: 18 additions & 6 deletions flatpak/io.github.foxxmd.multiscrobbler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ modules:
- NODE_ENV=production npm run build

# makes node and npm available
- mkdir -p /app/bin /app/lib /app/lib/build
- mkdir -p /app/bin /app/lib /app/lib/dist /app/lib/src /app/lib/assets
- cp -a /usr/lib/sdk/node18/bin/{node,npm} /app/bin
- cp -a /usr/lib/sdk/node18/lib/* /app/lib
- rm -r /app/lib/node_modules/npm/{docs,man}
Expand All @@ -36,11 +36,18 @@ modules:
- npm prune --production

# copy node_modules needed to run app
- cp -r node_modules/* /app/lib/node_modules
- cp -r node_modules/. /app/lib/node_modules

# copy app files to runtime dir
- cp -r build/* /app/lib/build
- cp -r dist/. /app/lib/dist
- cp -r src/. /app/lib/src
- cp -r config /app/lib/config
- cp -r assets /app/lib/assets
- cp -r public /app/lib/public
- cp vite.config.ts /app/lib/vite.config.ts
- cp tsconfig.json /app/lib/tsconfig.json
- cp tailwind.config.js /app/lib/tailwind.config.js
- cp postcss.config.js /app/lib/postcss.config.js
- cp flatpak/defaultConfig.json /app/lib/config/config.json

- install -Dm644 flatpak/${FLATPAK_ID}.desktop /app/share/applications/${FLATPAK_ID}.desktop
Expand All @@ -51,11 +58,16 @@ modules:
- install -Dm755 ../run.sh /app/bin/multiscrobbler
subdir: main
sources:
# use for official releases
- type: git
url: https://github.com/FoxxMD/multi-scrobbler
branch: REPLACE_ME
commit: REPLACE_ME
tag: 0.6.3
commit: 4bd996eb466137ffc5c3f48305afabde03720525
dest: main
# use if developing locally
# - type: dir
# path: /home/yourUser/multi-scrobbler
# dest: main
# Wrapper to launch the app
- type: script
dest-filename: run.sh
Expand All @@ -70,6 +82,6 @@ modules:
cp -r /app/lib/config/. "${XDG_CONFIG_HOME}"/
#cp /app/lib/defaultConfig.json $XDG_CONFIG_HOME/config.json
fi
- cd /app/lib && CONFIG_DIR=$XDG_CONFIG_HOME IS_LOCAL=true NODE_ENV=production node build/server.js
- cd /app/lib && CONFIG_DIR=$XDG_CONFIG_HOME LOG_DIR=$XDG_CONFIG_HOME IS_LOCAL=true NODE_ENV=production node_modules/.bin/tsx src/backend/index.ts

- generated-sources.json
Loading

0 comments on commit b941ff0

Please sign in to comment.