mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.
GNU General Public License v3.0
8.05k stars 643 forks source link

Maintain a file displaying the current song playing #914

Open emanrdesu opened 5 years ago

emanrdesu commented 5 years ago

I want to access the current song playing in order to output it to my taskbar, but I'm unable because I have no easy way of retrieving this information.

Issue / Suggestion

Whenever a song is playing, write to a file ~/.config/mps-youtube/current_song, which is (for now) 1 line containing the song/video's title. If nothing's playing, the file should be empty. Maybe it shouldn't be restricted to just a line containg the title, but also multiple lines with other information, like perhaps video length

This is one of my favorite software, if this got implemented, it'd mean a great deal.

ritiek commented 5 years ago

Check out #834. Once playerctl is installed, use:

$ playerctl metadata

to get current track's metadata.

To fetch the title:

$ playerctl metadata title

EDIT: You can get the length with:

$ playerctl metadata mpris:length

Divide this value by (1000*1000) to convert in seconds.

emanrdesu commented 5 years ago

How do I exactly do all that stuff in ArchLinux? I installed dbus-python and playerctl from the AUR, but PyGObject fails and the other first two I have on clue about.

Alex-Programs commented 4 years ago

I am on Ubuntu, but I just installed playerctl, started a video, and

ran playerctl metadata title