The Experimentor

Experimenting ON Earth

Renaming files downloaded from the web automatically for better readability using Python

Today I downloaded an mp3 with url:

http://music.music.com.bd/Music/S/Sumon%20&%20Anila/Ekhon%20Ami/02%20-%20Sumon%20&%20Anila%20-%20Ekhon%20Ami%20[music.com.bd].mp3

So the downloaded file (downloaded with Multiget) has the name:

02%20-%20Sumon%20&%20Anila%20-%20Ekhon%20Ami%20[music.com.bd].mp3

But it’s awesome so I renamed it to:

02 – Sumon & Anila – Ekhon Ami [music.com.bd].mp3

Which looks much prettier. But as I continued to download more mp3s it felt
labourus to rename every single file that I download. So I thought about some
automation script. Batch file (Windows) / Shell script (Linux) would be good
enough but that would require me to manipulate the name string directly to replace
the %20s with spaces. Not a big deal but the name could contain things other
than %20s (spaces) . So a better solution, I thought, would be Python’s url decoder.
Here is a snapshot of the code from my favourite editor IDLE and also a download link to the python source file.
Place the python script in the folder containing your files and double click on the
script to see it at work!


Here is the download link simply_rename.zip

February 24, 2008 Posted by asadujjaman | ENTERTAINMENT, Python | | 2 Comments

How to feed PC music into the Microphone

While voice chatting on yahoo or talking over mobile using bluetooth voice gateway friends request me to let them hear the song I am hearing. I used to place the microphone close to the speaker so that, they can hear. But this is so uncomfortable and awesome specially when using a headphone. I looked for a smarter solution & I found. Here I show (Windows only)-

1.  On the taskbar’s right corner (System tray) right click on the Volume Icon.

2. Click on Open Volume Control menu item.

3. A window titled ‘Front Speaker’ appears. From the munubar choose Options>Properties

4. In the ‘Properties’ window choose Adjust Volume for (Group box) Recording (radio button).

5.  Chek ‘Stereo Mixer’ and ‘Mic’ and uncheck everything else and click OK.

6. A window with two sets of widgets seperated by a vertical line appears one titled Stereo Mixer & another titled Mic. Check Select of Stereo Mixer.

To ensure that the setup is working, play your favourite music on your favourite player and open up Sound Recorder (Start>All Programs>Accessories>Entertainment>Sound Recorder) and start recording.

February 24, 2008 Posted by asadujjaman | Tips | , , | No Comments Yet