Hi,

I am writing a small script to show me which song is playing currently
when I press a shortcut.

My problem is, I did not find a way to get the cover of the currently
playing song. Does anybody has an idea?


The current code for those who are interested, is below. But it is not
much more than a dirty hack yet.

Regards Janosch

#!/usr/bin/python

# cSong
# Copyright (c) 2010 Janosch Maier
# [email protected]
# http://phynformatik.de
#
# cSong is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# For a copy of the GNU General Public License see
# <http://www.gnu.org/licenses/>.



# DEPENDENCIES
# cSong is depending on notify-send.
# On Ubuntu type: sudo apt-get install libnotify-bin


import os

os.system('banshee --query-title > /tmp/track.txt')
os.system('banshee --query-artist >> /tmp/track.txt')
os.system('banshee --query-album >> /tmp/track.txt')

tmpfile = open("/tmp/track.txt")
for line in tmpfile:
        values = line.split(": ")
        values[1] = values[1].strip("\n")
        if "title" == values[0]:
                title = values[1]
        elif "artist" == values[0]:
                artist = values[1]
        elif "album" == values[0]:
                album = values[1]

string = "notify-send -i
/usr/share/icons/hicolor/48x48/apps/media-player-banshee.png "

if title:
        string += '"' + title + '" '
else:
        string += '"Now playing" '

if artist:
        string += '"by \'' + artist + '\' '
else:
        string += '"'

if album:
        string += 'from \'' + album + '\'"'
else:
        string += '"'

os.system(string)

# For debugging the output
#print(string)
-- 
Janosch Maier <[email protected]> -- http://phynformatik.de
This E-Mais is signed via GnuPG <http://gnupg.org/>. My public key:
0xEB21B1DE

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
LUG mailing list
[email protected]
http://kym.net/mailman/listinfo/lug

LUG is generously hosted by INFOCOM http://www.infocom.co.ug/

All Archives can be found at http://www.mail-archive.com/[email protected]/

The above comments and data are owned by whoever posted them (including 
attachments if any). The List's Host is not responsible for them in any way.
---------------------------------------

Reply via email to