blob: 719958c331d9661ecd393f2517a458ab96bd1c0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# We can get media_content_id from kodi web interface on port 8080
play_playlist:
alias: Play PlayList
description: Send one of pre-generated playlists to media player
fields:
media_player:
name: Media Player
description: "Media Player"
required: true
selector:
entity:
domain: media_player
volume:
name: Volume
description: "Audio Volume: 0 - 1"
default: 0.7
selector:
number:
min: 0
max: 1
step: 0.05
playlist:
name: Playlist
description: "PlayList to play"
default: darksoft
selector:
select:
options:
- label: DarkSoft Collections
value: darksoft
- label: Asgard Music
value: asgard
- label: Asgard Downloads
value: downloads
- label: Custom
value: custom
custom:
name: Custom
description: "Location of custom playlist"
default: []
selector:
media:
variables:
subfolders: [ "Best", "French", "Russian", "Armenian", "Slavic", "Power", "Irish", "Instrumental" ]
current: 'input_number.smartpi_playlist'
vol: '{{ volume | default(0.7) | float }}'
list: '{{ playlist | default("darksoft") }}'
mode: single
sequence:
- alias: Turn on player
service: media_player.turn_on
target:
entity_id: '{{ media_player }}'
- service: media_player.volume_set
data:
volume_level: '{{ vol }}'
target:
entity_id: '{{ media_player }}'
- choose:
- conditions:
- condition: template
value_template: '{{ list == "darksoft" }}'
sequence:
- if:
- condition: template
value_template: '{{ states(current) | float >= (subfolders | length) }}'
then:
- service: input_number.set_value
data:
value: 0
target:
entity_id: '{{ current }}'
- alias: Iterate Darksoft Playlists
service: media_player.play_media
target:
entity_id:
- '{{ media_player }}'
data:
media_content_type: DIRECTORY
enqueue: play
media_content_id: '{{ "/home/csa/Music/" + subfolders[states(current) | int] }}'
- service: input_number.increment
target:
entity_id: '{{ current }}'
- conditions:
- condition: template
value_template: '{{ list == "asgard" }}'
sequence:
- alias: Play Asgard Music
service: media_player.play_media
target:
entity_id:
- '{{ media_player }}'
data:
media_content_type: DIRECTORY
enqueue: play
media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%246%243/"
- conditions:
- condition: template
value_template: '{{ list == "download" }}'
sequence:
- alias: Play Asgard Downloads
service: media_player.play_media
target:
entity_id:
- '{{ media_player }}'
data:
media_content_type: DIRECTORY
enqueue: play
media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%241%240/"
- conditions:
- condition: template
value_template: '{{ list == "custom" }}'
sequence:
- alias: Play Asgard Downloads
service: media_player.play_media
target:
entity_id:
- '{{ media_player }}'
data: '{{ custom }}'
- service: media_player.shuffle_set
data:
shuffle: true
target:
entity_id: '{{ media_player }}'
- service: media_player.repeat_set
data:
repeat: true
target:
entity_id: '{{ media_player }}'
|