mumbledj
mumbledj copied to clipboard
Download the next song in advance
Hey there,
First, this is awesome. Second, I'm working on making a mumbledjkhaled bot which overlays a soundclip of "DJ KHALED!!" over some songs. Right now I've gotten it to work by adding code to the Download() function. Unfortunately this causes a delay while the audio is processed. I think the solution is to start downloading/processing the next song ahead of time.
Do you have any recommendations on where/how to implement this? This is my first time working with Go, so I don't have a super clear understanding of the code base.
Thanks, Hpincket
Actually it might be better to add the "DJ KHALED" shoutout before the song, then I don't have to do any audio encoding.
This is something that has been requested in the past and would definitely be a good thing to implement. In the current code base it is a bit difficult to accomplish this, but I have been working on a refactor for quite awhile now that will hopefully be cleaner and easier to implement things like this.
If you are planning on just playing the shoutout before each song, it may be beneficial to turn on caching as then it won't need to download the shoutout every time it is played.
I actually hacked this feature together in a separate fork https://github.com/RichardNysater/mumbledj However, I don't actually know anything about Go, so it's very possible that the method I've used is terrible for some reason.
So if you really need this feature right now, hpincket, you can use that fork. I can't make any guarantees for the correctness, performance or reliability apart from the fact that it has been working fine for my users, though :p.
(The download is made by using a waitgroup and executing "go addedSong.Download()" when a user adds a song if there is currently a song playing)