11
Condor
3y

Right.. I spent the hours leading up to the year change by adding a YouTube to MP3 downloader into my Telegram bot. After a bit of fiddling it turned out okay, and the commit for it was mentioned to the last for the year 2020.

I mentioned this in one of my chats, and users came in with more issues. Told them it's the last commit for the year and I'll keep myself to it. I did adjust the code a bit though to fix those issues, awaiting a commit after midnight.

Midnight passes and 2020 turns into 2021.

I commit the new features, and quickly implemented another one I already thought of as well, but needed its own commit.

Quickly afterwards it turns out that the /mp3 feature actually breaks the bot somewhat, especially on long tracks. Users add a slew of 10h songs into what essentially became a long queue of single-threaded bot action (or rather lack thereof).

I made the /mp3 command accessible to myself only like I did with some other administrative commands already. Still no dice, the bot rejected the commands but executed part of the /mp3 command anyway.

I look a bit further into the code and it turns out that while I was restructuring some functions, I forgot to make the admin() function exit the script after it sends the rejection onwards. This was a serious security issue and meant that all authentication was void. Fortunately the chat did not realize this - one of the commands that became available as a result was literally a terminal on the bot's system.

I fix the issue in 7 commits after midnight total, 3 of which were related to /mp3 and admin(). We're now 1 hour after midnight.

Happy New Year everyone... :')

Comments
  • 1
    Interesting, but what do you do with it? Download music to your smartphone?
    I don't really get what it is meant for?

    EDIT: Happy new year 2021!
  • 0
    So you are aiming at breaking Microsoft Word's featuritis world record? Well, good luck - it will take a while but you are definitely on the right track...
  • 0
    Why mp3 though, can't you download directly in opus format?
  • 1
    @jay91 Yes, more or less. The bot is an attempt to replace my existing userbot (since the bot API is so much easier to use, and webhooks allow a simple webserver and CGI scripts to interact with Telegram instead). It also allows the bot functionalities to be separated from my own (fairly high access) account. As far as the /mp3 command in particular goes, youtube-dl requires a fairly long list of options to get what is IMO fairly basic functionality out of it... And I don't always have a shell available in the first place. So yeah, that's kinda where the bot should fill in the gaps.
  • 0
    @electrineer OPUS isn't a very well supported format, at least in the media players I use. MP3 or FLAC are my go-to formats, but YouTube is only 128kbps anyway... MP3 fits the bill for me. ffmpeg is quite heavy compared to the rest of the Alpine system though..

    @Oktokolo I mean that feature is currently a single function that's 10 lines long... Features yes (if they're useful), complex/convoluted code no, at least in my book. I strive for minimalism, and the bot is a manifestation of that (entire code is currently 137 lines long).
  • 0
    @Condor at least NewPipe let's you download directly in opus 160 kbps, and it probably sounds like mp3 with a higher bitrate
Add Comment