blob: 7b3acff8b99cea3b0a16eac52b6f7e5a89eae8f8 (
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# 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: restart
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 }}'
# - delay:
# seconds: 5
- service: media_player.shuffle_set
data:
shuffle: true
entity_id: '{{ media_player }}'
# - service: media_player.repeat_set
# data:
# repeat: all
# entity_id: '{{ media_player }}'
- 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/"
# - delay:
# seconds: 5
- service: media_player.shuffle_set
data:
shuffle: true
entity_id: '{{ media_player }}'
# - service: media_player.repeat_set
# data:
# repeat: all
# entity_id: '{{ media_player }}'
- 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/"
# - delay:
# seconds: 5
- service: media_player.shuffle_set
data:
shuffle: false
entity_id: '{{ media_player }}'
# - service: media_player.repeat_set
# data:
# repeat: off
# entity_id: '{{ media_player }}'
- conditions:
- condition: template
value_template: '{{ list == "custom" }}'
sequence:
- alias: Play Asgard Downloads
service: media_player.play_media
target:
entity_id:
- '{{ media_player }}'
data: '{{ custom }}'
|