Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

Leading zeros on WinAmp times

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
ehrnam45
Posts: 7
Joined: April 1st, 2006, 10:33 pm

Leading zeros on WinAmp times

Post by ehrnam45 »

Well, I've got everything /but/ the mini spectrum analyser going and i love this software. LCDC was making some wierd issues by only writing to the second row, so I went elsewhere!

Anyway, my display is a MO VK-202-24-USB. There's a lot of stuff to pack into two lines, but I want it to look good as well, as it's going to be the display on my HTPC.

What I have so far is:

Code: Select all

$dll(holdnscroll.dll,1,($WinampTracknr) ,16/$WinampTitle)
$dll(sandr.dll,1,$WinampStat,) $Chr(176) [$WinampPosition(8)]$Right($WinampPosh,$7%)
[/color]

What I would like to be able to do is add leading zeros to the time elapsed/remaining counters from the winamp plugin, like so:

H:MM:SS or 0:02:43

that will make it easier to build around it and squeeze every last box of usefulness. I think that I will need some kind of IF setup, but I can't really find much on how to do it...

I.E.:

Code: Select all

  IF (winampTime <1 hour)
   THEN {display leading zero and semicolon}
     IF (winampTime <1 minute)
       THEN {display leading zeros and semicolon}
     ELSE {just display the time}
  ELSE {just display the time}
  ENDIF
Oh, I want to add a leading zero to the track number too.

Since I've got your attention, what about displaying chapters/scenes for a DVD?

Would this be better suited to the 'plugin feature request' area?
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

Check this plugin :smt026
ehrnam45
Posts: 7
Joined: April 1st, 2006, 10:33 pm

Post by ehrnam45 »

wow, that's some great stuff!

here's the new screeny:

Image

and the code:

Code: Select all

HTPC Rev. 2
$dll(holdnscroll.dll,1,($dll(formatting.dll,1,$WinampTracknr,00)) ,16/$WinampTitle)
$dll(sandr.dll,1,$WinampStat,)$Chr(176) [$WinampPosition(8)] $dll(formatting.dll,1,$WinampPosh,0:00:00)
[/color]

the degree symbol is of course the play/pause/stop custom chars. it really looks so much better to me this way. now to figure out what to do with the square brackets on the position indicator... any suggestions?
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

You can try to combine enallax plugin and split title on the moving part of the hold'n'scroll to alter the title with the artist for lets say 10 seconds! :shock:

Code: Select all

$dll(holdnscroll.dll,1,,($dll(formatting.dll,1,$WinampTracknr,00)) 16/$dll(enallax,10,$dll(splittitle,1,$WinampTitle,),$dll(splittitle,2,$WinampTitle,)))
ehrnam45
Posts: 7
Joined: April 1st, 2006, 10:33 pm

Post by ehrnam45 »

well, after listening to a few tracks (and not really watching the display) i noticed something odd. the split zeros are fine until it hits more than 59 seconds. after that, it throws an error saying that "Param1 must be numeric" did i do something wrong with the formatting.dll?

Also, on the scrolling section, how do i make it start at the left edge of the scrolling area instead of flying in from the far right?
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

I'm not the author of this plugin but I believe that this caused by th ":" character returned by the winamp time.

I will check it more if I fing time...
I have in mind to build a new plugin for this... :wink:
Please be patient
ehrnam45
Posts: 7
Joined: April 1st, 2006, 10:33 pm

Post by ehrnam45 »

I had the same thought driving back from the store. I would use cut.dll, but the :'s are not always present, and the length of the string is varable...

I don't have the tools to compile the plugin, but I have experience in writing code. Let me know if I can be of any help in writing it.
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

Just be patient to find the time first. :wink:
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

There's some discussion in the regexp thread about using regexp to add leading zeroes, although it only went as far as adding leading zeroes for minutes. It's rather convoluted but seems to work. It could be extended to add zeroes for hours, but it's probably better to do a dedicated time formatting plugin.

Perhaps this should be added to the formatting.dll plugin or similar, as a new function something like this:

Code: Select all

$dll(formatting,5,$WinampPosh,HH:MM:SS)
would produce 00:01:32 instead of the 1:32 returned by $WinampPosh

and

Code: Select all

$dll(formatting,5,$WinampPosh,mMM:SS)
would produce 65:19 instead of 1:05:19, or 121:45 instead of 2:01:45, the first (lower case) "m" indicating an optional zero for 100's of minutes. I believe there's a standard formatting system for time in Perl/PHP etc, which could probably be used here.

For me, this would certainly be better (and much more readable!) than

Code: Select all

$dll(regexp,3,0:(\d*):#\1:#:(\d)#:0\1#0(\d\d)#\1,0:$WinampPosh)
which adds a leading zero and colon if necessary for minutes.

Matt.
Post Reply