Skip to content

Instantly share code, notes, and snippets.

@breunigs
Last active December 21, 2015 01:39
Show Gist options
  • Save breunigs/6229411 to your computer and use it in GitHub Desktop.
Save breunigs/6229411 to your computer and use it in GitHub Desktop.
displays lyrics of currently playing song. Works in existing shell or opens a new terminal. Keywords: cmus urxvt mutagen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if not sys.stdout.isatty() and os.environ.get('iherduleikterms') != 'no':
os.environ['iherduleikterms'] = 'no'
os.system('urxvtcd -title "Lyrics Viewer™" -e sh -c "lyrics-currently-playing | less"')
exit
import subprocess
import re
from mutagen.id3 import ID3
stats = subprocess.check_output(["cmus-remote", "-Q"])
path = re.search('file (.*)', stats).group(1)
tags = ID3(path)
lyrics = tags.getall("USLT")
print path
for x in lyrics:
print "\n--------"
print (x.lang + " " + x.desc).replace('\x00', '')
print x.text.encode('utf-8').strip()
print "\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment