amaroK Desktop Script

Amarok 1.x Scripts

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on git.opendesktop.org

1
Score 50%
Description:

This is a script for amarok (you need amarok >= 1.2beta4). The script shows the cover of the album you are listening embedded in your desktop.

It also adds a lightning effect (this is configurable by the user)

NOTE: this is not a karamba script

You need pyqt and pykde to run it.

Last changelog:

14 years ago

0.2:
-Now it hides the cover if amarok is stopped (Thanks to Pierre Habouzit).
-Hides itself if there is no cover defined.
-It shows an alert if you dont have PyQT or PyKDE installed (Thanks to Mark Kretschmann).
-The light filter is a little bit smoother now
-Real cd-box borders instead the old gray borders

0.1a:
-Get the coverImage using "dcop amarok player" instead of "dcop amarok playlist"
-Fixed the tab order in the config dialog
-Now it's correctly packaged

0.1:
-Initial release

fchristophersen

9 years ago

well, in fact this patch doesn't add any buttons, but it allows to play/pause, and change to previous or next song by clicking on the desktop cover.

You have to replace:

popen("dcop amarok player showOSD")

in line 305 of desktop.py with:

if e.button() == Qt.LeftButton:
popen("dcop amarok player prev")
if e.button() == Qt.MidButton:
popen("dcop amarok player playPause")
if e.button() == Qt.RightButton:
popen("dcop amarok player next")

note: the "if e.button()..." lines must have 8 blank spaces before them.
and the "popen("dcop..." lines must have 12 blank spaces before them.

after doing this you will be able to:
*left click: change to previous song
*middle click: pause or stop
*right click: skip to next song

by the way, i'm no programmer, i just read a small python tutorial a few weeks ago, but thanks to google i managed to get this done! i hope someone find this useful.

Report

tonybeccar

10 years ago

Hi, as I'm no programmer, I'd like to propose some new nice features to this cool script. It would be nice that the cover could be resizable and sticky, so that it shows on every desktop. Also you can provide information such as artist, album and title, like a now playing screenlet but with the only difference that Amarok speaks to the "screenlet" and not otherwise causing high amounts of cpu. I think showing the nowplaying info should be no problem if you can show the now playing cover. Thanks a lot and if I can help in anything rather than programming, let me know. Bye!

Report

Pappice

10 years ago

Sorry, I'm not an expert in python, but I've found a (stupid?) workaround to solve the problem of the configuration window:
edit the file desktop.py, in /home/yourusername/.kde/share/apps/amarok/scripts/desktop, and go to the the line n.51
just change that line with
net = NETRootInfo(0xFFFFFF)
It will work!!!
At least, it works in my case... BTW I use GNOME.

IMPORTANT: no idea of what I've done!! Use this at your risk!

Report

fchristophersen

9 years ago

Thanks! i don't know either what it does... but it worked quite well for me too (i'm running xfce).

Report

hubfred

10 years ago

Hey,

the script itself is working but where can I alter the settings of it? I cannot relocate the cover and it is too big. Using configure in the script manager has no effect at all, neither has edit in the context menu. This holds for any script installed. On the screenshot I can see that resizing is actually possible. Is this a bug that came up recently or am I completely on the wrong track?

Report

Sathors

10 years ago

So it keeps telling me it does not find the pyqt folder though I've installed it (and pykde too).
I'm on gnome

Thank you

Report

gardar

11 years ago

Does this script work on the gnome desktop?
I am currently running amarok on gnome... When I try this script, nothing happens....
Has anyone managed it to work?

Report

angstmachine

11 years ago

I know it was months ago, but in case my fellow gnome users have the same problem: Just install the latest pyKDE bindings.

My issue: The configuration button in the script manager in Amarok does not load a configuration window. I assume this a gnome/kde compatabilty issue, but does anyone know how i can correct it?

All I want to do is re-position the cd cover on my desktop, however clicking and dragging doesn't work, and changing the script is way out of my league. Any ideas?

Report

JayCArrow

11 years ago

The problem does not look like a gnome problem.

I have installed the latest versions of SIP, pyQT3 and PyKDE and the configuration window won't open on my KDE-Desktop 3 either.

The script protocol tells me about some errors. Maybe someone can take a look to the problem...

Yours,

Jay

Protocol (after calling configuration):

Traceback (most recent call last):
File "/home/jay/.kde/share/apps/amarok/scripts/desktop/desktop.py", line 260, in timerEvent
self.configure()
File "/home/jay/.kde/share/apps/amarok/scripts/desktop/desktop.py", line 299, in configure
self.dia = ConfigDialog(self)
File "/home/jay/.kde/share/apps/amarok/scripts/desktop/desktop.py", line 51, in __init__
net = NETRootInfo(qt_xdisplay())
TypeError: argument 1 of NETRootInfo() has an invalid type
[Desktop Script] configure

Report

netswipe

11 years ago

nice one...

but a little feature I miss: The cover should be resizable ;)

regards, netti

Report

stuif

12 years ago

Hello, I tried to install the Desktop script, but it gave the following error:
sh: kdialog: not found

Traceback (most recent call last):

file "/home/kasper/.kde/share/apps/amarok/scripts/desktop/desktop.py", line 37, in ?

from kdecore import*

importError: No module named kdecore

What should I do??

thanks a lot

Report

Typhon

12 years ago

I can't access the configuration menu to set the position on desktop. Is there a way to do this manually by editing a text file?

Report

rynop

12 years ago

Yes, download the package, extract and edit desktop.py

change any refrence of :
self.x = 50
self.y = 50

