diff options
| author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
|---|---|---|
| committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
| commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
| tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/resources/skins/Big Bento/scripts/songinfo.m | |
| parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
| download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz | |
Initial community commit
Diffstat (limited to 'Src/resources/skins/Big Bento/scripts/songinfo.m')
| -rw-r--r-- | Src/resources/skins/Big Bento/scripts/songinfo.m | 214 |
1 files changed, 214 insertions, 0 deletions
diff --git a/Src/resources/skins/Big Bento/scripts/songinfo.m b/Src/resources/skins/Big Bento/scripts/songinfo.m new file mode 100644 index 00000000..2805f95c --- /dev/null +++ b/Src/resources/skins/Big Bento/scripts/songinfo.m @@ -0,0 +1,214 @@ +/*--------------------------------------------------- +----------------------------------------------------- +Filename: songinfo.m +Version: 1.0 + +Type: maki +Date: 20. Nov. 2006 - 22:47 +Author: Martin Poehlmann aka Deimos +E-Mail: martin@skinconsortium.com +Internet: www.skinconsortium.com + www.martin.deimos.de.vu +----------------------------------------------------- +---------------------------------------------------*/ + +#include <lib/std.mi> + +Function int getChannels (); // returning 1 for mono, 2 for stereo, more for multichannel (e.g. 6), -1 for no info available +Function string getBitrate(); +Function string getFrequency(); + +Global layer monster; +Global timer delayload, songInfoTimer; + +Global Text Bitrate, Frequency; +Global Layer l_Bitrate, l_Frequency; +Global int tempwidth; +Global boolean param; + +System.onScriptLoaded() +{ + group PlayerDisplay = getScriptgroup(); + + param = (getParam() == "big"); + + monster = PlayerDisplay.findObject("monster"); + + Bitrate = PlayerDisplay.findObject("Bitrate"); + Frequency = PlayerDisplay.findObject("Frequency"); + l_Bitrate = PlayerDisplay.findObject("Bitrate.label"); + l_Frequency = PlayerDisplay.findObject("Frequency.label"); + + delayload = new Timer; + delayload.setDelay(100); + + songInfoTimer = new Timer; + songInfoTimer.setDelay(1000); + + Int PlayerStatus = System.getStatus(); + + if ( PlayerStatus != 0 ) + { + delayload.start(); + bitrate.setText(getBitrate()); + Frequency.setText(getFrequency()); + if (PlayerStatus == 1) + { + songInfoTimer.start(); + } + } +} + +system.onScriptUnloading () +{ + songinfotimer.stop(); + delete songinfotimer; + delayload.stop(); + delete delayload; +} + +System.onResume() +{ + delayload.start(); + songInfoTimer.start(); +} + +System.onPlay() +{ + delayload.start(); + songInfoTimer.start(); +} + +System.onStop () +{ + monster.setXmlParam("image", "player.songinfo.na"); + songInfoTimer.stop(); +} + +system.onPause () +{ + songInfoTimer.stop(); +} + +System.onTitleChange(String newtitle) +{ + delayload.start(); + bitrate.setText(getBitrate()); +} + +delayload.onTimer () +{ + delayload.stop(); + int c = getChannels(); + if (c == -1) monster.setXmlParam("image", "player.songinfo.na"); + else if (c == 1) monster.setXmlParam("image", "player.songinfo.mono"); + else if (c == 2 || c == 3) monster.setXmlParam("image", "player.songinfo.stereo"); + else + { + if (tempwidth > 23) monster.setXmlParam("image", "player.songinfo.multi2"); + else monster.setXmlParam("image", "player.songinfo.multi"); + } + //ensure to display bitrate & frequency + bitrate.setText(getBitrate()); + Frequency.setText(getFrequency()); +} + +Int getChannels () +{ + if (strsearch(getSongInfoText(), "tereo") != -1) + { + return 2; + } + else if (strsearch(getSongInfoText(), "ono") != -1) + { + return 1; + } + else if (strsearch(getSongInfoText(), "annels") != -1) + { + int pos = strsearch(getSongInfoText(), "annels"); + return stringToInteger(strmid(getSongInfoText(), pos - 4, 1)); + } + else + { + return -1; + } +} + +songInfoTimer.onTimer () +{ + bitrate.setText(getBitrate()); +} + +string getBitrate () +{ + string sit = strlower(getSongInfoText()); + if (sit != "") + { + string rtn; + int searchresult; + for (int i = 0; i < 5; i++) { + rtn = getToken(sit, " ", i); + searchResult = strsearch(rtn, "kbps"); + if (searchResult>0) return StrMid(rtn, 0, searchResult); + } + return ""; + } + else + { + return ""; + } +} + +string getFrequency () +{ + string sit = strlower(getSongInfoText()); + if (sit != "") + { + string rtn; + int searchresult; + for (int i = 0; i < 5; i++) { + rtn = getToken(sit, " ", i); + searchResult = strsearch(strlower(rtn), "khz"); + if (searchResult>0) + { + rtn = StrMid(rtn, 0, searchResult); + searchResult = strsearch(strlower(rtn), "."); + if (searchResult>0) + { + rtn = getToken(rtn, ".", 0); + } + return rtn; + } + } + return ""; + } + else + { + return ""; + } +} + +Bitrate.onTextChanged (String newtxt) +{ + if (param) return; + if (Bitrate.getTextWidth() == tempwidth) return; + tempwidth = getTextWidth(); + if (getTextWidth() > 23) + { + monster.setXmlParam("x", "-39"); + Frequency.setXmlParam("x", "-75"); + l_Bitrate.setXmlParam("x", "-91"); + l_Frequency.setXmlParam("x", "-58"); + Bitrate.setXmlParam("w", "26"); + if (getChannels() > 3) monster.setXmlParam("image", "player.songinfo.multi2"); + } + else + { + monster.setXmlParam("x", "-45"); + Frequency.setXmlParam("x", "-80"); + l_Bitrate.setXmlParam("x", "-96"); + l_Frequency.setXmlParam("x", "-63"); + Bitrate.setXmlParam("w", "20"); + if (getChannels() > 3) monster.setXmlParam("image", "player.songinfo.multi"); + } +}
\ No newline at end of file |
