NotifyAmarok (Gnome)
Amarok 2.x Scripts
Description:

Alternative OSD through Gnome Notification Daemon

This script shows information about the currently played track as a notification using a notification daemon that implements the freedesktop.org dbus interface (e.g. libnotify or notify-osd). It is intended to replace Amaroks own OSD, so its recommend to deactivate this via the configuration menu.

Dependings:
* Amarok 2.x
* notify-osd (recommend) or libnotify-bin
* imagemagick
(if you use libnotify)

Some example strings for the configuration are available on my blog: http://mantis.blogsport.de/2009/07/08/notifyamarok-configuration/

UPDATE (1.11.09):
ubuntu karmic (9.10):

Due to some changes in notify-osd for karmic some issue evolved concerning amarok notifications:
1. The update seems to have become slower which first of all sometimes causes empty notifications.
2. Newlines in the title are prevented by design now.
3. The destruction of notifications stopped working so there is an additional standard duration without update after the duration time thats set in the NotifyAmarok configuration.
As I unfortunately dont have time for this project at the moment I most likely wont fix this in the near future. Sorry!

KDE 4.3:
KDE 4.3 now support the freedesktop.org specifications, but unfortunately no smooth update. If you are using KDE, i recommend you to use thesalus' amaroknotify (http://www.kde-apps.org/content/show.php/amaroKnotify?content=103197), which provides nearly the same functionality now, but is developed for KDE.
Last changelog:

8 years ago

1.0
Major development step with stunning new features ;)
* Full Configurable Notification Title, Body and Duration with all song information available and nice unicode symbols
* A nice Help Window that (i hope) explains the configuration accurately
* set Keybinding to trigger a notification when ever you wonder which song is playing atm (though not very straightforward yet) see "Questions and Answers" for Details
* finally just using the same cover images Amarok does without searching for fitting covers
* new code concept/structure that benefits future development of more new features
* now works on Amarok 2.1 Beta as well

bal0r

5 years ago

Hi, thanks for this nice script.
In order to make it working I needed to change the shebang line to:
#!/usr/bin/env python2
Kind regards,
Max

Report

Jojo12a

7 years ago

One small bugfix: Icon filenames that contain spaces (or other characters specially treated by bash) will not work in the current implementation because in line 106,

resize = subprocess.Popen("convert -resize 50x50 "+icon+" "+path+"/temp.png", shell=True, stdout=subprocess.PIPE,)

has to be replaced by

resize = subprocess.Popen(("convert", "-resize", "50x50", icon, path+"/temp.png"), stdout=subprocess.PIPE,)

shell=True is not a that good idea because you should try to avoid shell escapes.

Also, please replace all

Template(sys.argv[i])

calls by

Template(unicode(sys.argv[i], 'utf-8'))

so that Unicode strings are allowed in the template strings.

Report

rubyinthedust

7 years ago

Good work, although this looks really nice this is not KDE material - there are far too many Gnome deps. Alone script requires banshee gnome-mount gajim and pidgin notifiers, which are all Gnome apps, and those require even more libraries. Installation will take me hours, for a script?

Report

Jojo12a

7 years ago

Well, I don't suppose this is for KDE users because it is all about better integration of the KDE application Amarok into GNOME. But it is a script for a KDE application so I suspect it to belong here anyway.

Report

stimpyjcat

7 years ago

Streams like radioparadise.com give the song details (artist and title) and the (ugly) OSD show them when change, but theres no real track change for amarok so the notifyamarok script dont work.

Will be possible to get the same behavior as the (ugly) OSD with this script when using streams?

Report

Daniel2009

7 years ago

Same problem here, don't work with Internet radio streams. KDE 4.3.0, Amarok 2.1.1. Must use the ugly OSD for now :-(

Report

apolodor

7 years ago

Thank you for the script, it work nicely even under KDE.

Just one thing: it does not seem to work when it needs to show characters with accents (like é). All text is missing (I get a blank popup with only the cover image).

If it helps, the ID3 tags for those specific MP3 files might be UTF-8 encoded (with EasyTAG).

Report

apolodor

7 years ago

I forgot to mention my configuration:
- OS: Kubuntu Jaunty
- KDE 4.3 RC2
- Amarok 2.1.1

Report

meerkat

7 years ago

hm, thats strange - i remember having those problems in an early version, but they were solved when i moved from amarok api to dbus as source of the track information. anyway, cant see how utf-8 can be the problem - actually the script is encoding everything to utf-8. please check if dbus is providing the track information correctly (e.g. by typing the following in your terminal when a track in question is playing in amarok):

qdbus org.kde.amarok /Player GetMetadata

are you sure it's caused by the accent characters or are there other special characters (e.g. $ or ") in your tags in question? are the notes ♫ and the play symbol ▶ shown in your notifications? does the problem appear in head as well as body of the notification and title as well as artist tag?

Report

apolodor

7 years ago

I have done some tests and I managed to locate the problem. I have tested only combinations of 3 fields: artist, title, and album.

My configuration for the script was:
Head: $artist$n$notes $title $notes
Body: $album ($year)$n$play $elapsed /$total

The symbols for "notes" and "play" appear fine, btw.

I tried removing various parts from both the head and the body and it seems that the error appears only if both the following conditions are true:
- the artist or the album field contains a character with an accent
- that specific field is not "alone" in its position (be it Head or Body).

So, if $artist is Händel (and no other fields are special):

This version

Head: $artist
Body: $title - $album

works fine, while this version

Head: $title
Body: $artist - $album

throws a blank.

If only the title has a special character, everything works fine, no matter how the @title field is combined.

