Skip to content

Commit 0fed96f

Browse files
committed
Merge branch 'develop'
2 parents 4fdd346 + 8369939 commit 0fed96f

26 files changed

+2197
-139
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ A javascript app to scrobble music you listened to, to [Maloja](https://github.c
2828
* [Google Cast (Chromecast)](https://foxxmd.github.io/multi-scrobbler/docs/configuration#google-cast-chromecast)
2929
* [Musikcube](https://foxxmd.github.io/multi-scrobbler/docs/configuration#muikcube)
3030
* [MPD (Music Player Daemon)](https://foxxmd.github.io/multi-scrobbler/docs/configuration#mpd-music-player-daemon)
31+
* [VLC](https://foxxmd.github.io/multi-scrobbler/docs/configuration#vlc)
3132
* Supports scrobbling to many **Clients**
3233
* [Maloja](https://foxxmd.github.io/multi-scrobbler/docs/configuration#maloja)
3334
* [Last.fm](https://foxxmd.github.io/multi-scrobbler/docs/configuration#lastfm)

config/vlc.json.example

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"enable": true,
4+
"name": "MyVlc",
5+
"data": {
6+
"url": "localhost:8080",
7+
"password": "changeme"
8+
}
9+
}
10+
]

docsite/docs/FAQ.md

+4
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,7 @@ My Artist - Example Track has 'movie' media type so will not track
177177
```
178178

179179
Refer to [Force Media Tracking](configuration/configuration.mdx#forcing-media-tracking) section to fix this
180+
181+
### VLC is not scrobbling fields correctly
182+
183+
Before reporting an issue turn on metadata logging in the MS VLC configuration, [see the VLC documentation.](configuration/configuration.mdx#vlc-information-reporting)

docsite/docs/configuration/configuration.mdx

+113
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import SubsonicConfig from '!!raw-loader!../../../config/subsonic.json.example';
2828
import TautulliConfig from '!!raw-loader!../../../config/tautulli.json.example';
2929
import WebscrobblerConfig from '!!raw-loader!../../../config/webscrobbler.json.example';
3030
import YTMusicConfig from '!!raw-loader!../../../config/ytmusic.json.example';
31+
import VLCConfig from '!!raw-loader!../../../config/vlc.json.example';
3132

3233
# Configuration
3334

@@ -1317,6 +1318,118 @@ port "6600"
13171318
</TabItem>
13181319
</Tabs>
13191320

1321+
### [VLC](https://www.videolan.org/vlc/)
1322+
1323+
MS communicates with VLC using the [Web (`http`) interface module](https://wiki.videolan.org/VLC_HTTP_requests/)
1324+
1325+
#### Enable HTTP Interface
1326+
1327+
Open VLC:
1328+
1329+
* **Tools** Menu -> Preferences
1330+
* In the bottom left change **Show Settings** from `Simple` to `All`
1331+
* In the updated window select `Interface -> Main interfaces`
1332+
* In the **Extra interface modules** section enable **Web** and verify that `http` is shown in the textbox
1333+
* Select `Interface -> Main interfaces -> Lua`
1334+
* In Lua HTTP -> Password -> set a password in this box
1335+
* Click **Save** at the bottom to persist your changes
1336+
* Restart VLC
1337+
* Verify the HTTP interface is accessible by navigating to `http://localhost:8080` in your browser
1338+
1339+
If the interface is accessible, after typing in your password, VLC is now ready to be used by MS.
1340+
1341+
##### Setting VLC Interface and Port
1342+
1343+
These can be set by starting VLC from command line with specific options:
1344+
1345+
* `vlc --http-host yourHostIp:yourPort` or
1346+
* `vlc --http-port yourPort` or
1347+
* modify the configuration file for VLC by editing keys with the same values as from the command line (`http-host` and `http-port`)
1348+
1349+
1350+
#### Configuration
1351+
1352+
<Tabs groupId="configType" queryString>
1353+
<TabItem value="env" label="ENV">
1354+
| Environmental Variable | Required? | Default | Description |
1355+
|------------------------|------------|------------------|-------------|
1356+
| `VLC_URL` | No | `localhost:8080` | |
1357+
| `VLC_PASSWORD` | Yes | | |
1358+
</TabItem>
1359+
<TabItem value="file" label="File">
1360+
<details>
1361+
1362+
<summary>Example</summary>
1363+
1364+
<CodeBlock title="CONFIG_DIR/vlc.json" language="json5">{VLCConfig}</CodeBlock>
1365+
1366+
</details>
1367+
1368+
or <SchemaLink lower objectName="VLCSourceConfig"/>
1369+
</TabItem>
1370+
<TabItem value="aio" label="AIO">
1371+
<details>
1372+
1373+
<summary>Example</summary>
1374+
1375+
<AIOExample data={VLCConfig} name="vlc"/>
1376+
1377+
</details>
1378+
1379+
or <SchemaLink lower objectName="VLCSourceConfig"/>
1380+
</TabItem>
1381+
</Tabs>
1382+
1383+
#### Filename Parsing
1384+
1385+
If the file being played in VLC does not have ID3 tags/metadata information multi-scrobbler can attempt to extract artist, title, and album information from the raw filename using regular expressions. Mutli-scrobbler will only do this if there is **no other information** reported by VLC about these fields.
1386+
1387+
To extract this information use [named capture groups](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Named_capturing_group) in your expression matching the field that should be extracted: `artist` `title` and/or `album`. MS accepts multiple expressions, the first one that matches a filename will be used.
1388+
1389+
<!-- Would like to put this in a <details> node but the <> in the named capture groups are causing the parser to incorrectly parse them as an actual tag -->
1390+
1391+
Example usage in [a file-based config:](./configuration?configType=file#webscrobbler-config)
1392+
1393+
```json5 title="config/vlc.json" {10-15}
1394+
[
1395+
{
1396+
"name": "MyVlc",
1397+
"enable": true,
1398+
"data": {
1399+
// ...
1400+
},
1401+
"options": {
1402+
"filenamePatterns": [
1403+
// Extracts artist and title from filenames that look like:
1404+
// My Artist - My Cool title.mp4
1405+
"/^\\s*(?<artist>.+?) - (?<title>.+?)\\.\\w+$/i"
1406+
],
1407+
// logs to DEBUG when MS tries to extract data from a filename
1408+
"logFilenamePatterns": true,
1409+
}
1410+
}
1411+
]
1412+
```
1413+
1414+
#### Vlc Information Reporting
1415+
1416+
If you find that VLC is incorrectly reporting track information (in its interface) but multi-scrobbler is not parsing it correctly it may be due to the _name_ of the fields VLC is reporting. mutli-scrobbler uses the most common field name but does not cover all use cases. Before reporting an issue please turn on metadata logging and include output from your logs while it is turned on:
1417+
1418+
```json5 title="config/vlc.json" {9-9}
1419+
[
1420+
{
1421+
"name": "MyVlc",
1422+
"enable": true,
1423+
"data": {
1424+
// ...
1425+
},
1426+
"options": {
1427+
"dumpVlcMetadata": true
1428+
}
1429+
}
1430+
]
1431+
```
1432+
13201433
## Client Configurations
13211434

13221435
### [Maloja](https://github.com/krateng/maloja)

docsite/src/pages/index.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ A javascript app to scrobble music you listened to, to [Maloja](https://github.c
2929
* [Google Cast (Chromecast)](docs/configuration#google-cast-chromecast)
3030
* [Musikcube](docs/configuration#musikcube)
3131
* [MPD (Music Player Daemon)](docs/configuration#mpd-music-player-daemon)
32+
* [VLC](docs/configuration#vlc)
3233
* Supports scrobbling to many **Clients**
3334
* [Maloja](docs/configuration#maloja)
3435
* [Last.fm](docs/configuration#lastfm)

package-lock.json

+44-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"description": "scrobble plays from multiple sources to multiple clients",
66
"scripts": {
77
"schema": "npm run -s schema-aio & npm run -s schema-source & npm run -s schema-client & npm run -s schema-aiosource & npm run -s schema-aioclient",
8-
"schema-client": "typescript-json-schema src/backend/tsconfig.json ClientConfig --out src/backend/common/schema/client.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage",
9-
"schema-source": "typescript-json-schema src/backend/tsconfig.json SourceConfig --out src/backend/common/schema/source.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage",
10-
"schema-aio": "typescript-json-schema src/backend/tsconfig.json AIOConfig --out src/backend/common/schema/aio.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage",
11-
"schema-aiosource": "typescript-json-schema src/backend/tsconfig.json AIOSourceConfig --out src/backend/common/schema/aio-source.json --titles --required --tsNodeRegister --refs --validationKeywords deprecationMessage",
12-
"schema-aioclient": "typescript-json-schema src/backend/tsconfig.json AIOClientConfig --out src/backend/common/schema/aio-client.json --titles --required --tsNodeRegister --refs --validationKeywords deprecationMessage",
8+
"schema-client": "typescript-json-schema src/backend/tsconfig.json ClientConfig --out src/backend/common/schema/client.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage --constAsEnum",
9+
"schema-source": "typescript-json-schema src/backend/tsconfig.json SourceConfig --out src/backend/common/schema/source.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage --constAsEnum",
10+
"schema-aio": "typescript-json-schema src/backend/tsconfig.json AIOConfig --out src/backend/common/schema/aio.json --required --titles --tsNodeRegister --refs --validationKeywords deprecationMessage --constAsEnum",
11+
"schema-aiosource": "typescript-json-schema src/backend/tsconfig.json AIOSourceConfig --out src/backend/common/schema/aio-source.json --titles --required --tsNodeRegister --refs --validationKeywords deprecationMessage --constAsEnum",
12+
"schema-aioclient": "typescript-json-schema src/backend/tsconfig.json AIOClientConfig --out src/backend/common/schema/aio-client.json --titles --required --tsNodeRegister --refs --validationKeywords deprecationMessage --constAsEnum",
1313
"circular": "madge --circular --extensions ts src/index.ts",
1414
"test": "npm run -s test:backend",
1515
"test:backend": "mocha --reporter spec --recursive src/backend/tests/**/*.test.ts",
@@ -108,6 +108,7 @@
108108
"toad-scheduler": "^3.0.0",
109109
"tsx": "^4.7.0",
110110
"vite-express": "^0.16.0",
111+
"vlc-client": "^1.1.1",
111112
"xml2js": "0.5.0",
112113
"youtube-music-ts-api": "^1.7.0"
113114
},
@@ -153,7 +154,7 @@
153154
"ts-essentials": "^9.1.2",
154155
"typescript": "^5.3.3",
155156
"typescript-eslint": "^7.0.1",
156-
"typescript-json-schema": "~0.55",
157+
"typescript-json-schema": "^0.61.0",
157158
"vite": "^5.2.12"
158159
},
159160
"browserslist": {

patches/typescript-json-schema+0.55.0.patch

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/typescript-json-schema/dist/typescript-json-schema.js b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
2+
index 5b5ecec..1e48e77 100644
3+
--- a/node_modules/typescript-json-schema/dist/typescript-json-schema.js
4+
+++ b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
5+
@@ -55,7 +55,7 @@ var crypto_1 = require("crypto");
6+
var ts = require("typescript");
7+
var path_equal_1 = require("path-equal");
8+
var vm = require("vm");
9+
-var REGEX_FILE_NAME_OR_SPACE = /(\bimport\(".*?"\)|".*?")\.| /g;
10+
+var REGEX_FILE_NAME_OR_SPACE = /(\bimport\(".*?"(, \{ assert: \{ "resolution-mode": "(import|require)" \} \})?\)|".*?")\.| /g;// /(\bimport\(".*?"\)|".*?")\.| /g;
11+
var REGEX_TSCONFIG_NAME = /^.*\.json$/;
12+
var REGEX_TJS_JSDOC = /^-([\w]+)\s+(\S|\S[\s\S]*\S)\s*$/g;
13+
var REGEX_GROUP_JSDOC = /^[.]?([\w]+)\s+(\S|\S[\s\S]*\S)\s*$/g;

src/backend/common/infrastructure/Atomic.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export type SourceType =
2424
| 'webscrobbler'
2525
| 'chromecast'
2626
| 'musikcube'
27-
| 'mpd';
27+
| 'mpd'
28+
| 'vlc';
2829

2930
export const sourceTypes: SourceType[] = [
3031
'spotify',
@@ -43,7 +44,8 @@ export const sourceTypes: SourceType[] = [
4344
'webscrobbler',
4445
'chromecast',
4546
'musikcube',
46-
'mpd'
47+
'mpd',
48+
'vlc'
4749
];
4850

4951
export const lowGranularitySources: SourceType[] = ['subsonic', 'ytmusic'];

0 commit comments

Comments
 (0)