Re: [Banshee-List] Patch: delay now-playing submission
- From: Wade Menard <wade ezri org>
- To: banshee-list gnome org
- Subject: Re: [Banshee-List] Patch: delay now-playing submission
- Date: Mon, 03 Mar 2008 23:34:54 -0500
Sorry for the spam. I realized the bools could be consolidated.
--
Index:
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
===================================================================
---
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs (revision 3371)
+++
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs (working copy)
@@ -63,6 +63,7 @@
private Account account;
private bool queued; /* if current_track has been queued */
+ private bool nowplaying_watch; /* if NowPlaying should be
watched for */
private DateTime song_start_time;
private TrackInfo last_track;
@@ -227,16 +228,17 @@
st.Reset ();
song_start_time = DateTime.Now;
last_track =
ServiceManager.PlayerEngine.CurrentTrack;
- queued = false;
-
- // Queue as now playing
+ queued = false;
+
+ // check if we should have Iterate: watch and
submit NowPlaying
if (last_track != null &&
last_track.Duration.TotalSeconds > 30 &&
(actions["AudioscrobblerEnableAction"] as
ToggleAction).Active) {
- connection.NowPlaying (last_track.ArtistName,
last_track.TrackTitle,
- last_track.AlbumTitle,
last_track.Duration.TotalSeconds, last_track.TrackNumber);
+ nowplaying_watch = true;
+ } else {
+ nowplaying_watch = false;
}
-
+
break;
case PlayerEngineEvent.Seek:
@@ -245,6 +247,15 @@
case PlayerEngineEvent.Iterate:
st.IncreasePosition ();
+
+ // see if we should submit NowPlaying yet
+ if (nowplaying_watch &&
ServiceManager.PlayerEngine.Position > 4000) {
+
+ connection.NowPlaying (last_track.ArtistName,
last_track.TrackTitle,
+ last_track.AlbumTitle,
last_track.Duration.TotalSeconds, last_track.TrackNumber);
+
+ nowplaying_watch = false;
+ }
break;
case PlayerEngineEvent.EndOfStream:
Index: src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
===================================================================
--- src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs (revision 3371)
+++ src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs (working copy)
@@ -63,6 +63,7 @@
private Account account;
private bool queued; /* if current_track has been queued */
+ private bool nowplaying_watch; /* if NowPlaying should be watched for */
private DateTime song_start_time;
private TrackInfo last_track;
@@ -227,16 +228,17 @@
st.Reset ();
song_start_time = DateTime.Now;
last_track = ServiceManager.PlayerEngine.CurrentTrack;
- queued = false;
-
- // Queue as now playing
+ queued = false;
+
+ // check if we should have Iterate: watch and submit NowPlaying
if (last_track != null && last_track.Duration.TotalSeconds > 30 &&
(actions["AudioscrobblerEnableAction"] as ToggleAction).Active) {
- connection.NowPlaying (last_track.ArtistName, last_track.TrackTitle,
- last_track.AlbumTitle, last_track.Duration.TotalSeconds, last_track.TrackNumber);
+ nowplaying_watch = true;
+ } else {
+ nowplaying_watch = false;
}
-
+
break;
case PlayerEngineEvent.Seek:
@@ -245,6 +247,15 @@
case PlayerEngineEvent.Iterate:
st.IncreasePosition ();
+
+ // see if we should submit NowPlaying yet
+ if (nowplaying_watch && ServiceManager.PlayerEngine.Position > 4000) {
+
+ connection.NowPlaying (last_track.ArtistName, last_track.TrackTitle,
+ last_track.AlbumTitle, last_track.Duration.TotalSeconds, last_track.TrackNumber);
+
+ nowplaying_watch = false;
+ }
break;
case PlayerEngineEvent.EndOfStream:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]