Skip to content

Commit 5e905ea

Browse files
committed
Merge branch 'develop'
2 parents 7b0f580 + 7ebe73c commit 5e905ea

Some content is hidden

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

44 files changed

+1091
-276
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ config/*.json
1212
config/*.bak
1313
/docs
1414
/logs
15+
.flatpak-builder
16+
flatpak/generated-sources.json
17+
flatpak/.flatpak-builder

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,5 @@ src/**/**.js
125125
src/**/**.js.map
126126

127127
*.bak
128+
.flatpak-builder
129+
flatpak/generated-sources.json

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
[![Docker Pulls](https://img.shields.io/docker/pulls/foxxmd/multi-scrobbler)](https://hub.docker.com/r/foxxmd/multi-scrobbler)
66

7+
<img src="/assets/icon.png" align="right"
8+
alt="multi-scrobbler logo" width="180" height="180">
9+
710
A javascript app to scrobble music you listened to, to [Maloja](https://github.com/krateng/maloja), [Last.fm](https://www.last.fm), and [ListenBrainz](https://listenbrainz.org)
811

912
* Supports scrobbling from many **Sources**
@@ -28,7 +31,7 @@ A javascript app to scrobble music you listened to, to [Maloja](https://github.c
2831
* Web server interface for stats, basic control, and detailed logs
2932
* Smart handling of credentials (persistent, authorization through app)
3033
* Easy configuration through ENVs or JSON
31-
* Docker images for x86/ARM
34+
* Install using [Docker images for x86/ARM](/docs/installation.md#docker), [flatpak](/docs/installation.md#flatpak), or [locally with NodeJS](/docs/installation.md#nodejs)
3235

3336
**Why should I use this over a browser extension and/or mobile app scrobbler?**
3437

assets/icon.png

4.21 KB
Loading

assets/icon.svg

+12
Loading

docs/installation.md

+39-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Installation
22

3-
## Local
3+
# Local
4+
5+
After installation see [service.md](/docs/service.md) to configure multi-scrobbler to run automatically in the background.
6+
7+
## Nodejs
48

59
Clone this repository somewhere and then install from the working directory
610

7-
```bash
11+
```shell
812
git clone https://github.com/FoxxMD/multi-scrobbler.git .
913
cd multi-scrobbler
1014
nvm use # optional, to set correct Node version
@@ -13,23 +17,49 @@ npm build
1317
npm start
1418
```
1519

16-
### Local Usage Examples
20+
### Usage Examples
1721

1822
* The web UI is served on port `9078`. This can be modified using the `PORT` environmental variable.
1923

2024
#### Using [file-based](/docs/configuration.md#file-based-configuration) configuration
2125

22-
```bash
26+
```shell
2327
npm start
2428
```
2529

2630
#### Using [env-based](/docs/configuration.md#env-based-configuration) configuration
2731

28-
```bash
32+
```shell
2933
SPOTIFY_CLIENT_ID=yourId SPOTIFY_CLIENT_SECRET=yourSecret MALOJA_URL="http://domain.tld" node src/index.js
3034
```
3135

32-
## [Docker](https://hub.docker.com/r/foxxmd/multi-scrobbler)
36+
## Flatpak
37+
38+
You must have [Flatpak](https://flatpak.org/) installed on your system.
39+
40+
```shell
41+
flatpak install flathub io.github.foxxmd.multiscrobbler
42+
```
43+
44+
### Usage Examples
45+
46+
#### Using [file-based](/docs/configuration.md#file-based-configuration) configuration
47+
48+
The config directory for multi-scrobbler as a flatpak can be found under `/home/YourUser/.var/app/io.github.foxxmd.multiscrobbler/config`
49+
50+
```shell
51+
flatpak run io.github.multiscrobbler
52+
```
53+
54+
#### Using [env-based](/docs/configuration.md#env-based-configuration) configuration
55+
56+
There are a few [options for running flatpak applications with temporary or permanent environmental variables.](https://ardasevinc.dev/launch-flatpak-apps-with-custom-args-and-environment-variables)
57+
58+
```shell
59+
flatpak run --env=SPOTIFY_CLIENT_ID=yourId --envSPOTIFY_CLIENT_SECRET=yourSecret --env=MALOJA_URL="http://domain.tld" io.github.foxxmd.multiscrobbler
60+
```
61+
62+
# [Docker](https://hub.docker.com/r/foxxmd/multi-scrobbler)
3363

3464
Cross-platform images are built for x86 (Intel/AMD) and ARM (IE Raspberry Pi)
3565

@@ -65,15 +95,15 @@ To get the UID and GID for the current user run these commands from a terminal:
6595
* `id -u` -- prints UID
6696
* `id -g` -- prints GID
6797

68-
### Docker Usage Examples
98+
## Docker Usage Examples
6999

70-
#### Using [env-based](/docs/configuration.md#env-based-configuration) configuration
100+
### Using [env-based](/docs/configuration.md#env-based-configuration) configuration
71101

72102
```bash
73103
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -e "PUID=1000" -e "PGID=1000" -p 9078:9078 -v /path/on/host/config:/config foxxmd/multi-scrobbler
74104
```
75105

76-
#### Using [file-based](/docs/configuration.md#file-based-configuration) configuration
106+
### Using [file-based](/docs/configuration.md#file-based-configuration) configuration
77107

78108
```bash
79109
docker run -e "PUID=1000" -e "PGID=1000" -p 9078:9078 -v /path/on/host/config:/config foxxmd/multi-scrobbler

docs/service.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
If you have multi-scrobbler installed [locally](/docs/installation.md#local) you can enable it to run as a background service when you login.
2+
3+
Before running as a service you should run it at least once in the foreground to ensure it can start up correctly!
4+
5+
# [Systemd](https://systemd.io/)
6+
7+
Systemd is system and service manager that is used by [most popular linux distros](https://en.wikipedia.org/wiki/Systemd#Adoption) including [Ubuntu](https://wiki.ubuntu.com/SystemdForUpstartUsers), [Fedora](https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/), Pop!_OS, [Debian](https://wiki.debian.org/systemd), and [Arch](https://wiki.archlinux.org/title/systemd).
8+
9+
This setup will create a [user service](https://wiki.archlinux.org/title/systemd/User) that runs on login.
10+
11+
## Create A Unit File
12+
13+
Create a new service file for multi-scrobbler under your HOME config:
14+
15+
```console
16+
mkdir -p ~/.config/systemd/user
17+
touch ~/.config/systemd/user/multi-scrobbler.service
18+
```
19+
20+
In a text editor add contents below to the file you created, `multi-scrobbler.service`:
21+
22+
```ini
23+
[Unit]
24+
Description=multi-scrobbler
25+
After=network.target
26+
27+
[Service]
28+
Type=simple
29+
ExecStart=flatpak run io.github.multiscrobbler
30+
Restart=no
31+
32+
[Install]
33+
WantedBy=default.target
34+
```
35+
36+
The above assumes you [installed multi-scrobbler using flatpak](/docs/installation.md#flatpak)
37+
38+
### Node.js Installs
39+
40+
If you are running multi-scrobbler directly with [nodejs from a clone repository directory](/docs/installation.md#nodejs) you should modify the `[Service]`:
41+
42+
```ini
43+
[Service]
44+
Type=simple
45+
WorkingDirectory=/path/to/multi-scrobbler/directory
46+
ExecStart=node src/index.js
47+
Restart=no
48+
```
49+
50+
## Start the Service
51+
52+
Save the file then run:
53+
54+
```console
55+
systemctl daemon-reload
56+
systemctl --user enable multi-scrobbler.service
57+
systemctl --user start multi-scrobbler.service
58+
```
59+
60+
This will
61+
62+
* scan for new services and pickup our multi-scrobbler user service
63+
* enable the service to run at login automatically
64+
* start the service now
65+
66+
# Other Service Methods
67+
68+
Open a PR if you would like to document setting up multi-scrobbler for other service managers!

flatpak/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
NOTE: This steps are for building the flatpak entirely locally, from source. If you want to install the application normally then [get it through flathub](/docs/installation.md#flatpak)
2+
3+
Flatpak build is a little convoluted until someone sets me straight...
4+
5+
# 1. Install Requirements
6+
7+
## Flatpak and flatpak-builder
8+
9+
Install [Flatpak](https://flatpak.org/setup/)
10+
11+
Install [flatpak-builder](https://docs.flatpak.org/en/latest/first-build.html#building-your-first-flatpak)
12+
13+
## [flatpak-node-generator](https://github.com/flatpak/flatpak-builder-tools/tree/master/node)
14+
15+
Requires python 3.7+, [pip](https://pip.pypa.io/en/stable/)/[pipx](https://pypa.github.io/pipx/)
16+
17+
# 2. Update Project source
18+
19+
Set the `branch` `tag` or `commit` to use for MS in the `git` source in [`io.github.foxxmd.multiscrobbler.yml`](/flatpak/io.github.foxxmd.multiscrobbler.yml)
20+
21+
# 3. Use `flatpak-node-generator` to generate sources
22+
23+
First, [make sure `node_modules` is deleted or empty.](https://github.com/flatpak/flatpak-builder-tools/issues/354#issuecomment-1478518442)
24+
25+
Then, from MS project root:
26+
27+
```
28+
flatpak-node-generator npm package-lock.json
29+
```
30+
31+
Move `generated-sources.json` into [`/flatpak`](/flatpak)
32+
33+
# 4. Build flatpak
34+
35+
From MS project root:
36+
37+
```console
38+
cd flatpak
39+
flatpak-builder --repo=/home/yourUser/multi-scrobbler-repo /home/yourUser/multi-scrobbler-build io.github.foxxmd.multiscrobbler.yml --force-clean
40+
```
41+
Add `--install --user` to have the app installed immediately.

flatpak/defaultConfig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"logging": {
3+
"file": false
4+
}
5+
}

flatpak/icon.png

4.21 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=multi-scrobbler
4+
Comment=Scrobbles music from multiple sources to multiple clients
5+
Icon=io.github.foxxmd.multiscrobbler
6+
TryExec=multiscrobbler
7+
Exec=multiscrobbler
8+
Terminal=true
9+
Categories=Utility;Music;ConsoleOnly;
10+
X-Flatpak=io.github.foxxmd.multiscrobbler
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="console-application">
3+
<id>io.github.foxxmd.multiscrobbler</id>
4+
<provides>
5+
<id>io.github.foxxmd.multiscrobbler.desktop</id>
6+
</provides>
7+
<launchable type="desktop-id">io.github.foxxmd.multiscrobbler.desktop</launchable>
8+
<name>multi-scrobbler</name>
9+
<summary>Scrobbles music from many sources to many clients</summary>
10+
<url type="homepage">https://github.com/FoxxMD/multi-scrobbler</url>
11+
<url type="help">https://github.com/FoxxMD/multi-scrobbler/blob/flatpak-clean/docs/configuration.md</url>
12+
<metadata_license>MIT</metadata_license>
13+
<project_license>MIT</project_license>
14+
<description>
15+
<p>
16+
Track your music listening history from many different sources:
17+
</p>
18+
<ul>
19+
<li>Spotify</li>
20+
<li>Plex (Tautulli)</li>
21+
<li>Any subsonic-based music player (Airsonic)</li>
22+
<li>Jellyfin</li>
23+
<li>Mopidy</li>
24+
<li>Deezer</li>
25+
<li>JRiver</li>
26+
<li>Kodi</li>
27+
<li>MPRIS (linux desktop)</li>
28+
</ul>
29+
<p>and consolidate your listens (scrobbles) into one or more scrobbling servers/services:</p>
30+
<ul>
31+
<li>Maloja</li>
32+
<li>Last.fm</li>
33+
<li>Listenbrainz</li>
34+
</ul>
35+
<p>multi-scrobbler requires some configuration before use. Please visit the website or help links below to get started.</p>
36+
</description>
37+
<screenshots>
38+
<screenshot type="default">
39+
<caption>Browser-based UI</caption>
40+
<image type="source">https://raw.githubusercontent.com/FoxxMD/multi-scrobbler/7b0f5801a1aa728986f440f4c67fe158cecd763d/assets/status-ui.jpg</image>
41+
</screenshot>
42+
</screenshots>
43+
<releases>
44+
<release version="0.4.4" date="2023-03-20"/>
45+
</releases>
46+
<categories>
47+
<category>Utility</category>
48+
<category>Music</category>
49+
<category>ConsoleOnly</category>
50+
</categories>
51+
<content_rating type="oars-1.0">
52+
<content_attribute id="language-profanity">mild</content_attribute>
53+
</content_rating>
54+
</component>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
app-id: io.github.foxxmd.multiscrobbler
2+
runtime: org.freedesktop.Platform
3+
runtime-version: '22.08'
4+
sdk: org.freedesktop.Sdk
5+
command: multiscrobbler
6+
finish-args:
7+
- --share=network
8+
# used for access to MPRIS in order to scrobble
9+
- --own-name=org.mpris.MediaPlayer2.*
10+
sdk-extensions:
11+
- org.freedesktop.Sdk.Extension.node18
12+
modules:
13+
- name: multiscrobbler
14+
buildsystem: simple
15+
build-options:
16+
append-path: /usr/lib/sdk/node18/bin
17+
env:
18+
XDG_CACHE_HOME: /run/build/multiscrobbler/flatpak-node/cache
19+
npm_config_cache: /run/build/multiscrobbler/flatpak-node/npm-cache
20+
npm_config_nodedir: /usr/lib/sdk/node18
21+
npm_config_offline: 'true'
22+
build-commands:
23+
# install npm dependencies
24+
- npm install --offline
25+
26+
# build app
27+
- npm run build
28+
29+
# makes node and npm available
30+
- mkdir -p /app/bin /app/lib /app/lib/src
31+
- cp -a /usr/lib/sdk/node18/bin/{node,npm} /app/bin
32+
- cp -a /usr/lib/sdk/node18/lib/* /app/lib
33+
- rm -r /app/lib/node_modules/npm/{docs,man}
34+
35+
# remove dev dependencies
36+
- npm prune --production
37+
38+
# copy node_modules needed to run app
39+
- cp -r node_modules/* /app/lib/node_modules
40+
41+
# delete typescript files (not needed for running app)
42+
- find src/ -name "*.ts" -type f -delete
43+
44+
# copy app files to runtime dir
45+
- cp -r src/* /app/lib/src
46+
- cp -r config /app/lib/config
47+
- cp flatpak/defaultConfig.json /app/lib/config/config.json
48+
49+
- install -Dm644 flatpak/${FLATPAK_ID}.desktop /app/share/applications/${FLATPAK_ID}.desktop
50+
- install -Dm644 flatpak/icon.png /app/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png
51+
- install -Dm644 flatpak/${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml
52+
53+
- install -Dm755 ../run.sh /app/bin/multiscrobbler
54+
subdir: main
55+
sources:
56+
- type: git
57+
url: https://github.com/FoxxMD/multi-scrobbler
58+
commit: 9a578e54a89f87c82ff811bb04257c9b641b199a
59+
dest: main
60+
# Wrapper to launch the app
61+
- type: script
62+
dest-filename: run.sh
63+
commands:
64+
# Run config check and copy examples + default config (disable file logging)
65+
- |
66+
echo -e "Checking CONFIG_DIR for existing configs: ${XDG_CONFIG_HOME}"
67+
if [ "$(ls -A ${XDG_CONFIG_HOME})" ]; then
68+
echo "Directory is not empty! Will not add default config/examples"
69+
else
70+
echo "Directory is empty! Adding default config/examples"
71+
cp -r /app/lib/config/. "${XDG_CONFIG_HOME}"/
72+
#cp /app/lib/defaultConfig.json $XDG_CONFIG_HOME/config.json
73+
fi
74+
- cd /app/lib && CONFIG_DIR=$XDG_CONFIG_HOME IS_LOCAL=true node src/index.js
75+
76+
- generated-sources.json

0 commit comments

Comments
 (0)