VLC <> Conky Integration

*nix specific usage questions
aitte
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 28 Feb 2012 00:26

VLC <> Conky Integration

Postby aitte » 11 Mar 2014 12:03

Hello Folks,

Although I found another thread related to this at:

https://forum.videolan.org/viewtopic.ph ... ky#p209654

Didn't really accomplish anything so I thought I open a new discussion on the topic. I'm about to throw out both XMMS2 on linux and Winamp on windows and switch to VLC for both music and video playing.

My current XMMS2 Conky setup looks like this:

Image

I would like to accomplish the same thing with VLC, preferably through socket communication since I use the RC interface for controlling VLC with a remote. The problem is that this RC interface does not support multiple clients so if conky would try to keep polling it through the tcp socket that would just yield that I can't control it with my remote.

I will share my findings and I looking to post a final solution later. If anybody interested to work with me on this just leave your suggestions/ideas here in this thread.

---

My current XMMS2 conky config looks like:

TEXT
${color1}${font :bold}Music${font}${color2} (${xmms2_status})
$xmms2_title
$xmms2_artist / $alignr$xmms2_album
${xmms2_bar 5}
$xmms2_percent%$alignr$xmms2_elapsed/$xmms2_duration


I would like to get the same out of VLC. Here is what I found out so far:

xmms2_status (playing/stopped) -

VLC equivalent: have to be extracted from status command

Type 'menu select' or 'pause' to continue. (Means Paused)
status change: ( new input: file: (Means it's playing something)

If there is none of the 2 that means stopped.

Alternatively:
| is_playing . . . . 1 if a stream plays, 0 otherwise


xmms2_title - VLC equivalent: get_title

xmms2_artist/xmms2_album - VLC equivalent: None, have to extract the info from the X window list:

xlsclients -l | grep "VLC media player" | cut -c -9 --complement | sed 's/ - VLC media player/\x08/'

The artist and the album are - separated. It can be cut apart with awk but this solution is not foolproof. If any has dash in their names for example:
Oasis - Soundtrack - (Full - Album) - Tangerine Dre - am

It will break.



xmms2_bar - VLC equivalent: If the "show stream position" option is set in the config vlc will echo the status change periodically like:
status change: ( time: 121s )
status change: ( time: 275s )
status change: ( time: 394s )


xmms2_percent/xmms2_elapsed/xmms2_duration - VLC equivalent:
get_length gives back the full length


Another alternative source would be to harvest information is the HTTP interface. By following this tutorial:

http://www.home.no/inf3rn0/NowPlaying/

It should give back:
=== DATA ===
ARTIST: %artist
ALBUM: %album
TITLE: %title
GENRE: %genre
DATE: %date
CODEC: %codec
LANGUAGE: %language
TYPE: %type
CHANNELS: %channels
SAMPLE RATE: %sampleRate
BITRATE: %bitrate
PERCENTAGE PLAYED: %percent
FILENAME: %filename
ELAPSED HOURS: %elapsedH
ELAPSED MINUTES: %elapsedM
ELAPSED SECONDS: %elapsedS
TOTAL TIME: %length
TRACK NR: %trackNr
ENCODED BY: %encoder
COPYRIGHT: %copyright
ORIGINAL ARTIST: %originalArtist
COMPOSER: %composer
DURATION: %duration

But this does not work anymore, the web interface have completely changed (at the time of writing I use VLC media player 2.0.3 Twoflower).
They moved forward jquery based interface so with curl/lynx you cannot even dump the page anymore.

Code: Select all

<div id="seekContainer"> <div id="seekSlider" title="<?vlc gettext("Seek Time") ?>"></div> <div id="currentTime" class="dynamic">00:00:00</div> <div id="totalTime" class="dynamic">00:00:00</div> </div>
The new interface uses <?vlc for querying data from the vlc player. Once again this webpage will not work without Javascript support on the client.

Rémi Denis-Courmont
Developer
Developer
Posts: 15257
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: VLC <> Conky Integration

Postby Rémi Denis-Courmont » 11 Mar 2014 19:35

You're better off using D-Bus MPRIS if you want to get meta-data out of VLC programmatically.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

aitte
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 28 Feb 2012 00:26

Re: VLC <> Conky Integration

Postby aitte » 12 Mar 2014 18:13

Ok so why don't you help me out here man. You are obviously a developer, I'm not familiar with Dbus, I don't know if I can interface with that from a simple script.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 8 guests