Skip to content

Commit 0c58cc6

Browse files
committed
Merge branch 'develop'
2 parents 4a0cdc0 + 19687b7 commit 0c58cc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+8086
-2091
lines changed

.dockerignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ npm-debug.log
44
Dockerfile
55
.dockerignore
66
.gitignore
7+
.github
78
.git
8-
config/currentCreds.json
99
*.log
10-
config/maloja.json
11-
config/spotify.json
12-
config/config.json
10+
.idea
11+
config/*.json
12+
config/*.bak
1313
/docs
14+
/logs
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Logs**
24+
If possible reproduce the issue with [debug logging ON](/docs/FAQ.md#turn-on-debug-logging)
25+
26+
```
27+
Copy and paste as much log data as possible related to this issue here.
28+
```
29+
30+
**Versions (please complete the following information):**
31+
Provide version information for any related sources/clients.
32+
33+
- multi-scrobbler: [e.g. 0.4.0 on docker]
34+
- maloja [e.g. 3.1.4]
35+
- jellyfin [e.g. 10.8.9]
36+
37+
**Additional context**
38+
Add any other context about the problem here.

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ dist
117117
.yarn/install-state.gz
118118
.pnp.*
119119

120-
*.json
120+
config/*.json
121121
*.txt
122122
.idea/
123+
124+
src/**/**.js
125+
src/**/**.js.map
126+
127+
*.bak

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"lts/fermium"
1+
lts/hydrogen

Dockerfile

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,54 @@
1-
FROM node:fermium-alpine3.10
1+
FROM lsiobase/alpine:3.17 as base
22

33
ENV TZ=Etc/GMT
44

