Fandom

Music Player Daemon Community Wiki

Hack:Conky-lyrics

525pages on
this wiki
Add New Page
Talk0 Share

A simple python script and conky config to display lyrics of the currently playing song on your desktop.

Maintainer: --Durand 02:59, March 20, 2010 (UTC)

conky-lyrics.py (snippets taken from mpdlyricsscript)

#!/usr/bin/env python

import os,urllib

artist,title = os.popen('mpc --format "%artist%//%title%" | head -n1').read().split("//")

artist = artist.replace(" ","%20")
title = title.replace(" ","%20")
# Get html
html = urllib.urlopen("http://www.lyricsplugin.com/winamp03/plugin/?artist=%s&title=%s"%(artist,title)).read()
lyrstart = html.find('<div id="lyrics">') + 17
lyrend = html.find('</div>',lyrstart)
lyrics = html[lyrstart:lyrend].strip()
# remove html formatting
lyrics = lyrics.replace('<br />','' ).replace('"', '"').strip()
# and dos line feeds
lyrics = lyrics.replace('\r','')
print(lyrics)

.conky-lyrics (remember to edit the last line to give the location of the python script)

##############################################
# Output
##############################################
# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=6
xftalpha 0.8
text_buffer_size 2048

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 180 0
maximum_width 1000

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
Hack:mpdlyricsscript
# Stippled borders?
stippled_borders 0

# border margins
border_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color grey
own_window_colour grey

# Text alignment, other possible values are commented
alignment top_left

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 35
gap_y 35

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer none

TEXT
${font Arial Black:size=10}${mpd_artist}${font}
${font Arial Black:size=8}${mpd_title}${font}

${execi 1 python ~/bin/conkyLyrics.py}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki