Use Notification To Show Playing Music Title Of mps-youtube On Mac OS X

Fri, 2 Jun 2017 16:47:00 +0800         Sentoz Lin

https://static.pexels.com/photos/3104/black-and-white-music-headphones-life.jpg

(Image source: https://static.pexels.com/photos/3104/black-and-white-music-headphones-life.jpg)

"mps-youtube", which is, according to the official description:

"a Terminal based YouTube player and downloader!"

That means you can play your favourite Youtube music without leaving the terminal! Unlike using other music streaming provider like Spotify、Apple Music、 KKBox, that need to switch back and forth between your different applications , and consume precious resource because their beautiful GUI; otherwise, you can just stick with terminal, which I think will drastically improve your productivity if you are a developer whose developement environment based on terminal like me!

http://i.imgur.com/DJYGF7k.jpg (The above image shows mps-youtube running inside iTerm2 Hotkey mode("option + t" to toggle iTerm2 window, when iTerm2 hide, your music are just like playing in the background!))

But there is a problem, if I want to know what song is now playing,I need to press "option + t" to open Hotkey iTerm2 window to see it.That means Ihave to interrupt what I am doing right now, distract you from important work.    What if when songs change, it can automatically display a notification to tell me which song is now playing; luckily, ops-youtube prodvide a config option to let you send music title info to notifier which will stimulate system's Notification.But which notifier to use? I guess you ask,well, we will use a tool called "terminal-notifier", which let you

"Send User Notifications on macOS from the command-line".

Ok, enough background talking, let's go straight toward to the solutions.

Step 1: Install terminal-notifier

I assume that you are already familiar with Homebrew(a package manager for Mac OS X), if you don't, go checkout Homebrew to get more info.Next issue the following command in your terminal

>> brew install terminal-notifier

Step 2: Set mys-youtube's notifier

>> set notifier terminal-notifier -sound Frog -title "🎵" -group Mpsyt -sender mpsyt -message

Options explaination:

We are done! Congratulations!

Let's see it in action! mps-youtube with Notification