Devlog – SoundCloud upload is back!

As some of you may have noticed, for awhile now, the MVGEN SoundCloud functionality wasn’t working. There were other things going on at the time that took up our time. One of our team has moved cross country. I recently got a new dayjob that’s been taken some time to straighten out schedule-wise. And also to get the day to day routine down. 

But suddenly one day in the last 4 or 5 months SoundCloud stopped working. There was much hand-wringing and gnashing of teeth at the prospect. It was mystifying, we didn’t know what might have changed and I at the time didn’t have the mental bandwidth to think about it, as I mentioned, other things were going on.

We did get some good error message feedback, which is always the starting point in an issue like this. At first blush, it appeared to be a upload tool version issue. But that wasn’t it. Then, I thought maybe the URLs we were using weren’t escaped or typed in correctly, that wasn’t the issue either. Finally, I capitulated and went with the prevailing wisdom (began to agree with John that the issue was with the version of Python running on the server). We went around the bush a couple times trying to get Python updated, installing mod_wsgi into Apache so that it would accept Python apps and serve them to the web.

This created a whole different suite of issues. Mainly, I inadvertently knocked out PHP when attempting to get mod_wsgi installed and configured. Then, we had more issues with a daemon that everyone forgot about until the last minute that was breaking the video creation step. Finally, we got that fixed – all of which took the better part of Sunday – and then I looked at the SoundCloud issue again with fresh eyes. I started to put the youtube-dl tool through the paces. Every time it errored it gave a recommendation: “see the youtube-dl –help for more details.”

I checked through this and found a way to enter username and password info, and some other interesting tidbits that allow you to ***. None of this really helped though. So I took to Stack Overflow. And yes, maybe I should have looked there first but when troubleshooting one must move systematically. I quickly found an article that explains how to use the SoundCloud API to download a song by the track ID. And there it was, the crack of sunlight shot through the end of the tunnel. I could taste the beginning of the fix coming, and it would be sooner not later.

So after some clicks and copy-pasting I got a API URL with the track ID in it. I plugged that into youtube-dl et voila! No more SSLv3 error message, in fact there was no error message at all, the mp3 downloaded and the verbosity of the output told me it was the song I wanted and the correct artist name and track name. Halleluyer! This was it, this was the workaround, and no Python upgrade necessary! And let me talk about that a bit too.

Updating Python outside of what comes with the OS is a HEAD ACHE. I don’t recommend it, in fact virtualenvs exist seemingly, solely for the purpose of being able to run another version of Python alongside the system version without clobbering installations. Even if you get a 2nd Python version running you have to reinstall ALL of your modules and dependencies. Along with this being a waste of space, it’s just bad because what if something gets crossed up in the process? Bad scene for business.

At any rate, since I got the API track ID working with youtube-dl it was only a matter of adjusting our backend code a bit to work. This is where John valiantly jumped in and saved the day. In a matter of a few hours he’d coded the workaround into our main branch and suddenly SoundCloud upload was working again!

It’s been a long time coming, and we learned a lot in this process. Much of it had to do with patience and tenacity and good old fashioned troubleshooting the latter of which seems to be a skill I’ve done well to master over the years. 

Enjoy SoundCloud upload everyone!

Happy Generating

Leave a Reply

Your email address will not be published. Required fields are marked *