google-code-export / pidgin-musictracker

Automatically exported from code.google.com/p/pidgin-musictracker
GNU General Public License v2.0
1 stars 1 forks source link

Remove MPRIS polling #161

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've just added an mpris interface to my music player
(http://code.google.com/p/gogglesmm/). Now I've noticed that musictracker
keeps polling my music player every couple of seconds with a GetStatus and
GetPosition messages. 

Looking at the source code, it does subscribe to status change events, so
why does it still poll?

The GetPosition isn't really necessary either, you could easily rely your
own timer once you know a track has started playing.

Please change musictracker to use status change messages only and disable
polling.

Original issue reported on code.google.com by s.jansen on 21 Aug 2009 at 6:50

GoogleCodeExporter commented 9 years ago
> Looking at the source code, it does subscribe to status change events, so
why does it still poll?

Because other players have bugs :-)

Some players don't emit the signals correctly, or don't emit them in certain 
edge
cases (e.g. the player being closed).  I also need to deal with the edge case 
where
the player is already started and playing a long-duration track when 
musictracker is
loaded.

> The GetPosition isn't really necessary either, you could easily rely your
own timer once you know a track has started playing.

I really don't see this as simplifying.  The music player implicitly knows 
where we
are in the track, why should I try to guess where we are myself (going wrong in 
edge
cases like the user requesting the player to move backwards or forwards in the 
track)
rather than asking the player?

> polling my music player every couple of seconds

The polling interval should be 10 seconds (or 15 seconds since 0.4.15).  If you 
feel
this is too rapid, can you please explain why.

>Please change musictracker to use status change messages only and disable 
polling.

I don't think I can do this right now.  I do have some plans to rewrite things 
to
make the track information retrival asynchronous (but there are some non-trivial
difficulties doing this within pidgin) and I will consider these issues then. 

That said, patches considered, obviously :-)

Original comment by b152fee4...@gmail.com on 2 Sep 2009 at 8:08

GoogleCodeExporter commented 9 years ago
Ofcourse, working around other peoples bugs is not always nice. :) 

Getting the initial status when pidgin-musictracker first starts up makes 
ofcourse
sense, but after that, status change messages really should suffice. 

To detect  when players close or exit, I suggest you use the NameOwnerChanged 
signal
from org.freedesktop.DBus.

Regarding the position, is it really that necessary to even display this? 
Unless you
poll every second, it's always inaccurate anyways.

Original comment by s.jansen on 3 Sep 2009 at 3:52