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 (Read 285518 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel

Reply #950
I completely missed the word image when you said custom background. Sorry about that, I must be blind. So no, it doesn't have that.

The Text Reader script was supposed to be a replacement for last.fm bio. When installed, you can right click and change the path with custom title formatting...




Re: JScript Panel

Reply #951
I completely missed the word image when you said custom background. Sorry about that, I must be blind. So no, it doesn't have that.

The Text Reader script was supposed to be a replacement for last.fm bio. When installed, you can right click and change the path with custom title formatting...





Thank you for your info & suggestion regarding Text Reader!!. It is working as Biography replacement but not with Album Review since it only read text with Artist name title only not Artist - Album  :(  So please still consider to add the option if you have time. Thank you bro, your JScript Panel is very useful with Foobar2000 x64.

Re: JScript Panel

Reply #952
quick question from a noob in Jscript (but who is trying).
I need some pointers to a simple thing which is to create a scrolling text  in  a panel.
I thought i had to create a IJSGraphics object, write the text in that object and then draw it using horizontal offsets (WriteTextLayout can do that but only on vertical offsets). unfortunately, seems that it isnt the right way as i didnt find the way to do that offset.

Also, question about the DrawImage(image, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH[, opacity, angle]) function. what 'src' stands for ?
Thank you

Re: JScript Panel

Reply #953
1) You can use gr.WriteText with a negative x value to start drawing it off the left hand side of the panel like this...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==

var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
var x = 5;

function on_paint(gr) {
x = Math.min(x, 5);
gr.FillRectangle(0, 0, window.Width, window.Height, RGB(255, 255, 255));
gr.WriteText(text, '', RGB(0, 0, 0), x, 5, window.Width + -x, 20, 0, 2, 1, 1);
}

function on_mouse_wheel(step) {
x += step * 24;
window.Repaint();
}

If you wanted it constrained within the bounds of a rectangle, you'd have to create a temporary IJSImage object and use WriteText on that and then use gr.DrawImage like this...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==

var img = null;
var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
var x = 5;
create_image();

function create_image() {
x = Math.min(x, 5);
img = utils.CreateImage(300, 20);
var g = img.GetGraphics();
g.WriteText(text, '', RGB(0, 0, 0), x, 0, 300 + -x, 20, 0, 2, 1, 1);
img.ReleaseGraphics();
}

function on_paint(gr) {
gr.FillRectangle(0, 0, window.Width, window.Height, RGB(255, 255, 255));
gr.DrawImage(img, 50, 50, img.Width, img.Height, 0, 0, img.Width, img.Height);
gr.DrawRectangle(50, 50, img.Width, img.Height, 1, RGB(255, 0, 0));
}

function on_mouse_wheel(step) {
x += step * 24;
create_image();
window.Repaint();
}

2) The src args in DrawImage is the portion of the image you'd like to display. For the whole image, it would be

Code: [Select]
0, 0, img.Width, img.Height

If it was square and you imagined it being cut in half both ways and you wanted the bottom right, you'd use

Code: [Select]
img.Width / 2, img.Height / 2, img.Width / 2, img.Height / 2

Re: JScript Panel

Reply #954
oh wow, thank you so much, it's perfect !
and thanks for the explanation of the src args, wasnt obvious to me :)


 

Re: JScript Panel

Reply #956
3.1.2

https://github.com/marc2k3/jscript-panel/releases

This adds an album art background option to Text Display.

Like my main album art sample, it can display art from certain radio streams...


Re: JScript Panel

Reply #957
Thank you for the update! Keep it up.

Re: JScript Panel

Reply #958
@sveakul  -regarding your spectrogram issues, what OS are you running? And was webp support built in or are you using the google installer?

I'm having a few issues myself since messing around with windows 11 22H2 this week and it does seem similar to what you described but I'm having a hard time figuring out why. Pretty sure it's not the script at fault because so far, I'm ensuring the file exists after the background test has successfully run and created the image but it's failing to recognise it 100% of the time with my image loading function and that is purely windows code. It's bugging me now.  ;D

edit: I seem to have confirmed webp support in windows 11 is sketchy as ****. Looks like I'll have to implement my own.

Re: JScript Panel

