Latest WACUP public preview for x86 & x64 is build #20202 (September 28th 2024) (x86 & x64 changelogs)
Latest restricted WACUP beta release is build #20202 (September 28th 2024) (x86 & x64 changelogs)


NOTE: Beta testers are added in a limited & subjective manner as I can only support so many people as part of the beta test program to keep it useful for my needs.

Unless I think you're going to be helpful, not all requests will be accepted but might still be later on. Remember that beta testing is to help me & the limitations currently works for my needs for this project.

Author Topic: How to display elapsed time in percentage?  (Read 7085 times)

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
How to display elapsed time in percentage?
« on: July 06, 2021, 12:28:18 PM »
Say there is a one minute long song of which 12 seconds has been played so far. How do you display in a text tag that 20 percent of the song has been played so far?

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 4768
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: How to display elapsed time in percentage?
« Reply #1 on: July 06, 2021, 02:59:18 PM »
Not quite following the point of the question & where it'd be being displayed.

Would just be (12 *100) / (1 * 60) to get the percentage (if you get the time in seconds then you don't have to mess around with conversions).

-dro

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #2 on: July 06, 2021, 06:07:37 PM »
The idea is to display elapsed time in percentage of song length. Meanwhile, I figured it out and posted the script in the MAKIs thread.

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 4768
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: How to display elapsed time in percentage?
« Reply #3 on: July 06, 2021, 06:35:50 PM »
Ok, the 'text tag' was what confused me.

-dro

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #4 on: September 21, 2021, 01:38:32 AM »
Hi ariszlo,

How do I get a skin to use this script and is it for the classic or modern skins?
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system

Eris Lund

  • The Skin Guy, Official Modern Skin tech support
  • Moderator
  • Hero Member
  • *****
  • Posts: 302
    • View Profile
    • Eris Lund's Github
Re: How to display elapsed time in percentage?
« Reply #5 on: September 21, 2021, 05:48:29 AM »
Classic Skins cannot make use of MAKI scripts that're found in Modern Skins
Maker of Plugins, I suppose.
gen_native:
https://github.com/0x5066/gen_native
vis_sdl2:
https://github.com/0x5066/WinampVis
(I know, creative names)

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #6 on: September 21, 2021, 08:08:20 AM »
Ok, but I still need to know how to use it in my modern skins.
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #7 on: September 21, 2021, 01:54:57 PM »
seekpercentage.m says it all.

Add a text tag and a script tag to your xml like this (with your own values for x, y, etc.):

<text
  id="SeekPercentage"
  display=""
  x="100" y="100" w="100" h="32" align="center"
  fontsize="32" color="255,255,255"
/>
<script id="seekpercentage" file="scripts/seekpercentage.maki"/>


And then copy seekpercentage.maki into the scripts folder.

Or if you want to use it as a tooltip while hovering over the seeker then look inside my Study Skin.

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #8 on: September 22, 2021, 01:38:03 AM »
I keep getting script errors saying null object called. Is there a particular .xml file I'm supposed to add the text tag and script tag to?

I then tried the tooltip version from your study skin. I added the layer, text and script tags to the player.xml file and the seekerpopup.maki file to the scripts folder for the skin I'm using. I don't get any script errors, but I also don't get a tooltip while hovering over the seeker.
« Last Edit: September 22, 2021, 02:08:11 AM by Aminifu »
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #9 on: September 22, 2021, 06:48:43 AM »
I keep getting script errors saying null object called.

It only calls the text tag with the "SeekPercentage" id. Have you changed its id to something else?

Is there a particular .xml file I'm supposed to add the text tag and script tag to?

I don't think there is but I had it in the xml with the play button and the songticker.

I then tried the tooltip version from your study skin. I added the layer, text and script tags to the player.xml file and the seekerpopup.maki file to the scripts folder for the skin I'm using. I don't get any script errors, but I also don't get a tooltip while hovering over the seeker.

Have you defined a png for seeker.popup.bg?

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #10 on: September 22, 2021, 07:47:03 AM »
I first tried to get the script working with Victhor's Komodo X Touchscreen v1.0 skin. I did a copy and paste from your reply #7 above. I didn't rename anything. But, I rather use the pop-up version anyway.

I'm now trying to get the pop-up version to work with Denis' Defix Hi-End v1.6.2 skin. This skin doesn't have a "PNG" folder. It uses a folder called "Data" to store it's png files. First I copied the "tooltip-popups.png" file to this folder and used it's name in the "bitmap id" line below. When this didn't work, I made a "PNG" folder for the skin and copied all the files from your Study Skinning skin's "PNG" folder to it. This also is not working. I'm probably defining the png for the "seeker.popup.bg" incorrectly. I currently have the following in the skin's "player.xml" file.


    <!-- The following four tags are only needed if using seekerpopup,
      an optional script popping up a tooltip to display the elapsed time
      in percentage of the song length when hovering over the seeker.
    -->

    <bitmap id="seeker.popup.bg" file="png/tooltip-popups.png" x="0" y="0" w="190" h="40"/>

    <layer
      id="Seeker Popup Background"
      x="230" y="296"
      image="seeker.popup.bg"
      alpha="0" ghost="1"
     />

    <text
      id="Playback Percentage"
      display=""
      x="234" y="300" w="182" h="32" align="center"
      fontsize="26" color="0,0,0"
      alpha="0" ghost="1"
     />

    <script id="seekerpopup" file="scripts/seekerpopup.maki"/>
« Last Edit: September 22, 2021, 08:11:47 AM by Aminifu »
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #11 on: September 22, 2021, 07:47:44 PM »
You should have the following line somewhere after an <elements> line and somewhere before an </elements> line:

<bitmap id="seeker.popup.bg" file="png/tooltip-popups.png" x="0" y="0" w="190" h="40"/>

Defix Hi-End 163_Beta has two xml files with <elements> lines: Elements.xml and System-elements.xml. Choose either of them for the above bitmap definition.

You do not need to create a PNG folder. If you change the bitmap definition like below then you can put tooltip-popups.png into the Data folder:

<bitmap id="seeker.popup.bg" file="Data/tooltip-popups.png" x="0" y="0" w="190" h="40"/>

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #12 on: September 23, 2021, 07:30:53 AM »
Hi ariszlo,

The pop-up is still not working for me. I put the bitmap definition in "Elements.xml" in the first group of lines between <elements> and </elements>. I tried it with and without the bitmap definition also in the "Player.xml" file. I have not moved "tooltip-popups.png" to the Data folder and deleted the PNG folder I added. I want to get this working first.
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system

ariszlo

  • Moderator
  • Hero Member
  • *****
  • Posts: 236
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #13 on: September 24, 2021, 07:08:41 PM »
Hi Aminifu,

Find attached the files for Winamp Classic Modern and Defix. The xml tags and seekerpopup.m had to be rewritten for both Defix and Winamp Classic Modern. In Defix, the Seeker is covered by SeekerGhost so I had to rewrite the script to call SeekerGhost rather than Seeker. Winamp Classic Modern uses other id's for its seekers, so I had to rewrite the script for it, too.

Adapting seekerpopup for Komodo would require more time than I have.

Aminifu

  • Beta Tester
  • Hero Member
  • *****
  • Posts: 1199
    • View Profile
Re: How to display elapsed time in percentage?
« Reply #14 on: September 25, 2021, 08:25:31 AM »
Hi ariszlo,

Thank you for redoing the tags and scripts. It's a great idea you had to display elapsed time in percentage. Sorry my skin choices made extra work for you. No worries about Komodo. With all the script errors I saw, I expected getting this to work with Komodo would not be quick or easy.
« Last Edit: September 25, 2021, 08:27:40 AM by Aminifu »
Windows 11 Home 64-bit v23H2
Logitech Z906 5.1 speaker system