Well i came back to kde a few months ago. And am now playing with some “native” tools. kopete for IM and amarok for playing music.
From my experience amarok gets much more stable if one does not use the auto-update collection feature.

Kopete comes with a nice plugin to get the song that is playing from amarok (and other players) and set it as the “Playing Song” just like msn+mediaplayer in MSWindows. But i wanted more so i did this little script to fetch the cd-cover from amarok and set it as your avatar.

Now i just need kopete to support either:
Jep-8
or
Jep-84
or
Jep-153

So i can see and send avatars to my jabber contacts.


#!/bin/bash

#Where to store tmp image to detect rotation
ROTATION="$HOME/.kde/kopete-img"
#number of seconds to sleep between testing for new picture
INTERVAL=10

while (true); do

#get the image from amarok
PICTURE=`dcop amarok player coverImage`
TMPFILE="/tmp/kopete-$RANDOM"

#creat the image for the rotation (only needs to be done once)
if ! [[ -f $ROTATION ]]; then
> $ROTATION
fi

#See if they differ and convert and update
if !( diff "$PICTURE" $ROTATION ); then
echo "New image in amarok"
convert -resize 96x96 "$PICTURE" $TMPFILE
dcop kopete KopeteIface setGlobalPhoto $TMPFILE
rm -f $TMPFILE
cp "$PICTURE" ~/.kde/kopete-img
fi

sleep $INTERVAL
done

Bad things about this script: it is not possible to start/stop it using kopete as it is fully external. It needs imagemagick (not big of a problem). It will not detect when amarok does not have a picture and will display your avatar as a CD :)
There is probably a problem when amarok is not running, in that case PICTURE will probably be empty and diff will return two. But the fix is trivial and stays as an exercise for the reader :)

Uma Resposta a “kopete + amarok”
  1. yagami diz:

    [quote] Bad things about this script: it is not possible to start/stop it using kopete as it is fully external. [/quote]

    bem , vais ficar contente por ler isto :

    na mailing list do kopete :

    “Hello !

    Here is a little patch, a first draft.
    This patch adds a script manager within kopete allowing to
    install/uninstall, start/stop scripts. Only a little part of the code
    is from me, the rest was taken from amarok script manager.

    I think it’s important to have this scripting facility because it
    allows people to write some kind of plugins very easily using the
    wonderful KDE Dcop ;-) I think many guys never wrote a plugin because
    it was too hard/long (and it’s true). And everyone doesn’t know the
    dcop interface. So this script manager will make it appear and it’d
    make *more* Kopete fans :-)

    So, what do you think of it ?
    The code is far from perfect but I would like some feedback before
    going further.

    Thanks,
    Marc”

  2.  
Deixe uma resposta

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">