Reply #959
Hi marc2k3, I'm running Windows 10 x64 21H2.  I've always used Irfanview to actually view webp files (with Firefox for web pages support).  From what I read the situation on native support in 10 has been "cloudy" with some reports that while the Windows 10 "Photos" app needs some extension work-around to view them the "Windows Photo Viewer" handled them as-is.

Interesting that you're seeing a similar issue in 11.  The easiest steps to replicate what I described with the Spectrogram on JScript versions higher than 3.1.0-Beta 4 would be:

1.  Open Foobar and play some files as they generate webp images in the Spectrogram Seekbar.
2.  Stop playing, then right-click the Spectrogram image window and choose "Cached Images--Clear all," then immediately exit Foobar.
3.  Start Foobar again and play a file(s)--no image will appear in the Spectrogram panel, although they get created in the cache folder.  Behavior returns to normal if you exit Foobar again WITHOUT clearing the cache, and begin playing.

The only wild card with my setup is that I use the "-lossless 1" switch in the ffmpeg options to create a *slightly* better image;  the disc space doesn't bother me because I use that script addendum you provided to auto-clear the cache anyway upon exit.

I'd bet you are absolutely right that sketchy OS support is at the core of this whole thing.

Re: JScript Panel

Reply #960
I've released 3.1.3 with built in webp support. If this doesn't fix the seekbars, I shall look a bit stupid.

https://github.com/marc2k3/jscript-panel/releases

edit: 3.1.4 fixes WebP album art not being handled internally.

Re: JScript Panel

Reply #961
Did a clean update to 3.1.4 and PROBLEM SOLVED, cached spectrogram images clear on exit (with the script addendum) and are re-created/shown in panel normally the next time Foobar plays a file.

Thanks for working this!!

Re: JScript Panel

Reply #962
Cool.  8)

I was using windows 10 previously but nuked the windows store (and built in webp support) with a powershell script so I used the google webp installer. I guess that's why I couldn't recreate the problem when you originally reported it.

Since using windows 11, I was relying on the store version of webp and that was the failure point. It worked most of the time but wasn't 100% reliable. I wasn't going to tell everyone on 10/11 they must use the google installer so I used their open source libwebp library to do it myself.



Re: JScript Panel

Reply #965
https://github.com/marc2k3/jscript-panel/releases

3.1.7 for fb2k 2.0 users. Columns UI users need to make sure they are using the latest v2 alpha.5

3.0.5 was released a few days ago for fb2k 1.6.6-1.6.13 users

Re: JScript Panel

Reply #966
Hi,
I want to update tags of selected tracks with a Discogger component,
but this context command only runs on currently playing item
Code: [Select]
fb.RunContextCommand("Tagging/Discogger/Write tags...");
I've searched through many topics and pages and didn't found a proper way to do this.
in the docs it says "This method is for the currently playing file only. See also: IMetadbHandleList RunContextCommand."

So I tried those "See also" options:
RunContextCommand (without fb. prefix) gives me "RunContextCommand is undefined" error
So I left with that "IMetadbHandleList" command, which I assume should help to do the task
If only I knew what to do with it  :'(


Re: JScript Panel

Reply #968
Hi, I just got back into modding FB2K and it's good to see JScript Panel is still alive and well!

I am having a slight issue, though. As you can see from the screenshot below, certain icons/glyphs are missing from the panels.



Any idea how I can fix this?

I'm running JSP v.3.0.5 on FB2K v.1.6.13 installed in default (non-portable mode).

Re: JScript Panel

Reply #969
Have you installed FontAwesome?

From https://marc2k3.github.io/jscript-panel/docs/:
Quote
Most included samples require the installation of FontAwesome which you can grab here.
It's your privilege to disagree, but that doesn't make you right and me wrong.



Re: JScript Panel

Reply #972
I've made the FontAwesome requirement prominent on the download page and moved it up so it's more visible on the docs landing page.

Good stuff - it's much more idiot-proof now  :D


Re: JScript Panel

Reply #974
Have loaded a test of Foobar 2 with Marc@s Darkone mod  (modified)   only issue to date  is that i can only update rating via menu  Playback stats , ratings rather than clicking on * in  the  track display.  I've never used tags for rating prefering to keep my audio file  clean.  Any ideas on a resolution?