Display VLC Music information in Conky by patranella

View this thread on steempeak.com
· @patranella ·
$0.05
Display VLC Music information in Conky
Sometimes wanting to do the most simple of things comes in a difficult to do package. I myself have become extremely frustrated, at times, trying to get little things done that, by right, should only take a few minutes, but end up taking hours and hours.

In the spirit of making things easy for the next guy, I spent hours and hours figuring some things out and have decided to post the results so that you can take minutes to do it for yourself. You're welcome.

For starters, you can get the information you desire from VLC with the following terminal command:

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata

You can dump this information into a file by using the following terminal command (just replace "path" and "file" with the path and filename you want the information dumped into):

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata > /path/file

From here, you can look and see what all VLC has to offer. To place this information into Conky, I would begin by writing a script file. For the sake of this tutorial, let's call it "vlc.sh".

The contents of vlc.sh will look like this:

#!/bin/bash

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata > /tmp/vlc

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep artUrl | cut -c22- | awk '{gsub(/%20/," ")}1' >/tmp/album2

echo "$(cat /tmp/album2)" >/tmp/art2
ln -sf "$(cat /tmp/art2)" /tmp/album2.jpg

exit 0

#End of Script

This is what the script does: It will fetch the VLC information and dump it into a file called "vlc" in your /tmp/ folder. It will also take the art url of the music file and will place it in a file called "art2" in your /tmp/ folder. It will then take the information from the "art2" file and create a symbolic link which will display the current album art.

Note: VLC uses %20 instead of a space in the Art and File URL's. The album art will not be found with the formatting VLC uses, and so the script file changes %20 to an actual space when it dumps the information into the "art2" file.

Note 2: I use "art2", "album2", etc. in case you also use CMUS and want to display music information for both in Conky (refer to my previous post here (https://steemit.com/linux/@patranella/expanding-on-linux).

In your .conkyrc file, you have to place the following information to display your VLC data in Conky (refer also to my previous post here (https://steemit.com/linux/@patranella/expanding-on-linux):

#VLC Music:
"Backslash" (Use an actual backslash. I had to write the word instead of the symbol so Steemit would show it properly)
${if_running vlc}
${execi 5 sh ~/Path/Folder/vlc.sh}
${image /tmp/album2.jpg -n -p 0,160 -s 140x140}



${execi 5 qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep artist | cut -c15-}
${execi 5 qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep album | cut -c14-}
${execi 5 qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep title | cut -c14-}
${endif}
"Backslash" (Use an actual backslash. I had to write the word instead of the symbol so Steemit would show it properly)

What this information does, is it provides space for the album art and shows the artist, album, and song title. You will have to show the proper path to the "vlc.sh" file, and alter the coordinates and size of the album art to suit your needs.

Hopefully, with only a few personal adjustments being needed from you, I have made it easy for you to incorporate VLC into your Conky experience.
👍  , ,
properties (23)
post_id51,287,449
authorpatranella
permlinkdisplay-vlc-music-information-in-conky
categorylinux
json_metadata"{"tags": ["linux", "debian", "technology", "conky", "vlc"], "format": "markdown", "links": ["https://steemit.com/linux/@patranella/expanding-on-linux"], "app": "steemit/0.1"}"
created2018-06-01 21:15:09
last_update2018-06-01 21:15:09
depth0
children2
net_rshares14,616,354,912
last_payout2018-06-08 21:15:09
cashout_time1969-12-31 23:59:59
total_payout_value0.053 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length3,735
author_reputation0
root_title"Display VLC Music information in Conky"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@steemitboard ·
Congratulations @patranella! You have received a personal award!

[![](https://steemitimages.com/70x70/http://steemitboard.com/@patranella/birthday1.png)](http://steemitboard.com/@patranella)  1 Year on Steemit
<sub>_Click on the badge to view your Board of Honor._</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest3-and-steemitboard-meet-the-steemians-contest"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmeLukvNFRsa7RURqsFpiLGEZZD49MiU52JtWmjS5S2wtW/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest3-and-steemitboard-meet-the-steemians-contest">SteemFest3 and SteemitBoard - Meet the Steemians Contest</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
post_id65,781,127
authorsteemitboard
permlinksteemitboard-notify-patranella-20181110t022009000z
categorylinux
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2018-11-10 02:20:09
last_update2018-11-10 02:20:09
depth1
children0
net_rshares0
last_payout2018-11-17 02:20:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length993
author_reputation38,705,954,145,809
root_title"Display VLC Music information in Conky"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steemitboard ·
Congratulations @patranella! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@patranella/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@patranella) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=patranella)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest-meet-the-stemians-contest-the-mysterious-rule-revealed"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmasWw4jQHwxng82DKxY6Q6tVg9mWcto4xcDURs8knFgCa/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest-meet-the-stemians-contest-the-mysterious-rule-revealed">SteemFest Meet The Stemians Contest - The mysterious rule revealed</a></td></tr><tr><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest-meet-the-steemians-contest"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmasWw4jQHwxng82DKxY6Q6tVg9mWcto4xcDURs8knFgCa/image.png"></a></td><td><a href="https://steemit.com/steemfest/@steemitboard/steemfest-meet-the-steemians-contest">SteemFest⁴  - Meet the Steemians Contest</a></td></tr></table>

###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id81,604,722
authorsteemitboard
permlinksteemitboard-notify-patranella-20191110t022744000z
categorylinux
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2019-11-10 02:27:45
last_update2019-11-10 02:27:45
depth1
children0
net_rshares0
last_payout2019-11-17 02:27:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,555
author_reputation38,705,954,145,809
root_title"Display VLC Music information in Conky"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000