I hope this helps.

Report

meerkat

7 years ago

thanks for the detailed description. i have no idea why those encoding problems occur and i sadly cant test on them, because on my system everything works fine. nevertheless ill look into it when i find time to. in the meantime you can test this little hack, that may solve your specific problem, but also may cause other:
http://mantis.blogsport.de/images/NotifyAmarok1.1.amarokscript.tar.gz

Report

apolodor

7 years ago

I did not try to use version 1.1 until I have updated to KDE 4.3 RC3 and NotifyAmarok stopped working altogether.

The interesting thing in KDE 4.3 RC3 is the developers unified the notification system, so even the notifications sent through notify-osd appear through the KDE notification system. Something in this change made NotifyAmarok 1.0 stop working, so I updated to 1.1 from the link you gave me.

The good news:
- It is working again!
- The characters with accents are no longer a problem!

The ??? news:
- The notifications appear through KNotify. This means (I think) that using the Gnome-style notifications under KDE 4.3 is out of the question. Personally, I do not have a problem with that (I'm interested in the quality of the notifications, not the format, and a unified format appeals to my sense of order), but others might have.
- Right now, NotifyAmarok and amaroKnotify looks quite similar under KDE, but your script is still a lot more configurable.

The bad news:
- The line breaks ($n) are replaced with simple white spaces.
- The album cover is not shown - the default KDE "missing" icon is shown instead. Though, if the album has no cover, the default "nocover" image IS shown! A bug, maybe? Also, the image shown is very, very small, because of the placement in the notification format.
- Instead of appearing, staying on screen for the set time, and then disappearing, the notification appears for a second, disappears, appears again for a second, disappears again, and the cycle keeps repeating for the set time.

I hope this helps. You have done a great job with this script and I long to see it perfected.

Report

meerkat

7 years ago

i have checked on kubuntu karmic alpha and can confirm all your observations. well it seems kde is starting to support the freedesktop notification interface which is good news for the integration of gnome software in kde and vice versa (examples: http://www.kdedevelopers.org/node/4028).
there still seems to be some bugs though but im confident theyll be fixed till karmic final in october. the only thing i can do in the meantime is prevent the blinking by deactivating the update if knotify is used and maybe fix the image problem. ill try that sometime next week.
thanks for your detailed report on the problems with kde 4.3.

Report

apolodor

7 years ago

I managed to fix the issue of the notification appearing, disappearing, appearing, etc. by changing time.sleep(0.98) into time.sleep(10) in notify.py.

Still, I realized that the displaying time of the notification is not the one specified in the settings, but probably the one default for KDE (about 3 seconds).

Report

meerkat

7 years ago

good thinking. i just realized that i havent commented my sourcecode at all - i should add some comment in the next release. you actually changed the update interval from nearly 1 sec to 10 sec which prevents the blinking as long as the duration is < 10 sec. the duration time falls back to default this way, ill handle that together with the other issues in my next release.

Report

alexbuzeta

8 years ago

I use Amarok 2.1 Beta 1 and Ubuntu

You could fix it, please?

Report

meerkat

8 years ago

thanks for the hint, i'll investigate why that is the case

Report

meerkat

8 years ago

I tested with Amarok 2.1 Beta 2 on Ubuntu 9.04 and the new version (1.0) works fine there. Dont know why the previous version didnt work, but it used a lot more of the Amarok Script API, maybe something changed there. Please test if the new version works on your system as well.

Report

alexbuzeta

8 years ago

Now it works!

I installed the final version of Amarok 2.1 and NotifyAmarok 1.0 and works great

Thanks for the help!

Report

zeratul2099

7 years ago

Works great here with Amarok 2.1 and Ubuntu 9.04.
Thanks for the app :)

Report

finifly

7 years ago

It's not working with mine. I'm on Jaunty 64 and have Amarok 2.1.1.

Report

meerkat

7 years ago

i checked on jaunty 64bit live cd with amarok 2.1.1 and everything worked fine. did you activate the script in the script manager (check the checkbox)? could you please specify the problem: does it install / show up in the script manager? what exactly is not working? etc.

Report

finifly

7 years ago

Yes I have installed it. I tried from the script download window in amarok and this site. And yes the check box is checked. After restarting amarok, nothing shows up.

Report

finifly

7 years ago

Sorry, I didn't actually realize that this is for Gnome. I use KDE. Sorry about that!

Report

meerkat

7 years ago

the script was originally created for gnome, but it works with kde as well, see here:
http://www.kde-apps.org/content/show.php?action=knowledgebase&content=103307&kbid=73
note that the above is only true for kde versions before the new kde 4.3, that just was released a week ago. for kde 4.3 you wont need any additional packages, as knotify now implements the dbus api my script uses. unfortunately there are some serious issues with that (see apoldors posts below), so if you are on kde 4.3 please wait till they are fixed or i released a temporary workaround which i will implement as soon as i find time for that.

Report

8 years ago

1.0
Major development step with stunning new features ;)
* Full Configurable Notification Title, Body and Duration with all song information available and nice unicode symbols
* A nice Help Window that (i hope) explains the configuration accurately
* set Keybinding to trigger a notification when ever you wonder which song is playing atm (though not very straightforward yet) see "Questions and Answers" for Details
* finally just using the same cover images Amarok does without searching for fitting covers
* new code concept/structure that benefits future development of more new features
* now works on Amarok 2.1 Beta as well

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install
Score 46%
46.00 Likes
54 Dislikes
Details
version
1.0
updated Jun 03 2009
added Apr 22 2009
downloads
page views 721