Bug 10499 - Scanner and progress use different time formats
: Scanner and progress use different time formats
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Scanner
: 7.3.2
: PC Debian Linux
: P3 normal (vote)
: 7.3.3
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-30 12:37 UTC by Marc Auslander
Modified: 2009-06-17 09:36 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments
diffs of changes probably not in right patch form (1.98 KB, text/plain)
2009-01-08 08:13 UTC, Marc Auslander
Details
better fix for contoller (1.98 KB, patch)
2009-01-09 15:38 UTC, Marc Auslander
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Auslander 2008-12-30 12:37:58 UTC
The scanner displays time in minute:second format, even when minute exceeds 60.
The elapsed and total time displays are in hour:minute:second format.

I find this a pain since I have to convert back and forth in my head, particularly if I want to remember a position and later return to it.

I don't have a strong preference for which format to use, but I really think they ought to be the same.  I'd choose hour:minute:second if asked.

This shows up in both the SB3 and Controller, so I assume it's coming from SC.
Comment 1 Michael Herger 2009-01-02 10:34:06 UTC
Are you talking about the scanner which does the music inventory or the song scanner which allows you to ffwd/rwd within a song?
Comment 2 Marc Auslander 2009-01-02 10:46:41 UTC
The song scanner which does ffwd/rew.

It shows current position and total size using the mm:ss format.  I'm suggesting it should use the same format as the now playing position information.
Comment 3 Michael Herger 2009-01-04 23:29:21 UTC
Alan - is this something obvious in the song scanner code?
Comment 4 Alan Young 2009-01-05 08:41:50 UTC
SongScanner users the following hard-wired format statement:

sprintf("%01d:%02d / %01d:%02d", $pos / 60, $pos % 60, $dur / 60, $dur % 60);

What would be better?
Comment 5 Chris Owens 2009-01-05 09:45:32 UTC
Dean says we should use hours if they're there.  Michael asks this be assigned to him.
Comment 6 Marc Auslander 2009-01-05 14:41:39 UTC
For SB3, its pretty easy, although not tested except on SB3. Change so SongScanner/Plugin.pm

85c85,97
< 		    return sprintf("%01d:%02d / %01d:%02d", $pos / 60, $pos % 60, $dur / 60, $dur % 60);
---
> 			my $durpos;
> 			if (int($pos / 3600) > 0) {
> 			    $durpos = sprintf("%01d:%02d:%02d / ", $pos / 3600, ($pos % 3600) / 60, $pos % 60);
> 			} else {
> 			    $durpos = sprintf("%01d:%02d / ", $pos / 60, $pos % 60);
> 			}
> 			if (int($dur / 3600) > 0) {
> 			    $durpos = $durpos . sprintf("%01d:%02d:%02d", $dur / 3600, ($dur % 3600) / 60, $dur % 60);
> 			} else {
> 			    $durpos = $durpos . sprintf("%01d:%02d", $dur / 60, $dur % 60);
> 			}
> 
> 			return $durpos;

For the controller, its harder.  Its easy to make the same change to the strings:

in Scanner.lua

--- Scanner.lua.orig	1969-12-31 19:00:00.000000000 -0500
+++ Scanner.lua	2009-01-05 17:17:23.000000000 -0500
@@ -48,9 +48,12 @@
 module(..., oo.class)
 
 local function _secondsToString(seconds)
-	local min = math.floor(seconds / 60)
-	local sec = math.floor(seconds - (min*60))
-
+	local hour = math.floor(seconds / 3600 )
+	local min = math.floor((seconds / 60) - (hour*60))
+	local sec = math.floor(seconds - (min*60) - (hour*3600))
+	if hour > 0 then
+		return string.format("%d:%02d:%02d", hour, min, sec)
+	end
 	return string.format("%d:%02d", min, sec)
 end


but this messes up the spacing in the scanner widget, and I don't know how to fix that.  The field sizes for the times have to be larger by at least one character - one will do for up to 9 hours if I understand what I'm doing at all.


