This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] time and mtime behavior changed?

Tags: mpris, dbus, scripting, bug? mpris, dbus, scripting, bug? mpris, dbus, scripting, bug?
(comma "," separated)
jseabold
Registered Member
Posts
7
Karma
0
Hello all,

I had a script that worked (I believe) for Amarok 2.2, but when I updated to 2.2.1 (from backports repo for kubuntu 9.10) it no longer works. I use python's dbus module to interact with Amarok, and I don't know if this is a python issue (occurs in python 2.5.4 and 2.6.4) or an amarok issue. The script is pretty simple and the only thing that seems to no longer work is my status bar implementation in my script, which uses 'mtime'. Come to think of it, the times don't display correctly in my playlist either (all are 0:00), so forgive me if this is a known issue.

Below is part of my python script. Curious is anyone can replicate this or point me in the right direction for a fix. If not, maybe I should file a bug?

--

import dbus
bus = dbus.SessionBus()
obj = bus.get_object('org.mpris.amarok', '/Player')
mtd = obj.get_dbus_method('GetMetadata', 'org.freedesktop.MediaPlayer')
nfo = mtd()
a = obj.get_dbus_method('PositionGet', 'org.freedesktop.MediaPlayer')
b = a()
print float(b) / float(nfo['mtime'])

Which should print the percentage of the song that has been played, but on closer inspection


a()
#dbus.Int32(50791)
# which is correct, but . . .
nfo['mtime']
#dbus.Int64(237L, variant_level=1)
# or
float(nfo['mtime'])
#237.0
nfo['time']
#dbus.Int64(0L, variant_level=1)

Which is clearly not the length of the song in milliseconds. It seems that it's not being interpreted as (or given?) an uint32. Any help would be appreciated.

Last edited by jseabold on Mon Jan 04, 2010 3:39 pm, edited 1 time in total.
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS
Known issue, solution:


Menu -> Settings -> Configure Amarok -> Collection -> Fully Rescan Collection.


--
Mark Kretschmann - Amarok Developer
jseabold
Registered Member
Posts
7
Karma
0
Thanks that did the trick.

In case anyone comes across this, you need to restart afterwards, of course.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]