Bug 260750 - script bindings for knotify
Summary: script bindings for knotify
Alias: None
Product: amarok
Classification: Unclassified
Component: Notifications (show other bugs)
Version: 2.3.0
Platform: Ubuntu Packages Linux
: NOR wishlist (vote)
Target Milestone: 2.4.0
Assignee: Amarok Developers
Depends on:
Reported: 2010-12-20 00:34 UTC by William Howard
Modified: 2011-06-06 01:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.4.2


Note You need to log in before you can comment on or make changes to this bug.
Description William Howard 2010-12-20 00:34:53 UTC
Version:           2.3.0 (using KDE 4.4.2) 
OS:                Linux

As a script developer I'd like API access to KNotify through the Script API.  

Current hack implementations do:

pass to a python script which uses DBus - http://kde-apps.org/content/show.php/amaroKnotify?content=103197

use "notify-send" with QProcess - https://github.com/whoward/amarok-collection_rating/blob/master/collection-ratings/classes/notifications.js

These techniques work on most systems but are brittle because:
(Python Technique)
1/ they rely on python being installed
2/ they rely on having permission to chmod +x the python script

(QProcess Technique)
1/ they require libnotify-bin to be installed

1/ Will likely not function cross platform (i.e. Windows)

Reproducible: Didn't try

Steps to Reproduce:

Actual Results:  

Expected Results:  
Several solutions:
1/ Bind a notify function to the Amarok global so we can call:
Amarok.knotify("some title", "some body")

2/ Bind access to dbus? not sure if this will work - i dont know much about dbus

3/ other options?
Comment 1 Myriam Schweingruber 2010-12-20 03:30:36 UTC
William, could you please update to Amarok 2.3.2? Your version is quite a bit old already.
Comment 2 Kevin Funk 2010-12-21 19:17:27 UTC
@Myriam: Version does not matter here, this feature is still missing.

@William: Will have a look at this feature request after release.
Comment 3 Kevin Funk 2011-06-06 01:53:38 UTC
Git commit 83533cb9720d0545e26cc01492fed2e98994ea75 by Kevin Funk.
Committed on 06/06/2011 at 01:48.
Pushed by kfunk into branch 'master'.

Add scripting interface for KNotify

Currently supports two methods:
* show(titleStr, bodyStr[, pixmap]);
* showCurrentTrack();

BUG: 260750
FIXED-IN: 2.4.2

M  +1    -0    ChangeLog     
M  +1    -0    src/CMakeLists.txt     
M  +17   -3    src/KNotificationBackend.cpp     
M  +3    -2    src/KNotificationBackend.h     
M  +2    -0    src/ScriptManager.cpp     
A  +68   -0    src/scriptengine/AmarokKNotifyScript.cpp         [License: GPL (v2+)]
A  +49   -0    src/scriptengine/AmarokKNotifyScript.h         [License: GPL (v2+)]