Bug 18050 - Duration is not shown correctly
: Duration is not shown correctly
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: XML
: 7.7.2
: PC Debian Linux
: -- normal (vote)
: 7.7.x
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-03 13:21 UTC by Ronald Hecht
Modified: 2013-09-12 08:02 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
screen capture: web interface, MOG current playlist (37.85 KB, image/jpeg)
2013-09-11 20:51 UTC, Jim McAtee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald Hecht 2013-09-03 13:21:54 UTC
The array Slim::Control::XMLBrowser::mapAttributes has a bug when showing the duration of a track. It misses the 'Duration' item when printing out.

The suggested fix is:

	{key => 'duration', args => ['LENGTH'],
		func => sub {
			my ($value, @args) = @_;
-			return sprintf('%s: %s:%02s', int($value / 60), $value % 60);
+			return sprintf('%s: %s:%02s', $args[0], int($value / 60), $value % 60);
		},
	},
Comment 1 Michael Herger 2013-09-05 12:50:02 UTC
Thanks for the heads up. I had fixed this in 7.8 while working on the Podcast plugin, but never backported the fix to 7.7... Now in 7.7.4.

commit 6d9fea0fd31b48156c90bec0f55737ef6c59cc11
Comment 2 Jim McAtee 2013-09-08 03:51:52 UTC
When playing MOG, the duration displayed in the web interface's current playlist is in total seconds rather than being formatted. Is this related in any way?
Comment 3 Michael Herger 2013-09-09 08:40:08 UTC
> When playing MOG, the duration displayed in the web interface's current
> playlist is in total seconds rather than being formatted. Is this related in
> any way?

Ahm... where is the total play time shown?
Comment 4 Ronald Hecht 2013-09-11 14:50:51 UTC
I agree with McAtee. When the web interface of SLIM is showing the track info of remote tracks (no action items defined) the duration is shown in seconds. It looks like this:

Title:	Psalm
URL:	googlemusic:track:48215639-8fd0-3afd-ac87-5dbcdf8d3785
Bitrate:	320 kbps
Duration:	395

I was trying to find the place where this output is generated, but without success.
Comment 5 Michael Herger 2013-09-11 15:04:11 UTC
> I agree with McAtee. When the web interface of SLIM is showing the track
> info of remote tracks (no action items defined) the duration is shown in
> seconds. It looks like this:
> 
> Duration:	395

This is implemented in the service's protocol handler. As you're using a 3rd party plugin please get in touch with its author.

Jim was talking about a total playlist type - which I don't know where he's seeing.
Comment 6 Jim McAtee 2013-09-11 20:51:53 UTC
Created attachment 7703 [details]
screen capture: web interface, MOG current playlist

This is in the web interface, current playlist. Set to 'Hide Artwork', with a title format of 'TRACKNUM. TITLE (DURATION)'.
Comment 7 Ronald Hecht 2013-09-12 07:12:11 UTC
(In reply to comment #6)
> This is in the web interface, current playlist. Set to 'Hide Artwork', with
> a title format of 'TRACKNUM. TITLE (DURATION)'.

I agree on this.
Comment 8 Ronald Hecht 2013-09-12 07:16:14 UTC
(In reply to comment #5)
> > Duration:	395
> 
> This is implemented in the service's protocol handler.

It is not implemented in the protocol handler. It is the default web interface track info page (not Menu::TrackInfo), which fetches the information from the opml feed, where I set the duration in seconds. It looks like this:


my $menu = {
		'name'     => $track->{'title'},
		'line1'    => $track->{'title'},
		'url'      => $track->{'uri'},
		'image'    => Plugins::GoogleMusic::Image->uri($track->{'albumArtUrl'}),
		'secs'     => $secs,
		'duration' => $secs,
		'bitrate'  => 320,
		'type'     => 'audio',
		'play'     => $track->{'uri'},
		'playall'  => $playall,
	};

> As you're using a 3rd
> party plugin please get in touch with its author.

I'm the author of this ;-)
Comment 9 Ronald Hecht 2013-09-12 07:28:20 UTC
(In reply to comment #4)
> Title:	Psalm
> URL:	googlemusic:track:48215639-8fd0-3afd-ac87-5dbcdf8d3785
> Bitrate:	320 kbps
> Duration:	395
> 
> I was trying to find the place where this output is generated, but without
> success.

Finally, I found the root cause of this. It is in HTML/EN/xmlbrowser_details.html

	[% IF streaminfo.item.duration %]
		[% item = streaminfo.item.duration | html; title = "LENGTH"; PROCESS songInfoItem %]
	[% END %]
Comment 10 Ronald Hecht 2013-09-12 07:43:36 UTC
Thinking of this, brings me to the idea that Slim::Control::XMLBrowser::mapAttributes is wrong and HTML/EN/xmlbrowser_details.html is correct. The attribute duration should be formatted like %s:%02s as in Slim::Menu::TrackInfo. Thus Slim::Control::XMLBrowser::mapAttributes should look like

	{key => 'duration', args => ['LENGTH'],
		func => sub {
			my ($value, @args) = @_;
			return sprintf('%s: %s', $args[0], $value);
		},
	},
Comment 11 Michael Herger 2013-09-12 07:50:44 UTC
> It is not implemented in the protocol handler. It is the default web

Then you should change it ;-).

> interface track info page (not Menu::TrackInfo), which fetches the

What's the "default web interface track info page"? The default page handler as I know it _does_ call Slim::Menu::TrackInfo to get that information.

> information from the opml feed, where I set the duration in seconds. It
> looks like this:

I'm not sure yet how exactly that information is routed. But what would happen if you removed the duration value from that hash? Or made it the formatted value? IIRC secs should be good enough to get the numerical duration if needed.


JJZolx' case (Now Playing playlist) shold be fixed now in 7.8 (commit 59809d935f3d70a08472f782cc934439f1fc13ae).
Comment 12 Ronald Hecht 2013-09-12 08:02:59 UTC
(In reply to comment #11)
> > It is not implemented in the protocol handler. It is the default web
> 
> Then you should change it ;-).

... in the near future, yes :-)

> 
> > interface track info page (not Menu::TrackInfo), which fetches the
> 
> What's the "default web interface track info page"? The default page handler
> as I know it _does_ call Slim::Menu::TrackInfo to get that information.

As stated earlier, the comes from HTML/EN/xmlbrowser_details.html

> I'm not sure yet how exactly that information is routed. But what would
> happen if you removed the duration value from that hash?

If I remove it, it disappears.

> Or made it the
> formatted value?

If I format it, it looks correct, but the controller does not show the correct duration. That's why I think the Slim::Control::XMLBrowser::mapAttributes should NOT format it.