Skip to content

Commit 54fb0e4

Browse files
committed
Add userPresetsFile to config editor schema.
1 parent 6985d23 commit 54fb0e4

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

images/config_editor_presets.png

-519 KB
Binary file not shown.

images/config_editor_userpresets.png

527 KB
Loading

src/editor/userpreset-browser-editor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ const CONFIG_SETTINGS_SCHEMA = [
2121
required: false,
2222
type: 'string',
2323
},
24+
{
25+
name: 'userPresetsFile',
26+
label: 'File that contains user-defined preset items',
27+
help: 'e.g. "/local/spotifyplus/userpresets.json"',
28+
required: false,
29+
type: 'string',
30+
},
2431
{
2532
name: 'userPresetBrowserItemsPerRow',
2633
label: '# of items to display per row',

src/types/card-config.ts

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ export interface CardConfig extends LovelaceCardConfig {
574574
*/
575575
userPresetBrowserSubTitle?: string;
576576

577+
/**
578+
* File path to a collection of user-defined preset items that can be displayed in
579+
* various media browser displays. This allows the user to define their own custom
580+
* presets for Spotify favorites.
581+
*
582+
* See `userPresets` configuration item for file content format.
583+
*/
584+
userPresetsFile?: string;
585+
577586
/**
578587
* Number of items to display in a single row of the User Preset media browser section form.
579588
* Use a value of 1 to display the items as a vertical list.
@@ -593,6 +602,27 @@ export interface CardConfig extends LovelaceCardConfig {
593602
*/
594603
userPresetBrowserItemsHideSubTitle?: boolean;
595604

605+
/**
606+
* Collection of user-defined preset items that can be displayed in various media browser
607+
* displays. This allows the user to define their own custom presets along with device presets.
608+
*
609+
* This configuration data must be configured manually in the card configuration.
610+
* Some things to keep in mind when adding entries:
611+
* - attribute names are are CaSe-SeNsItIvE.
612+
*
613+
* See wiki dicumentation for more examples.
614+
*
615+
* Example:
616+
* userPresets:
617+
* - name: "Spotify Playlist Daily Mix 1"
618+
* subtitle: "Various Artists"
619+
* image_url: "https://dailymix-images.scdn.co/v2/img/ab6761610000e5ebcd3f796bd7ea49ed7615a550/1/en/default"
620+
* uri: "spotify:playlist:37i9dQZF1E39vTG3GurFPW"
621+
* type: "playlist"
622+
* - name: ...
623+
*/
624+
userPresets?: Array<IUserPreset>;
625+
596626
/**
597627
* Collection of custom imageUrl's that can be displayed in various media browser
598628
* displays. This allows the user to override the image that is supplied by the
@@ -619,34 +649,5 @@ export interface CardConfig extends LovelaceCardConfig {
619649
*/
620650
customImageUrls?: CustomImageUrls;
621651

622-
/**
623-
* Collection of user-defined preset items that can be displayed in various media browser
624-
* displays. This allows the user to define their own custom presets along with device presets.
625-
*
626-
* This configuration data must be configured manually in the card configuration.
627-
* Some things to keep in mind when adding entries:
628-
* - attribute names are are CaSe-SeNsItIvE.
629-
*
630-
* See wiki dicumentation for more examples.
631-
*
632-
* Example:
633-
* userPresets:
634-
* - name: "Spotify Playlist Daily Mix 1"
635-
* subtitle: "Various Artists"
636-
* image_url: "https://dailymix-images.scdn.co/v2/img/ab6761610000e5ebcd3f796bd7ea49ed7615a550/1/en/default"
637-
* uri: "spotify:playlist:37i9dQZF1E39vTG3GurFPW"
638-
* type: "playlist"
639-
* - name: ...
640-
*/
641-
userPresets?: Array<IUserPreset>;
642-
643-
/**
644-
* File path to a collection of user-defined preset items that can be displayed in various media browser
645-
* displays. This allows the user to define their own custom presets along with device presets.
646-
*
647-
* See `userPresets` configuration item for file content format.
648-
*/
649-
userPresetsFile?: string;
650-
651652
//imageUrlsReplaceHttpWithHttps?: boolean;
652653
}

0 commit comments

Comments
 (0)