Banging your head against the wall, trying to understand this horribly written and incomprehensible code of the legacy system? Well we've all been there and most of us are probably there right now. These days, due to the tedious tasks we often do as programmers, we often forget how beautiful and just joyful programming is. Well today, I'm going to share how a very simple ~30 line script saved me so much time with basically no effort.
The Problem
So I recently acquired a large library of spiritual songs from a friend of mine(close to 20GB), and it was amazing. I had basically any song I would want to listen offline right there in my laptop, so whenever I'm coding or doing pretty much anything on my computer, I'd open up the music in my favorite media player. However, there was one huge annoyance I accumulated over using the library over the past couple of months, the problem was the metadata of the media files was non-existent. Meaning I couldn't use my media player, say to play only songs of a particular artist(which was my main gripe), or sort based on the artist and so on.
The Solution
It's possible to edit the metadata of media files using software but of course editing each file in a 20GB directory is just not worth any amount of annoyance. Of course, if you're a programmer you already know where I'm going with this, I just wrote a small script that goes through each media file, and edits the artist metadata(which it gets from the directory name) and vuala, in just under a minute, the script updated the metadata of all files in 20GB worth of media files. Here's the code if you'd like to take a peek:
Ending Thoughts
Now, was this a groundbreaking and incredible piece of code, of course No. This was a very trivial piece of code anyone could write, but the utility I got from such a simple script is the point of this article. Programming is beautiful, yes sometimes it can be a big pain in your life, especially when working with something that doesn't excite you, but always remember those things that made you fall in love with programming. It is such an amazing tool, and is probably the closest thing that we have to a superpower, so let's all take a moment to appreciate how lucky we are to be doing it!
Top comments (0)