sgregoratto.me

source files for www.sgregoratto.me
git clone git://git.sgregoratto.me/sgregoratto.me
Log | Files | Refs

commit f13b7830d59bce4f0e79f4b8e9ff723bb3940f25
parent 351947af8c8569a46dff9e66bae17d3239f9619b
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date:   Wed, 27 May 2020 20:35:36 +1000

lyics-script: add text to playerctl link

Diffstat:
Msimple-lyrics-script-python.xml | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simple-lyrics-script-python.xml b/simple-lyrics-script-python.xml @@ -65,7 +65,7 @@ Don't talk of dust and roses [Verse 1] Pan American nightmare …</pre></code> -<p>Here comes the “hardest” part, detecting the currently playing song. My original script used <a href="https://github.com/altdesktop/playerctl"></a>, a great little program that can control <a href="https://freedesktop.org/wiki/Specifications/mpris-spec/"><abbr class="initialism">MPRIS</abbr></a>-enabled players. It’s functionality is also exported as a Glib GObject, which we can access through the <a href="https://pygobject.readthedocs.io/en/latest/">PyGObject</a> library. The playerctl repo has a <a href="https://github.com/altdesktop/playerctl/tree/master/examples">couple examples</a> for using it with Python, but I had some trouble simply getting the song artist and title. It wasn’t until I looked at the <a href="https://raw.githubusercontent.com/altdesktop/playerctl/master/playerctl/playerctl-player.h">function definitions</a> of the playerctl <code>Player</code> object that I needed to use the <code>get_artist()</code> and <code>get_title()</code> methods:</p> +<p>Here comes the “hardest” part, detecting the currently playing song. My original script used <a href="https://github.com/altdesktop/playerctl">playerctl</a>, a great little program that can control <a href="https://freedesktop.org/wiki/Specifications/mpris-spec/"><abbr class="initialism">MPRIS</abbr></a>-enabled players. It’s functionality is also exported as a Glib GObject, which we can access through the <a href="https://pygobject.readthedocs.io/en/latest/">PyGObject</a> library. The playerctl repo has a <a href="https://github.com/altdesktop/playerctl/tree/master/examples">couple examples</a> for using it with Python, but I had some trouble simply getting the song artist and title. It wasn’t until I looked at the <a href="https://raw.githubusercontent.com/altdesktop/playerctl/master/playerctl/playerctl-player.h">function definitions</a> of the playerctl <code>Player</code> object that I needed to use the <code>get_artist()</code> and <code>get_title()</code> methods:</p> <code><pre class="chroma"><span class="ch">#!/usr/bin/env python</span> <span class="kn">import</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="nn">gi</span>