Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: JScript Panel script discussion/help (Read 301489 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1250
And I found that "Korea, Republic of" cannt be parsed as expected, cuz it has one more comma.
For test you can use "The Black Skirts" as artist name.

Yep the comma really messes things up. But even if it was extracted correctly it would still fail for not matching the contents of this file.

https://jscript-panel.github.io/files/countries.json

kr or Republic Of South Korea are expected.

edit: this attached zip contains a one-off hack for Korea, Republic of. It's ugly but should work.

Cached files need to be removed as per these instructions a few posts ago...

Quote
Open Explorer and go to profile folder\js_data. Search for files named lastfm.artist.extra.json and delete them all.

Re: JScript Panel script discussion/help

Reply #1251
I apologize for the inconvenience caused by my problem.

Artist not displayed.
I think it's a problem with ().

(G)I-DLE
https://www.last.fm/music/(G)I-DLE?setlang=en

South Korea (kr)

Spoiler (click to show/hide)
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH-ULT900N (ULT WEAR) (made a Upgrade/Balanced Cable by myself)


Re: JScript Panel script discussion/help

Reply #1253
Artist not displayed.
I think it's a problem with ().

A silly typo was the cause of this. Should be fixed in the attached zip.

Also, a bug where the panel didn't respond to country tags being modified has been fixed.

edit: this zip also contains updated track info + seekbar scripts. I finally got around to rounded rectangles which look a bit nicer

Re: JScript Panel script discussion/help

Reply #1254
All of my panels have a text font size of 9, except your JScript Panel 3 Text Display. The minimal font size is 10.

That might be true for the default size set via the right click menu but you can use $font title formatting which supports 8 as the minimum value.

https://jscript-panel.github.io/docs/font-rgb/#font

Re: JScript Panel script discussion/help

Reply #1255
Great!
I'm enjoying JScript Panel 3 now.

Spoiler (click to show/hide)

Thank you for listening to such an ignorant request as mine.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH-ULT900N (ULT WEAR) (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1256
That might be true for the default size set via the right click menu but you can use $font title formatting which supports 8 as the minimum value.

https://jscript-panel.github.io/docs/font-rgb/#font
But I can only add $font to the Custom title, not to the text.



Re: JScript Panel script discussion/help

Reply #1259
@marc2k3

Now Playing 2 (Log) + "Text Reader"

Now Playing 2 (foo_nowplaying2)
https://github.com/foxx1337/foo_nowplaying2/releases

I am using "Now Playing 2 (Log)" + "Text Reader" to display Playback History.
Can I select a History Track and display the Playlist View Context menu?
Then I can use Add to playback queue, Send to playback queue, QSearch, Send to playlist, Run service etc...

Spoiler (click to show/hide)
-----------
My request is to create a 64-bit version of Navigator.

Navigator (foo_navigator) 32bit
https://hydrogenaud.io/index.php/topic,45616.msg819089.html#msg819089

It was the wrong thread. sorry.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, SONY WH-ULT900N (ULT WEAR) (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1260
For some artist, intead of country flag, it displays 'KR'


 

Re: JScript Panel script discussion/help

Reply #1261
At first glance, it seems like a bug with the IDWriteTextLayout windows API I'm using. I'm supposed to be able throw different fonts at different ranges of text in the same string but it seems to break down with those korean characters in it.

I can hack around it by making separate calls for rendering the flag and the artist but then I'm in no better position that I would have been using images. Urgh. :/


Re: JScript Panel script discussion/help

Reply #1262
Can I select a History Track and display the Playlist View Context menu?

Of course not. Artists/titles as strings can't be converted in to recognisable playlist items.

Use Playback Statistics with a recently played autoplaylist. Not tested because I don't have the component installed but something like...

Code: [Select]
%last_played% DURING LAST 1 DAY SORT DESCENDING BY %last_played%

Re: JScript Panel script discussion/help

Reply #1263
I can hack around it by making separate calls for rendering the flag and the artist but then I'm in no better position that I would have been using images. Urgh. :/

Here's a quick and dirty workaround. On line 24 of original script. replace

Code: [Select]
	var y = thumbs.properties.layout.value == 0 ? margin : this.y - margin;
DrawStyledText(gr, this.header_text(), panel.fonts.title, colourh, this.x, y, this.w, TM, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);


with

Code: [Select]
	var x = this.x;
var y = thumbs.properties.layout.value == 0 ? margin : this.y - margin;
if (this.twitter_font && this.flag.length) {
var font_size = _scale(panel.fonts.size.value);
var font = CreateFontString('Twitter Color Emoji', font_size);
var width = utils.CalcTextWidth(this.flag + '  ', 'Twitter Color Emoji', font_size);
gr.WriteText(this.flag, font, 0, x, y, width, TM, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
x += width
}
gr.WriteText(this.artist, panel.fonts.title, colourh, x, y, this.w, TM, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

Re: JScript Panel script discussion/help

Reply #1264
Quote

Code: [Select]
	var x = this.x;
var y = thumbs.properties.layout.value == 0 ? margin : this.y - margin;
if (this.twitter_font && this.flag.length) {
var font_size = _scale(panel.fonts.size.value);
var font = CreateFontString('Twitter Color Emoji', font_size);
var width = utils.CalcTextWidth(this.flag + '  ', 'Twitter Color Emoji', font_size);
gr.WriteText(this.flag, font, 0, x, y, width, TM, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
x += width
}
gr.WriteText(this.artist, panel.fonts.title, colourh, x, y, this.w, TM, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

I m totally fine with this one. Thanks for ur support!

Re: JScript Panel script discussion/help

Reply #1265
I've posted an updated component and using a new font (Twemoji Mozilla) is required for the flag display in bio scripts. All existing users will need to update the content in their panels to be sure they're using the latest code.

https://github.com/mozilla/twemoji-colr/releases/tag/v0.7.0

I'm not going to pretend I understand how or why this fixes the Korean text/flag issue. It just does.

Re: JScript Panel script discussion/help

Reply #1266
Thanks marc2k3 for the new component version!  Works fine here:

1.  Installed the Twemoji Mozilla font, restarted PC
2.  Installed jscript panel 3.3.21
3.  Updated both existing Thumbs and Last.fm Bio panels from the new samples
4.  Restarted Foobar 2.1x64

Flags showing from radio streams when Last.FM entries support them.  Have not needed to use the new "Last.fm Bio + Images" sample for my configuration.

Re: JScript Panel script discussion/help

Reply #1267
I've said it recently and I'll say it again... there is no need to restart your PC after installing a font. That's bonkers.

If you install a font while fb2k is closed, do nothing. It will be fine when you open it.
If you install a font while fb2k is running, restart the app. That is all.

edit: while you don't "need" the combined bio + images script, it does look better without the splitter...

https://jscript-panel.github.io/gallery/lastfm-bio/#__tabbed_1_2

Re: JScript Panel script discussion/help

Reply #1268
OK on the icons!  Had just uninstalled the Twitter color emojis so was being overly cautious.

Yes the unified panel does look better.  The one thing I miss is the ability to change the 4 image states from the right-click menu as before, but the manual method you posted for Air KEN works here and I appreciate it.

Re: JScript Panel script discussion/help

Reply #1269
I've restored the right click options for the next release. It can be tested extracting the contents of the attached zip in to the ROOT of the component folder and updating the panel script from the Samples button.


Re: JScript Panel script discussion/help

Reply #1270
Thank you!!

Re: JScript Panel script discussion/help

Reply #1271
I am using the following script by marc2k3 to produce a line-limited text file log of recently played songs.  Is there a way to modify it so that the most recent item appears first on the list instead of last?  Thanks for any help!

Code: [Select]
// ==PREPROCESSOR==
// @name "Playback History"
// @author "marc2003"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// ==/PREPROCESSOR==

var limit = 70;
var tfo = fb.TitleFormat(" [%artist% - ]%title%");
var path = "C:\\foobar2000\\TrackHistory_v1.txt";

/////////////////////////////////////////////////////////////////////////////////////////////////////////

var last = '';

function on_playback_new_track() {
log_it();
}

function on_playback_dynamic_info_track(type) {
if (type == 0) {
log_it();
}
}

function now_as_string() {
var now = Math.floor(Date.now() / 1000);
return utils.TimestampToDateString(now);
}

function log_it() {
var current = tfo.Eval();
if (current != last) {
last = current;

var text = utils.ReadUTF8(path);
var arr = _(text.trim().split("\r\n"))
.filter(function (item) { return item.length > 0; })
.takeRight(limit - 1)
.value();
arr.push(now_as_string() + " " + current);
utils.WriteTextFile(path, arr.join("\r\n"));
}
}

Re: JScript Panel script discussion/help

Reply #1272
Replace the log_it function with this...

Code: [Select]
function log_it() {
var current = tfo.Eval();
if (current != last) {
last = current;

var text = utils.ReadUTF8(path);
var arr = _(text.trim().split("\r\n"))
.filter(function (item) { return item.length > 0; })
.take(limit - 1)
.value();
arr.unshift(now_as_string() + " " + current);
utils.WriteTextFile(path, arr.join("\r\n"));
}
}

It does nothing for existing items. You should start with a new file.

Re: JScript Panel script discussion/help

Reply #1273
Beautiful, thank you yet again.

Re: JScript Panel script discussion/help

Reply #1274
Foobar 2.1 x64 and 1.6.17.  Since updating to JScript Panel 3.3.25, and updating from Samples the Last.fm Bio + Images panel:  I've noticed that when no image is available, the bold text for the band name shows the highlight color of my Foobar theme setting, but when a band image is loaded, the color of the band name text returns to white.  I'm not sure if this script version is when it started, but is it default behavior (now)?  See image examples.