WACUP

General => Skins => Topic started by: ariszlo on July 06, 2021, 12:28:18 PM

Title: How to display elapsed time in percentage?
Post by: ariszlo 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?
Title: Re: How to display elapsed time in percentage?
Post by: dro 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
Title: Re: How to display elapsed time in percentage?
Post by: ariszlo 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 (https://getwacup.com/community/index.php?topic=1183.0#msg_7312) thread.
Title: Re: How to display elapsed time in percentage?
Post by: dro on July 06, 2021, 06:35:50 PM
Ok, the 'text tag' was what confused me.

-dro
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu 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?
Title: Re: How to display elapsed time in percentage?
Post by: Eris Lund on September 21, 2021, 05:48:29 AM
Classic Skins cannot make use of MAKI scripts that're found in Modern Skins
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu on September 21, 2021, 08:08:20 AM
Ok, but I still need to know how to use it in my modern skins.
Title: Re: How to display elapsed time in percentage?
Post by: ariszlo 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 (https://www.wincustomize.com/explore/winamp/1748/).
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu 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.
Title: Re: How to display elapsed time in percentage?
Post by: ariszlo 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?
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu 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"/>
Title: Re: How to display elapsed time in percentage?
Post by: ariszlo 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"/>
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu 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.
Title: Re: How to display elapsed time in percentage?
Post by: ariszlo 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.
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu 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.
Title: Re: How to display elapsed time in percentage?
Post by: Aminifu on September 26, 2021, 12:53:29 AM
To anyone using this feature that ariszlo has provided,

I'm seeing something unexpected with the elapsed time percentage pop-up position. I changed the "y" coordinate for text tag in the Winamp Classic Modern skin so that the pop-up would be between the volume seeker bar and seeker bar, instead of it overlapping the volume seeker bar.

I didn't change the pop-up position coordinates for the Defix skin, but when I switched to it, the position of it's pop-up had also moved down. I shutdown WACUP and restarted it with the Defix skin and the position of the pop-up still follows that specified for the Winamp Classic Modern skin instead of the position coordinates in the text tag in the Defix skin.

The new position in Defix is not a problem. I'm just curious as to how it happened. Is it possible that a global position for this pop-up is somehow stored in the "studio.xnf" file?