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: WSH Panel Mod script discussion/help (Read 1401385 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod script discussion/help

Reply #2650
I didn't thought that I will enjoy in this 'wait image' 




How to make this image to spin?
If split this in 8 images

WSH Panel Mod script discussion/help

Reply #2651
I didn't thought that I will enjoy in this 'wait image' 




How to make this image to spin?
If split this in 8 images

This code is not debugged or tested in anyway, so there will probably need to be changes.

This assumes all the images are saves as wait_img0.png, wait_img1.png, etc. The path variable contains the path to those images.
Code: [Select]
var waitImgs = [];
var curWaitImg;
var curWaitIndex = 0;
for (i=0;i<8;i++)
    waitImgs.push(gdi.image(path + "/wait_img" + i + ".png");
curWaitImg=waitImgs[curWaitIndex++];

waitTimer = window.SetInterval(function() {
    curWaitIndex = (curWaitIndex + 1) % 8;
    curWaitImg = waitImgs[curWaitIndex];
    window.Refresh();
    }, 100);


Then just draw curWaitImg in the on_paint. You'd probably want to use a refresh rect and pass it the coordinates of where you want the wait image to be shown.

WSH Panel Mod script discussion/help

Reply #2652
generally panel crash on a gdiDrawText method, or if not crashing the panel become white (no repaint) for a little lapse of time, then came back on mouse move. Experiencing this repaint bug more than 2 times generate WSH panel Mod panel to freeze (a WSH panel mod window open over the fooobar2000 window and foobar2000 freezed until it crashed.

that's the common symptoms encountered.

Sounds like that isn't what I ran into then. My theme crashed in an unexpected spot for no reason I could understand.

I did encounter a weird redraw bug though that might be related. The window would just stop updating. It was going through the on_paint, but the screen only redrew when I paused playback. Never went white though and the theme was still responsive to the mouse (menus would still drop down, etc.) I've seen stuff like that before where it's attempting to redraw too fast, or something else is stealing all the CPU cycles, but that shouldn't have been the issue in this case.

WSH Panel Mod script discussion/help

Reply #2653
samples updated;

for my thumbs & now playing scripts, when there weren't enough thumbs to fill the whole strip, you'd see an ugly gap with your default background colour. i've now improved this by taking up the whole panel with the main image and drawing thumbs over the top.



right click>Update script.

full download: https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip
changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

WSH Panel Mod script discussion/help

Reply #2654
Maybe somebody can help me:
If I update a tag using IFbMetadbHandle.UpdateFileInfoSimple and then try to read it using IFbFileInfo.MetaValue without a delay, it reads the previous value back. I suppose the reason is that the file content itself is not updated immediately.
Does anybody have a best practice on how to avoid this?

WSH Panel Mod script discussion/help

Reply #2655
as you've written the value, why do you need to read it back immediately?  you'll get prompted if tag updates fail - just like you would if you were updating the usual way through the properties dialog.


WSH Panel Mod script discussion/help

Reply #2656
I need it to perform some calculations afterwards like getting average values of certain track groups. I think I can solve it by just passing in the changed values manually in the calculation, but I was just wondering. Actually I would expect the read and write operations to be properly synchronized.

WSH Panel Mod script discussion/help

Reply #2657
if you've not seen any tag update errors, i think it's fair to assume the values you have written are ok to use. try using UpdateFileInfoSimple on a read only file and you'll see what i mean.

edit: bad advice removed.

WSH Panel Mod script discussion/help

Reply #2658
Ok, thanks for the hint, I might take that route.
Also thanks for your plugin, the customizations you can do with it are really great!

WSH Panel Mod script discussion/help

Reply #2659
i completely forgot, you could use the on_metadb_changed callback for this. that gets called automatically when tags are updated.

you need this preprocessor stuff at the start..
Code: [Select]
// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==


then use this
Code: [Select]
function on_metadb_changed() {
    //something
}

 

WSH Panel Mod script discussion/help

Reply #2660
I didn't thought that I will enjoy in this 'wait image' 




How to make this image to spin?
If split this in 8 images


why having 8 images when it's easy to rotate the image with gr.DrawImage() ? Increase angle value by (360 / 8) at each time interval you want (with a timer and a public variable for the angle) and just use this angle value in the gr.DrawImage() as parameter.

void DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);

WSH Panel Mod script discussion/help

Reply #2661
i would say don't attempt to draw a spinning image over the top of any kind of background image because the CPU usage is ridiculous. it might be ok in a blank panel.


WSH Panel Mod script discussion/help

Reply #2663
I didn't thought that I will enjoy in this 'wait image' 




How to make this image to spin?
If split this in 8 images


why having 8 images when it's easy to rotate the image with gr.DrawImage() ? Increase angle value by (360 / 8) at each time interval you want (with a timer and a public variable for the angle) and just use this angle value in the gr.DrawImage() as parameter.

void DrawImage(IGdiBitmap, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH, angle = 0, alpha = 255);



You're right..  this is simple rotate scipt, but i don't know where to put it inside 'Thumbs' script, to display only when downloading image:

Code: [Select]
var wait = gdi.Image(fb.FoobarPath + "images\\wait5.png");
var angle = 0;

function on_paint(gr) {

gr.DrawImage(wait, 0, 0, 30, 30, 0, 0, wait.width, wait.height, angle);

}

var timer = window.CreateTimerInterval(10);
function on_timer() {

if(angle >= 360) angle = 10;
angle += 10;
window.Repaint();

}

WSH Panel Mod script discussion/help

Reply #2664
you really want to use it inside the thumbs script? 

luckily for you there is a variable which you can check the value of: im.working.

Code: [Select]
if (im.working) ....


also, i'd use window.RepaintRect so it doesn't redraw the whole panel.

but even re-drawing such a small area, i still think you'll have CPU usage issues. try it and look at task manager.

WSH Panel Mod script discussion/help

Reply #2665
Since you're talking also about the Thumbs script i have a question...
In my config it doesn't work anymore, it tries to load pics from Lastfm but nothing appears.  [No image].
Is there something i can do to have it working?

WSH Panel Mod script discussion/help

Reply #2666
last.fm made some changes last week which means my old script stopped working. i've updated it with a workaround so you just need to right click>Update script.

you might find it's slower now but i can't do anything about that. like it or lump it.

WSH Panel Mod script discussion/help

Reply #2667
I already tried it but with no luck...
It found an update, i restarted foobar but i can't still see any image in the thumbs panel.
I'll try to recreate the whole panel, maybe something it's corrupted idk

WSH Panel Mod script discussion/help

Reply #2668
are you trying it manually or using the automatic download option? the latter only works when you start playing a track and no images exist for that artist.

look inside the marc2003 folder and see if a file named download.vbs exists. the script should download it if it's not found but this might have failed?? also check the foobar console? any messages/HTTP error codes?

WSH Panel Mod script discussion/help

Reply #2669
Tried both method and the download.vsb file it's in the right folder...
In console i can see a "Thumbs: HTTP error: 0 " !

WSH Panel Mod script discussion/help

Reply #2670
have you been trying many different artists? are you getting that error with all of them?

you could try clearing the temp files in internet explorer to see if that helps. even if you don't use the browser, this script still uses parts of it to work.


WSH Panel Mod script discussion/help

Reply #2671
you really want to use it inside the thumbs script? 

luckily for you there is a variable which you can check the value of: im.working.

Code: [Select]
if (im.working) ....


also, i'd use window.RepaintRect so it doesn't redraw the whole panel.

but even re-drawing such a small area, i still think you'll have CPU usage issues. try it and look at task manager.


cpu usage is 8-12 if you set slow spining. Looking nice, but i will consider will i use it?

WSH Panel Mod script discussion/help

Reply #2672
to meditate : why having a cpu if it's not for using it ?

WSH Panel Mod script discussion/help

Reply #2673
^if the flashing play icon in your playlist took 10% cpu, you wouldn't enable it.

WSH Panel Mod script discussion/help

Reply #2674
cpu is not important. But i'm not able to do what I intended. so i'll leave it to you, to make, if some of you or Marc thinks that it is useful..you will do this better..