Open yutotakano opened 2 years ago
Since playYouTube
etc block until they're done playing, to pass back data upon start there needs to be an MVar or something..... which could make the interface very very clunky. I'm imagining things like:
playYouTubeWith'
:: String -- The name of the FFmpeg executable
-> (String -> [String]) -- The arguments to pass to FFmpeg
-> String -- The name of the youtube-dl executable
-> String -- The search query (or video URL)
-> MVar YouTubeData -- filled in with youtube-dl metadata upon playing
-> ConduitT ByteString ByteString (ResourceT DiscordHandler) () -- Any processing that needs to be done on the audio data
-> Voice ()
To read from the MVar, there needs to be a new forked thread..., and all-in-all it's not a good solution.
Still in search for a different method.
With the V2.4.0 redesign of play
to take an AudioResource
, and createYoutubeResource
to return an AudioResource
, we can now embed the audio's metadata within that datatype.
When using youtube-dl, look into exposing the current playing audio's metadata, such as title/artist. Should it make the result of
--dump-json
available somehow upon playing? Or a separate getMetadata function?