5+
RUN \
6+
echo "**** install build packages ****" && \
7+
apk add --no-cache \
8+
alpine-base \
9+
git \
10+
nodejs \
11+
npm \
12+
openssh && \
13+
echo "**** cleanup ****" && \
14+
rm -rf \
15+
/root/.cache \
16+
/tmp/*
17+
518
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
619

7-
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node
20+
ARG data_dir=/config
21+
VOLUME $data_dir
22+
ENV CONFIG_DIR=$data_dir
23+
24+
COPY docker/root/ /
25+
26+
WORKDIR /app
827

9-
WORKDIR /home/node/app
28+
FROM base as build
1029

11-
COPY package*.json ./
30+
# copy NPM dependencies and install
31+
COPY --chown=abc:abc package*.json ./
32+
COPY --chown=abc:abc tsconfig.json .
1233

13-
USER node
34+
RUN npm install
1435

15-
RUN npm install --production
36+
COPY --chown=abc:abc . /app
1637

17-
COPY --chown=node:node . .
38+
RUN npm run build && rm -rf node_modules
1839

19-
ENV NPM_CONFIG_LOGLEVEL debug
40+
FROM base as app
2041

21-
ARG config_dir=/home/node/config
22-
RUN mkdir -p $config_dir
23-
VOLUME $config_dir
24-
ENV CONFIG_DIR=$config_dir
42+
COPY --from=build --chown=abc:abc /app /app
2543

26-
ARG log_dir=/home/node/logs
27-
RUN mkdir -p $log_dir
28-
VOLUME $log_dir
29-
ENV LOG_DIR=$log_dir
44+
ENV NODE_ENV="production"
45+
46+
RUN npm install --omit=dev \
47+
&& npm cache clean --force \
48+
&& chown abc:abc node_modules \
49+
&& rm -rf node_modules/ts-node \
50+
&& rm -rf node_modules/typescript
3051

3152
ARG webPort=9078
3253
ENV PORT=$webPort
3354
EXPOSE $PORT
34-
35-
CMD [ "node", "index.js" ]

README.md

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,66 +31,55 @@ A javascript app to scrobble plays from multiple sources to [Maloja](https://git
3131

3232
**But I already scrobble my music to Last.fm, is multi-scrobbler for me?**
3333

34-
Yes! You can use [Last.fm as a Source](/docs/configuration.md#lastfm-source) to mirror scrobbles from your Last.fm profile to Maloja. That way you can keep your current scrobble setup as-is but still get the benefit of capturing your data to a self-hosted location.
34+
Yes! You can use [Last.fm as a **Source**](/docs/configuration.md#lastfm--source-) to mirror scrobbles from your Last.fm profile to Maloja. That way you can keep your current scrobble setup as-is but still get the benefit of capturing your data to a self-hosted location.
3535

3636
<img src="/assets/status-ui.jpg" width="800">
3737

38-
## Installation
38+
## How Does multi-scrobbler (MS) Work?
3939

40+
You set up configurations for one or more **Sources** and one or more **Clients**. MS monitors all of your configured **Sources**. When new tracks are played by a Source it grabs that information and then sends it (scrobbles it) to all **Clients** that Source is configured to scrobble to.
4041

41-
### Locally
42+
### Source
4243

43-
Clone this repository somewhere and then install from the working directory
44+
A **Source** is a data source that contains information about tracks you are playing like a music player or platform. Examples are **Spotify, Jellyfin, Plex, Airsonic**, etc...
4445

45-
```bash
46-
git clone https://github.com/FoxxMD/multi-scrobbler.git .
47-
cd multi-scrobbler
48-
npm install
49-
```
46+
Source configurations consist of:
5047

51-
### [Docker](https://hub.docker.com/r/foxxmd/multi-scrobbler)
48+
* A friendly name.
49+
* Any data needed to communicate or authenticate with the Source.
50+
* An optional list of Client names that the Source should scrobble to. If omitted the Source also scrobbles to all configured Clients.
5251

53-
```
54-
foxxmd/multi-scrobbler:latest
55-
```
52+
### Client
5653

57-
## Setup
54+
A **Client** is an application that stores the historical information about what songs you have played (scrobbles). Examples are **Maloja, Last.fm, Listenbrainz**...
5855

59-
Some setup is required! See the [configuration](docs/configuration.md) docs for a full reference.
56+
Client configurations consist of:
6057

61-
### TLDR, Minimal Example
62-
63-
You want to use multi-scrobbler to scrobble your plays from Spotify to Maloja:
64-
65-
#### Local
66-
```bash
67-
SPOTIFY_CLIENT_ID=yourId SPOTIFY_CLIENT_SECRET=yourSecret MALOJA_URL=http://domain.tld MALOJA_API_KEY=1234 node index.js
68-
```
58+
* A friendly name.
59+
* Any data needed to communicate or authenticate with the Client.
6960

70-
#### Docker
71-
72-
```bash
73-
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -v /path/on/host/config:/home/node/app/config foxxmd/multi-scrobbler
74-
```
75-
76-
**But I want to use json for configuration?**
61+
## Installation
7762

78-
Then use [config.json.example](/config/config.json.example) and drop it in your `CONFIG_DIR` directory
63+
[See the **Installation** documentation](/docs/installation.md)
7964

80-
**Is there an example configuration using everything?**
65+
## Configuration
8166

82-
Yes, check out the [kitchen sink example](/docs/kitchensink.md)
67+
[See the **Configuration** documentation](/docs/configuration.md)
8368

8469
## Usage
8570

8671
A status page with statistics, recent logs, and some runtime configuration options can be found at
8772

8873
```
89-
https://localhost:9078
74+
http://localhost:9078
9075
```
9176
Output is also provided to stdout/stderr as well as file if specified in configuration.
9277

93-
On first startup you may need to authorize Spotify by visiting the callback URL (which can also be accessed from the status page). Visit the status page above to find the applicable link to trigger this.
78+
On first startup you may need to authorize Spotify and/or Last.fm by visiting the callback URL (which can also be accessed from the status page). Visit the status page above to find the applicable link to trigger this.
79+
80+
## Help/FAQ
81+
82+
Having issues with connections or configuration? Check the [FAQ](/docs/FAQ.md) before creating an issue!
9483

9584
## License
9685

apis/AbstractApiClient.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

config/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
These are **example configurations** for all Source/Client types and AIO config.
2+
3+
These can be used as-is by renaming them to `.json` and filling or replacing sample data.
4+
5+
For docker installations these examples are copied to your configuration directory on first-time use.
6+
7+
These are **NOT** exhaustive examples. You should consult the **configuration** documentation and the **schema explorer links** for each source/config type to see a complete list of options and descriptions for all properties.
8+
9+
Documentation at
10+
11+
* [internal docs](/docs/configuration.md)
12+
* External Link: https://github.com/FoxxMD/multi-scrobbler/blob/master/docs/configuration.md

config/config.json.example

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
{
22
"sourceDefaults": {
3-
"maxPollRetries": 0, // optional, default # of automatic polling restarts on error. can be overridden by property in individual config
4-
"maxRequestRetries": 1, // optional, default # of http request retries a source can make before error is thrown. can be overridden by property in individual config
5-
"retryMultiplier": 1.5, // optional, default retry delay multiplier (retry attempt * multiplier = # of seconds to wait before retrying). can be overridden by property in individual config
3+
"maxPollRetries": 0,
4+
"maxRequestRetries": 1,
5+
"retryMultiplier": 1.5
66
},
77
"clientDefaults": {
8-
"maxRequestRetries": 1, // optional, default # of http request retries a client can make before error is thrown. can be overridden by property in individual config
9-
"retryMultiplier": 1.5, // optional, default retry delay multiplier (retry attempt * multiplier = # of seconds to wait before retrying). can be overridden by property in individual config
8+
"maxRequestRetries": 1,
9+
"retryMultiplier": 1.5
1010
},
1111
"sources": [
1212
{
13-
"type": "spotify", // required, source type
14-
"clients": ["myConfig"], // optional, a list of Client config names this Source should scrobble to. Using an empty list or not including this property will make this Source scrobble to all Clients.
15-
"name": "mySpotifySource", // optional, friendly name for the log
16-
"data": { // required, the data for your config
17-
"clientId": "example",
18-
//...
13+
"type": "spotify",
14+
"clients": ["myConfig"],
15+
"name": "mySpotifySource",
16+
"data": {
17+
"clientId": "a89cba1569901a0671d5a9875fed4be1",
18+
"clientSecret": "ec42e09d5ae0ee0f0816ca151008412a",
19+
"redirectUri": "http://localhost:9078/callback"
1920
}
2021
}
2122
],
2223
"clients": [
2324
{
24-
"type": "maloja", // required, Client type
25-
"name": "myConfig", // required, a name to identifier your Client
26-
"data": { // required, the data for your config
27-
"url": "http://example.com",
28-
//...
25+
"type": "maloja",
26+
"name": "myConfig",
27+
"data": {
28+
"url": "http://localhost:42010",
29+
"apiKey": "myMalojaKey"
2930
}
30-
},
31+
}
3132
]
3233
}

config/deezer.json.example

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
[
22
{
33
"name": "FoxxMDeezer",
4-
"clients": [], // optional, list of scrobble clients (by config name) that this source should scrobble to. Using an empty list or not including this property will make this source scrobble to all clients.
4+
"clients": [],
55
"data": {
6-
"clientId": "string", // deezer APPLICATION ID -- required if not providing access token
7-
"clientSecret": "string", // deezer SECRET KEY -- required if not providing access token
8-
"accessToken": "string", // deezer access token -- required if not providing client id/secret
9-
"redirectUri": "http://localhost:9078/deezer/callback",// deezer redirect URI -- required only if not the default shown here. URI must end in "deezer/callback"
10-
"interval": 60, // optional, how long to wait before calling spotify for new tracks
11-
// ALSO see config.json.example for default properties that can be overridden here (in sourceDefaults)
6+
"clientId": "a89cba1569901a0671d5a9875fed4be1",
7+
"clientSecret": "ec42e09d5ae0ee0f0816ca151008412a",
8+
"redirectUri": "http://localhost:9078/deezer/callback",
9+
"interval": 60
1210
}
1311
}
1412
]

0 commit comments

Comments
 (0)