Skip to content

Commit

Permalink
feat(config): Implement property to control whether a source/client i…
Browse files Browse the repository at this point in the history
…s used

* QoL improvement -- Instead of needing to rename a config file so it is not read by MS a user can now use the 'enable' property in all source/client configs to enable or disable loading the config
* Added property to all config examples
  • Loading branch information
FoxxMD committed Sep 20, 2023
1 parent 860d2d9 commit ac2d453
Show file tree
Hide file tree
Showing 23 changed files with 469 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"sources": [
{
"type": "spotify",
"enable": true,
"clients": ["myConfig"],
"name": "mySpotifySource",
"data": {
Expand All @@ -33,6 +34,7 @@
"clients": [
{
"type": "maloja",
"enable": true,
"name": "myConfig",
"data": {
"url": "http://localhost:42010",
Expand Down
1 change: 1 addition & 0 deletions config/deezer.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "FoxxMDeezer",
"enable": true,
"clients": [],
"data": {
"clientId": "a89cba1569901a0671d5a9875fed4be1",
Expand Down
1 change: 1 addition & 0 deletions config/jellyfin.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyJellyfin",
"enable": true,
"clients": [],
"data": {
"users": ["FoxxMD"],
Expand Down
1 change: 1 addition & 0 deletions config/jriver.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyJriver",
"enable": true,
"data": {
"url": "0.0.0.0",
"username": "auser",
Expand Down
1 change: 1 addition & 0 deletions config/kodi.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyKodi",
"enable": true,
"data": {
"url": "http://localhost:8080/jsonrpc",
"username": "myUser",
Expand Down
1 change: 1 addition & 0 deletions config/lastfm.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "myLastFm",
"enable": true,
"configureAs": "client",
"data": {
"apiKey": "a89cba1569901a0671d5a9875fed4be1",
Expand Down
1 change: 1 addition & 0 deletions config/listenbrainz.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "brainz",
"enable": true,
"configureAs": "client",
"data": {
"token": "029b081ba-9156-4pe7-88e5-3be671f5ea2b",
Expand Down
1 change: 1 addition & 0 deletions config/maloja.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "myMaloja",
"enable": true,
"data": {
"url": "http://localhost:42010",
"apiKey": "myMalojaKey"
Expand Down
1 change: 1 addition & 0 deletions config/mopidy.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyMopidy",
"enable": true,
"data": {
"url": "localhost",
"uriBlacklist": [],
Expand Down
1 change: 1 addition & 0 deletions config/mpris.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "ubuntu",
"enable": true,
"data": {
"whitelist": ["vlc", "mpd"],
"blacklist": ["spotify"]
Expand Down
1 change: 1 addition & 0 deletions config/plex.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyPlex",
"enable": true,
"clients": [],
"data": {
"user": ["[email protected]","[email protected]"],
Expand Down
1 change: 1 addition & 0 deletions config/spotify.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MySpotify",
"enable": true,
"clients": [],
"data": {
"clientId": "a89cba1569901a0671d5a9875fed4be1",
Expand Down
1 change: 1 addition & 0 deletions config/subsonic.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MySubsonic",
"enable": true,
"data": {
"url": "http://localhost:4040/airsonic",
"user": "yourUser",
Expand Down
1 change: 1 addition & 0 deletions config/tautulli.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyTautuilli",
"enable": true,
"clients": [],
"data": {
"user": ["[email protected]","[email protected]"],
Expand Down
1 change: 1 addition & 0 deletions config/ytmusic.json.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"name": "MyYTMusic",
"enable": true,
"clients": [],
"data": {
"cookie": "VISITOR_INFO1_LIVE=jMDXz2_L8rY; __Secure-3PAPISID=3AxsXpSXGqOInSDn1jEKn; DEVICE_INFO=ChxOekU0TmTBpjek5EWZ0G; YSC=7gZdl3Zdl3; SID=TwhNsaZRXYTAtXxzGyu6rZdpg2HvGROeW8J4Ym_FhkhoZMUYEQ.; __Secure-1PSID=TwhNOsaZRXYTyRBe4rxAtXRIKsIEtk_Qot2VLBNfHQrQ.; __Secure-3PSID=ZRXYTAtXRIKsIEtk_Qot2yRBerZdpg2HvvZRXYTAtXRIKsIEtk_Qot2yRBerkuZICFQ.; HSID=A1UMmELW79; SSID=AKhomOs; APISID=IlHHmuzkPdQzZZDhHn3; SAPISID=3AxsXpy0u75Qb/n1jEKn; __Secure-1PAPISID=3AxsXpQb/AkSDn1jEKn; LOGIN_INFO=AFmP6vFpyVCZZAIgDwbkhWMBBhluaIWAPP:QUQ314UW5NWMjNmd2ZUJnYnJsakdIMjZoaE5zVVMjNmd2ZZUiHRlb3ZlV3ZIcUVyRVIMjNmdjNmd2ZZUivYlNqX2ZNZUiHdUNFNFdaYmJIW1NkJRX3hqdlU2YnFESkFuSS1uTldnZVRmLXNjWFc5OUJuR3dTd3JsZGZYa2EtZFQ2a0k2Ry1KQQ==; PREF=volume=26; SIDCC=AFvI_94PxXwls-ndqpGfPgFX3FWj80y_94PxXwls-ndqfSh15sP; __Secure-1PSIDCC=AFvIBnUbRr96I96UCIp2U4T8HRVk2B0HfKzhzxwsiP; __Secure-3PSIDCC=AFvIB3bINuUN0ETDR9gO91wpwWIVmpGki3BxT3bINuUN0ETDR9gO91wCH",
Expand Down
7 changes: 7 additions & 0 deletions src/backend/common/infrastructure/config/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
export interface CommonConfig {
name?: string
data?: CommonData
/**
* Should MS use this client/source? Defaults to true
*
* @default true
* @examples [true]
* */
enable?: boolean
}

export interface CommonData {
Expand Down
27 changes: 27 additions & 0 deletions src/backend/common/schema/aio-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@
"description": "Specific data required to configure this client",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this client. Used with sources to restrict where scrobbles are sent.",
"examples": [
Expand Down Expand Up @@ -203,6 +212,15 @@
"description": "Specific data required to configure this client",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this client. Used with sources to restrict where scrobbles are sent.",
"examples": [
Expand Down Expand Up @@ -319,6 +337,15 @@
"description": "Specific data required to configure this client",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this client. Used with sources to restrict where scrobbles are sent.",
"examples": [
Expand Down
117 changes: 117 additions & 0 deletions src/backend/common/schema/aio-source.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
"$ref": "#/definitions/DeezerData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -265,6 +274,15 @@
"$ref": "#/definitions/JRiverData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -417,6 +435,15 @@
"$ref": "#/definitions/JellyData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -545,6 +572,15 @@
"$ref": "#/definitions/KodiData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -601,6 +637,15 @@
"$ref": "#/definitions/LastFmSourceData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -751,6 +796,15 @@
"$ref": "#/definitions/ListenBrainzSourceData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -965,6 +1019,15 @@
"$ref": "#/definitions/MPRISData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1111,6 +1174,15 @@
"$ref": "#/definitions/MopidyData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1155,6 +1227,15 @@
"$ref": "#/definitions/PlexSourceData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1424,6 +1505,15 @@
"$ref": "#/definitions/SpotifySourceData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1644,6 +1734,15 @@
"$ref": "#/definitions/SubsonicData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1688,6 +1787,15 @@
"$ref": "#/definitions/PlexSourceData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down Expand Up @@ -1808,6 +1916,15 @@
"$ref": "#/definitions/YTMusicData",
"title": "data"
},
"enable": {
"default": true,
"description": "Should MS use this client/source? Defaults to true",
"examples": [
true
],
"title": "enable",
"type": "boolean"
},
"name": {
"description": "Unique identifier for this source.",
"title": "name",
Expand Down
Loading

0 comments on commit ac2d453

Please sign in to comment.