This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

services.radio: add youtube_url to metadata

+15
+15
2configs/services/radio/radio.liq
··· 32 32 33 33 last_metadata = ref([]) 34 34 def on_metadata(m) = 35 + # Extract YouTube ID from filename and add youtube_url to metadata 36 + m = if list.assoc.mem("filename", m) then 37 + filename = list.assoc("filename", m) 38 + # Match filename with pattern: anything followed by 11 chars followed by .ogg 39 + matches = string.extract(pattern='.*(.{11})\\.ogg', filename) 40 + if list.length(matches) > 0 then 41 + youtube_id = list.nth(matches, 0) 42 + list.append(m, [("youtube_url", "https://youtu.be/#{youtube_id}")]) 43 + else 44 + m 45 + end 46 + else 47 + m 48 + end 49 + 35 50 last_metadata := m 36 51 print("changing tracks") 37 52 out = process.read(env["HOOK_TRACK_CHANGE"], env = m, timeout = 5.0)