Here is my code:
```
def rec youtube_live(ytid) =

        json = get_process_output("youtube-dl -j https://youtu.be/#{ytid}";)

        is_live = bool_of_string(string.trim(get_process_output("echo '#{json}' 
| jq '.is_live'")))

        if is_live == false then
                msg = "ERROR: The youtube id '#{ytid}' is not a live stream."
                log(msg)
                print(msg)
                # I want to exit this function here - dont know how to
        end

        url = string.trim(get_process_output("echo '#{json}' | jq '.formats | 
.[] | select(.format_id == \"93\") | .url'"))
        title = string.trim(get_process_output("echo '#{json}' | jq -r 
'.fulltitle'"))
        uploader = string.trim(get_process_output("echo '#{json}' | jq -r 
'.uploader'"))

        
        def add_title(m)
                [("title","[YouTube] #{title}"),("artist","#{uploader}")]
        end
        
        video_source = gstreamer.hls(url)
        
        audio_source = drop_video(video_source)
        
        audio_source = map_metadata(strip=true, add_title, audio_source)
        
        fallback(track_sensitive=false, [audio_source, youtube_live(ytid)])
end

```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/763#issuecomment-489122803
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to