Gheraoing the DJ counter 

Have you had to painstakingly put together a wonderful party only to be complained by your guests about the bad song selection by the DJ? If you haven’t your probably are lucky or simply haven’t organized an Indian party inviting Indians from wide vernaculars. I have always had to explain my audience to the DJ and how their diverse backgrounds translate to varied expectations. The slightest tilt in the playlist towards any regional music will immediately give rise to allegations of bias against the DJ towards. Or even when that doesn’t happen it’s simply hard to put a stop to people crowding the DJs well with song requests. 

A plausible solution

So it got me wondering if I could use technology to obtain song requests from the party goers in advance and hand them in to the DJ as favourites of the crowd. And then it would be reasonable for me to confront anybody who approaches the DJs counter with, ‘but you had the opportunity to submit your request earlier!’ 

The plan

First, I created a simple survey using Google forms to solicit song suggestions along with the YouTube link to it from my invitees, then I had the form embed on to my WordPress site.  Google forms allows this to be done very easily by generating an embedding link as we finish up the form.

I also needed a way to show the previous suggestions to all the invitees to avoid having them repeat existing recommendations. This is also quite easy with Google. I only had to locate the Google sheet in which the entries into the form were being collated within my Drive. And all I had to then do was simply open the sheet and navigate to file->share->publish to web and obtain the link to embed the document. I pasted both the embedding links to my site page and published it. Voila! Here is what visitors would now see when they visit the page.

No more arguing with tough unpleasant invitees gheraoing the DJ deck, who share the same bitter feeling with the DJ and the host. 

But wait! how does just collecting the recommendations solve the problem? And where is the part where we use Python? We will get to it just now. 

Python’s magic

Would you believe that you need no prior coding experience or even have Python installed locally on your machine to download the recommended songs from YouTube? Well that’s true. We can again take advantage of another Google service for developers and coding enthusiasts, the Google Colaboratory. You can type in your browser for Google Colab, open a new Colab notebook and within seconds you have your Python Jupyter notebook environment where you can install a few libraries and dependencies and script your way to download all the songs from the Google sheet capturing the entries to your Google form. 

Before you start coding, remember to upload the Google sheet in csv format with the songs and their YouTube links to your Google Colab workspace. And all you have to do next is simply copy paste the code below and execute the cell to have your list of songs downloaded in minutes. My csv file is named sample.csv. So update the code with the correct name of your csv file or simply rename your csv file to sample.csv and execute the code. Boom! within minutes you have your songs in mp4 format in your Google drive workspace.

pip install pytube
import csv
from pytube import YouTube
import os

with open('sample.csv') as file:      #the name of my csv file with the links is sample.csv
  reader = csv.reader(file)
  next(reader,None)
  for row in reader:
    dow = YouTube(f'{row[2]}').streams.filter(only_audio=True).first().download()
    os.rename(dow,f"row[1].replace(' ','-').mp4")
    

In just about 10 lines of code you have your long list of songs downloaded to your Google Colab workspace. Just remember to download the files to your hard drive before you close the session. But if you, your code will repeat the process for you again within minutes. 

Shopping Cart