Re: [Banshee-List] How to detect whether a track is skipped
- From: Bertrand Lorentz <bertrand lorentz gmail com>
- To: banshee-list gnome org
- Subject: Re: [Banshee-List] How to detect whether a track is skipped
- Date: Mon, 16 May 2011 23:33:27 +0200
On Sun, May 15, 2011 at 10:03 AM, Chen Tao <pro711 gmail com> wrote:
> Hello everyone,
> I'm writing an extension for douban.fm, an internet radio station similar to
> Pandora. The station tunes the music to the listener's taste by user
> feedback - "like", "dislike" or "skip". My extension plays the radio in
> Banshee and I have to distinguish whether a song played to the end or the
> user hit "Next" button and skipped it.
> I looked at Banshee.MediaEngine.PlayerEvent and tried the following
> events: RequestNextTrack, StartOfStream, EndOfStream. My code is like this:
>>
>> ServiceManager.PlayerEngine.ConnectEvent(Next,
>> PlayerEvent.RequestNextTrack);
>> ServiceManager.PlayerEngine.ConnectEvent(FinishSong,
>> PlayerEvent.EndOfStream);
>> ServiceManager.PlayerEngine.ConnectEvent(StartSong,
>> PlayerEvent.StartOfStream);
>
> RequestNextTrack does not seem to distinguish between the two
> cases. StartOfStream is triggered when a song starts playing. I thought
> EndOfStream would be triggered when a song is played to the end, but it
> didn't. So I can't find a solution to my problem.
> Can anyone help?
You might be able to use the TrackInfo.PlaybackFinished event,
especially if you're sub-classing TrackInfo. It will give you the
percentage of the track that was played.
See for example what is done for podcasts, to mark them as read :
http://git.gnome.org/browse/banshee/tree/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastTrackInfo.cs#n177
--
Bertrand Lorentz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]