rhythmbox r6170 - in trunk: . shell



Author: jmatthew
Date: Sat Feb 28 01:12:05 2009
New Revision: 6170
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6170&view=rev

Log:
2009-02-28  Jonathan Matthew  <jonathan d14n org>

	* shell/rb-play-order-random-by-age-and-rating.c:
	(rb_random_by_age_and_rating_get_entry_weight):
	* shell/rb-play-order-random-by-age.c:
	(rb_random_by_age_get_entry_weight):
	Treat the current playing entry as having been played 0 seconds ago,
	rather than using the value from the last-played field, which only
	reflects the last time the entry was played.  Fixes #164250, more or less.


Modified:
   trunk/ChangeLog
   trunk/shell/rb-play-order-random-by-age-and-rating.c
   trunk/shell/rb-play-order-random-by-age.c

Modified: trunk/shell/rb-play-order-random-by-age-and-rating.c
==============================================================================
--- trunk/shell/rb-play-order-random-by-age-and-rating.c	(original)
+++ trunk/shell/rb-play-order-random-by-age-and-rating.c	Sat Feb 28 01:12:05 2009
@@ -75,15 +75,23 @@
 {
 	time_t now;
 	gulong last_play;
-	gulong seconds_since_last_play;
+	gulong seconds_since_last_play = 0;
 	gdouble rating;
+	RhythmDBEntry *playing_entry;
 
 	/* This finds the log of the number of seconds since the last play.
 	 * It handles never played automatically, since now-0 is a valid
 	 * argument to log(). */
 	time (&now);
-	last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
-	seconds_since_last_play = now - last_play;
+
+	playing_entry = rb_play_order_get_playing_entry (RB_PLAY_ORDER (rorder));
+	if (playing_entry != entry) {
+		last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
+		seconds_since_last_play = now - last_play;
+	}
+	if (playing_entry != NULL)
+		rhythmdb_entry_unref (playing_entry);
+
 	/* The lowest weight should be 0. */
 	if (seconds_since_last_play < 1)
 		seconds_since_last_play = 1;

Modified: trunk/shell/rb-play-order-random-by-age.c
==============================================================================
--- trunk/shell/rb-play-order-random-by-age.c	(original)
+++ trunk/shell/rb-play-order-random-by-age.c	Sat Feb 28 01:12:05 2009
@@ -73,15 +73,23 @@
 {
 	time_t now;
 	gulong last_play;
-	gulong seconds_since_last_play;
+	gulong seconds_since_last_play = 0;
+	RhythmDBEntry *playing_entry;
 
 	/* This returns the log of the number of seconds since the last play.
 	 * It handles never played automatically, since now-0 is a valid
 	 * argument to log(). */
 
 	time (&now);
-	last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
-	seconds_since_last_play = now - last_play;
+
+	playing_entry = rb_play_order_get_playing_entry (RB_PLAY_ORDER (rorder));
+	if (playing_entry != entry) {
+		last_play = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_LAST_PLAYED);
+		seconds_since_last_play = now - last_play;
+	}
+	if (playing_entry != NULL)
+		rhythmdb_entry_unref (playing_entry);
+
 	/* The lowest weight should be 0. */
 	if (seconds_since_last_play < 1)
 		seconds_since_last_play = 1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]