Comment 7 James Richardson 2009-01-07 14:13:22 UTC
Michael: please target appropriately
Comment 8 Marc Auslander 2009-01-08 08:13:07 UTC
Created attachment 4575 [details]
diffs of changes probably not in right patch form
Comment 9 Marc Auslander 2009-01-08 08:15:27 UTC
I've hacked both.  You will want whomever is responsible for the controller
skin to take a look at the tradeoff I made.  I don't see how to right pad only
the elapsed text so I'm wasting a bit of room on the right of the remain
text since both are right padded.

Also - another anomaly I did not change/fix is that the SC SongScanner displays
elapsed/total while the controller scanner displays elapsed / remain time.  If
you want to make them the same you need to choose and than make the obvious
change in the computation.
Comment 10 Marc Auslander 2009-01-08 08:17:55 UTC
One other caveat - I'm not a perl programmer so please look at my perl and see if it's clean.  In particular, the int(.. in the if statement is needed to make it work and I don't understand why - but I don't understand perl type notation :-(
Comment 11 Michael Herger 2009-01-08 08:34:52 UTC
Thanks for the patch! Will test it.
Comment 12 Michael Herger 2009-01-08 08:35:43 UTC
Ben - would you mind taking a look at the SP part of this?
Comment 13 Michael Herger 2009-01-09 05:17:01 UTC
change 24598 - fix time format on SB display
Comment 14 Michael Herger 2009-01-09 05:42:20 UTC
change 3747 - fix time display on SqueezePlay

Thanks for your patch!

One question remains though: while we now have the same hh::mm::s display (if needed), SP uses playtime/remaining, while SC uses playtime/totaltime. Which one should we use?...
Comment 15 Michael Herger 2009-01-09 05:49:56 UTC
change 24601 - use playtime/remaining on the player UI too

Feel free to open a new bug if you don't like it :-)
Comment 16 Marc Auslander 2009-01-09 15:38:34 UTC
Created attachment 4609 [details]
better fix for contoller

Michael - I'm sorry I'm so slow - old age maybe.  Sigh.  In any case, I finally groked the way the scannerGroup widget works, and know how to format it so both times stay close to the scanner bar no matter what size they are.  New diff is attached.
Comment 17 James Richardson 2009-01-14 12:00:51 UTC
Michael: Can you check out Marc's attached patch.
Comment 18 Marc Auslander 2009-01-14 12:23:21 UTC
May latest suggestion was just polish.  And it's different from the now playing progress bar, in that it keeps both values a constant distance from the slider, no matter the size of the values.  

My initial patch kept the elapsed a constant distance away, but not remain.  The now playing does it the other way.  It keeps remain a constant distance and elapsed not.  I'm sorry it took me so long to figure out how to make this stuff work and what it was doing.

If you guys care about this, tell me how you want it to work and I'll post the right patch.  But now playing is too complicated for me to mess with, so I'm not suggesting changing that.

If you want, I can make the scanner look the same as now playing.
Comment 19 Michael Herger 2009-01-15 03:50:17 UTC
Marc - I don't see any difference in the two patches for SqueezePlay. What line did you change?
Comment 20 Marc Auslander 2009-01-15 06:28:50 UTC
Boy I must be a PITA.  Looks like up uploaded the wrong diff the second time.

Before a upload anything, please consider the issues I raised in my last post.  This is now just about details of the layout, and I can't really decide for you.  To repeat, the bar has elapsed - slider - remain.

The choices are:

elapsed and remain both left aligned - so elapsed has a variable space between it and slider as it's size changes.  This is how the current bars work.

elapsed and remain both right aligned - so remain has a variable space.  This is how the patch I dropped works.

elapsed right aligned, remain left aligned - which I think is prettier but doesn't match the now playing progress display.

(given how unimportant this is, if I were you I'd probably leave it alone, or ask me to make it consistent with the way it was).
Comment 21 James Richardson 2009-05-06 15:10:17 UTC
Verified fixed in

SqueezeCenter 7.3.3 r26407
Controller 7.3 r5577
Comment 22 James Richardson 2009-06-17 09:36:07 UTC
This bug has been fixed in the 7.3.3 release version of SqueezeCenter!

If you haven't already. please download the new version from http://www.logitechsqueezebox.com/support/download-squeezecenter.html 

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.