Version User Scope of changes
Oct 21 2007, 10:38 AM EDT (current) thanius 3 words added, 235 words deleted
Oct 21 2007, 10:04 AM EDT thanius 27 words added

Changes

Key:  Additions   Deletions
Here's my little script for changing cover-images for the songs currently playing. Requires audacious and audtools. If it's buggy, it's because I've never coded anything in python before. This is my first. So, if it breaks or bugs out, someone else fix it. Cheers! Here's the source:#!/usr/bin/env python # Audacious AWN-plugin # v. 0.666 # Tobias Hellgren <thanius at thanius dot com> # # Requires Audacious and audtool # Dbus requires UTF-8 encoding on the folders, or else the script will crash # The cover image must be called either 'folder.jpg' or 'folder.png' # # Use 'awn-audacious.py' as a launcher for Audacious once you've configured the paths # # CONFIG DEFAULT_ICON = "/usr/share/pixmaps/audacious.png" AUDACIOUS = "/usr/bin/audacious" AUDTOOL = "/usr/bin/audtool" #------------------ import dbus import os from subprocess import call from time import sleep from sys import exit from commands import getoutput current = "" status = "-" bus = dbus.SessionBus() obj = bus.get_object("com.google.code.Awn",Here "/com/google/code/Awn") awn = dbus.Interface(obj, "com.google.code.Awn") def run(program, *args): pid = os.fork() if not pid: os.execvp(program, (program,) + args) if not getoutput('pidof audacious'): print "Audacious not running, I took the liberty to start it for you." run(AUDACIOUS) sleep(2) while getoutput('pidof audacious') != "": status = getoutput(AUDTOOL + ' playback-status') id = getoutput('xwininfo -root -children|grep player|cut -d\\" -f 1|tr -d [:space:]') if status == "/usr/bin/audtool: audacious server is not running!": awn.SetTaskIconByName ("audacious", DEFAULT_ICON) exit() current = getoutput(AUDTOOL + ' current-song-filename') if len(id) == 9: pathname = os.path.dirname(current) filename = os.path.abspath(pathname) if os.path.exists(filename + '/folder.jpg') or os.path.exists(filename + '/folder.png'): if os.path.exists(filename + '/folder.jpg'): cover = (filename + '/folder.jpg') else: cover = (filename + '/folder.png') else: cover = DEFAULT_ICON if status == "playing": awn.SetTaskIconByXid (long(id,0), cover)is:
else:
awn.SetTaskIconByXid (long(id,0), DEFAULT_ICON) http://wiki.awn-project.org/index.php?title=Audacious_plugin
sleep(2)