to your desired values. Save file and put it back in the bz2 package (overwite old one). Then install in amarok.

There is an error in the python script 'TypeError: argument 1 of NETRootInfo() has an invalid type' - i do not know python but i am working on fixing it right now...

Report

adny

11 years ago

I didn't see the config dialog either (Fedora 8)

"Fixed" it by commenting out:
# net = NETRootInfo(qt_xdisplay())

and then later on replacing the net.desktopGeometry(0).width and net.desktopGeometry(0).height with 4096 (i.e. a value larger than the size of the desktop).

Now the config dialog works just fine :)

Report

dennismdk

12 years ago

I need pyqt and pykde for SuSe 10.1. Where can I find them?

Report

gardenmouth

12 years ago

Just search this site.. http://rpm.pbone.net/index.php3/stat/2/simple/2 Sometimes the site goes down but the majority of time it's up.

Report

rabauke

12 years ago

I restarted KDE and amarok (1.4.2) was not loaded, but the py-script (0.2), resulting in a black cover. Fair enough.

After that I started amarok and endless instances of amarokapp were created blocking KDE. killing amarok and the script solved the problem. Yet after starting amarok again it began again. So I removed the script manually from amarokrc and now it works as expected.

Not sure what could cause this.

Report

StewieG

12 years ago

Hi.

I like the script, but it has a drawback. If gets the cover from the Amarok miniature cache instead of from the real cover file. If we have Amarok set up to use 100 pixels for the covers, they will look bad when the scaling is done.

You may change the paintImage function to get the real cover file, like this:

def paintImage (self,force):
artist = popen("dcop amarok player artist").read()[0:-1]
album = popen("dcop amarok player album").read()[0:-1]
coverImage = popen("dcop amarok collection query \"select path from images where artist='" + artist + "' and album='" + album + "'\"").read()[0:-1]
if coverImage == "":
self.hasCover = False
self.__hide()
elif (self.actual != coverImage or force):
self.hasCover = True
cover = self.__getCover(coverImage)
if self.filter:
cover = self.__filter(cover)
self.image.setPixmap(self.__box(QPixmap(cover)))
self.__show()
self.actual = coverImage

Report

StewieG

12 years ago

I forgot to add a detail, just in case there is an apostrophe in the artist or the album:

artist = artist.replace('\'', '\'\'');
album = album.replace('\'', '\'\'');

That goes before the SQL query.

Report

dta

12 years ago

There are 2 problems with this patch. The borders of cover are messed up (some weird colors) and this script cannot be runned if no track plays. Otherwise it's great. If you know what to do with these issues, I would really appreciate it. Thanks

Report

mariahoney

12 years ago

I couldn't get this patch to work for me :(

Though, I did successfully get the original script to work by simply adding the following 3 lines of code beneath line:
song=popen("dcop amarok player coverImage").read()[0:-1]

and above line:
If OString(song).contains("nocover.png"):

------ This is the new code -----
large=song[:song.find('cache')]+"large/"+song[song.find('@')+1:]
if path.exists(large):
    song=large
---------------------------------

Theses three lines of code assume that you have not renamed your 'cache' and 'large' directories in ~/.kde3.5/share/apps/amarok/albumcovers



Report

iamFIREcracker

12 years ago

i can't use this patch...it seems that the query doesn't work properly...could you help us make it working?
because of i'm not a script developer...i dont' know very well where to insert the correction for the "strange artist name patch"; u told before the quere...but were?

def paintImage (self,force):
artist = popen("dcop amarok player artist").read()[0:-1]
album = popen("dcop amarok player album").read()[0:-1]
artist = artist.replace('\'', '\'\'');
album = album.replace('\'', '\'\'');
coverImage = popen("dcop amarok collection query \"select path from images where artist='" + artist + "' and album='" + album + "'\"").read()[0:-1]
if coverImage == "":
self.hasCover = False
self.__hide()
elif (self.actual != coverImage or force):
self.hasCover = True
cover = self.__getCover(coverImage)
#if self.filter:
# cover = self.__filter(cover)
self.image.setPixmap(self.__box(QPixmap(cover)))
self.__show()
self.actual = coverImage

is it correct? if so..it doesnt work.. :(
M@

Report

CaceK

12 years ago

Could you create a smaller Version of the Cover?

Report

mahen

12 years ago

Hi everyone,

this plugin works well about 70% of the time... However, sometimes, with some albums pictures, I displays a black picture, or some "trash" (seemingly random picture). It must have something to do with the picture format, however, it just ought to be some standard png pictures... Any idea ?

Thanks a lot !

PS : apart from that, this is a great script :)

Report

bitcrazy

12 years ago

Hi,
got the same problem here. I've opened some of the images in a hexeditor and saw, that they were corrupted. Seems that amarok sometimes adds a bit to the image.
You can fix it by either removing these files from your personal amarok dir or repair them with a hexeditor.

Greetings

m0nk

Report

14 years ago

0.2:
-Now it hides the cover if amarok is stopped (Thanks to Pierre Habouzit).
-Hides itself if there is no cover defined.
-It shows an alert if you dont have PyQT or PyKDE installed (Thanks to Mark Kretschmann).
-The light filter is a little bit smoother now
-Real cd-box borders instead the old gray borders

0.1a:
-Get the coverImage using "dcop amarok player" instead of "dcop amarok playlist"
-Fixed the tab order in the config dialog
-Now it's correctly packaged

0.1:
-Initial release

File (click to download) Version Description Downloads Date Filesize DL OCS-Install
Pling
Details
license
version
0.2
updated Feb 13 2005
added Feb 01 2005
downloads today
0
page views today 9
System Tags addon