Skip to main content

Topic: WSH Panel Mod script discussion/help (Read 843888 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2550
Code: [Select]
var timer = window.CreateTimerInterval(5000);

function on_timer() {
    a.id++;
    if (a.id > 4) a.id = 0;
    a.metadb_changed();
}


Oh, works great now.. thank you so much Marc !

  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2551
ExtremeHunter

Thankyou for the new script of your Spinning Disc Image Viewer, version 2013-09-12, pasted online here [pastebin.com]

I still have a problem with your edition of the context-menu item Open folder of this disc; it doesn't work exactly as I want.

I performed this action in foobar2000 (with your new script):
Quote
Start playing a track whose containing folder is known to contain a target disc image . . . Panel displays the target disc.
Right click the Panel and choose "Open folder of this disc" . . . Explorer opens with target disc selected.
While playback continues, change playlists.
Start playing a track whose containing folder is known to not contain a target disc image . . . Panel displays the default disc.
Right click the Panel and choose "Open folder of this disc" . . . Explorer opens with previous target disc selected !!!!!!!!!!
Stopped playback and restarted foobar2000 (to refresh all).
Start playing the track whose containing folder is known to not contain a target disc image . . . and the Panel displays the default disc.
Right click the Panel and choose "Open folder of this disc" . . .  and the context-menu item "Open folder of this disc" is grayed out.

It seems there is some kind of refresh bug.

What I specifically want from the the context-menu item Open folder of this disc is this:
. . . never be grayed out; this context-menu item is always selectable.
. . . if default disc is showing, then Explorer opens with default disc selected.
. . . if target disc is showing, then Explorer opens with target disc selected.

Your code needs to be modified with some kind of IF...ELSE statement for the context-menu item. Can you please have another look. Thanks ++++

_______________________________________________________________

I also enhanced your script with more functionality.
I added this code (read the comments):
Code: [Select]
// --- mouse left-click effects.
// --- simulate putting your finger on the turntable platter stopping it from spinning,
// --- and playback pauses until mouse is released.

function on_mouse_lbtn_down(x, y) {
    if (!fb.IsPaused) fb.Pause();
    else return;
}
function on_mouse_lbtn_up(x, y) {
    if (fb.IsPaused) fb.Play();
    else return;
}
function on_mouse_lbtn_dblclk() {
}


_______________________________________________________________

marc2003 - thanks a lot for the code to make the popup message box +++++++
  • Last Edit: 12 September, 2013, 01:26:34 PM by derty2

WSH Panel Mod script discussion/help
Reply #2552
Sorry I forgot to add default image path before.

It should work now.

pastebin





  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2553
ExtremeHunter, thankyou for the new edit to the script. It has fixed the "Default Disc vs. Target Disc" issue ++++

Unfortunately for me, I noticed another problem with your current script . . .

In my foobar2000 at "Preferences > Display > Album art - Disc (tab)" I have this search pattern:    disc*[%discnumber%].*
It is only one line; I have no other search patterns for 'Disc'.

My tagging scheme for Vinyl Rips is to use the %discnumber% tag as a reference to the sides ...and to choose a disc image to load.

EXAMPLE 1:
Quote
A 1-LP album having 4 tracks:    2 are on Side-A  |  2 are on Side-B
- The folder containing the tracks will have two disc images: disc-a.jpg,   disc-b.jpg
- In the %discnumber% Tag of the tracks:
  Track No: 1     has value: A
  Track No: 2     has value: A
  Track No: 3     has value: B
  Track No: 4     has value: B

EXAMPLE 2:
Quote
A 2-LP album having 8 tracks:    2 are on Disc-1/Side-A  |  2 are on Disc-1/Side-B  |  2 are on Disc-2/Side-A  |  2 are on Disc-2/Side-B
- The folder containing the tracks will have four disc images: disc-1a.jpg,   disc-1b.jpg,   disc-2a.jpg,   disc-2b.jpg
- In the %discnumber% Tag of the tracks:
  Track No: 1     has value: 1A
  Track No: 2     has value: 1A
  Track No: 3     has value: 1B
  Track No: 4     has value: 1B
  Track No: 5     has value: 2A
  Track No: 6     has value: 2A
  Track No: 7     has value: 2B
  Track No: 8     has value: 2B

The current script does not take into account my artwork loading preference for disc image, which is conditional on the discnumber tag.
I'm not sure where in your script I can make the appropriate edit.

FYI, I had the same problem with the WSH Vinyl Turntable script by marc2003, and marc helped me to fix it. See this post here...

Thanks +++++

__________________________________________________

One more feature request (if you are going to dig into the code again). . .

I want to add another right-click context menu item named Resize disc to fit the panel
I have no idea what the code is for this. Do you have some code for this please.

Thanks again ++++++

__________________________________________________

* EDIT *

ExtremeHunter, you can ignore the first part of my post (regarding loading multiple disc images for an album) . . . . I fixed it!
I had another read of my discussion with marc2003 and dived into your code myself. The fix was pretty much identical, change one line like this:
Quote
old:    var currentAlbum = fb.TitleFormat("%album%").EvalWithMetadb(metadb);
new:   var currentAlbum = fb.TitleFormat("%album%%discnumber%").EvalWithMetadb(metadb);
  • Last Edit: 12 September, 2013, 07:37:16 PM by derty2

WSH Panel Mod script discussion/help
Reply #2554
Added Fit image to context menu.
pastebin

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2555
Marc, i set Auto Cycle Image, i only have one question. How to tell script to skip image if no exist in attached pictures? I want that cycling always be on, and if more image exist then to cycle, if not then to show only front image?
http://pastebin.com/MpAUVKcg
  • Last Edit: 13 September, 2013, 08:54:41 AM by mire777

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2556
line 350 is this:
Code: [Select]
this.img = utils.GetAlbumArtV2(p.metadb, this.id);


insert this after it.
Code: [Select]
if (!this.img) {
    this.id++;
    if (this.id > 4) this.id = 0;
    this.metadb_changed();
    return;
}


i see a lot of your global callbacks at the start contain these 2 lines.

Code: [Select]
a.metadb_changed();
p.item_focus_change();


you can remove the first line because it gets called as a result of the p.item_focus_change function.
  • Last Edit: 13 September, 2013, 09:45:33 AM by marc2003

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2557
line 350 is this:
Code: [Select]
this.img = utils.GetAlbumArtV2(p.metadb, this.id);


insert this after it.
Code: [Select]
if (!this.img) {
    this.id++;
    if (this.id > 4) this.id = 0;
    this.metadb_changed();
    return;
}


i see a lot of your global callbacks at the start contain these 2 lines.

Code: [Select]
a.metadb_changed();
p.item_focus_change();


you can remove the first line because it gets called as a result of the p.item_focus_change function.



ok, i enter this line , but it still cycle image
  • Last Edit: 13 September, 2013, 09:56:59 AM by mire777

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2558
it cycles images that are present but skips any type that is missing. that's what you asked for? previously it would sit waiting with a blank screen if there wasn't an image for the current type.

WSH Panel Mod script discussion/help
Reply #2559
mire777

I also improved your timers, they were mess.

pastebin

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2560
it cycles images that are present but skips any type that is missing. that's what you asked for? previously it would sit waiting with a blank screen if there wasn't an image for the current type.

oh yes after i clear properties, it work's. Thanks Marc
thank's ExtremeHunter i will try how it work
  • Last Edit: 13 September, 2013, 10:17:19 AM by mire777

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2561
ExtremeHunter thanks again. I tried your script edit, works much beter than mine. But i was have error ''out of memory'', and foobar crashes if i didn't set ''no artist image'' in preferences..

Also i can't change front,back,icon... manualy from menu.
*EDIT: ok, it can do that because auto cycle is on.

I try to fix this...
  • Last Edit: 13 September, 2013, 06:40:12 PM by mire777

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2562
I edited script, and fix problem.
Thanks Marc and ExtremeHunter for help..
http://pastebin.com/qe9ysR2s

  • drm200
  • [*]
WSH Panel Mod script discussion/help
Reply #2563
I have a problem with display of special characters.  The same code results in a different outputs in two different panels.

In the first WSH panel is the following line of code:

      gr.DrawString("★", gdi.Font("segoe ui symbol", 17, 1), RGB(250,0,0), 10, 10, ww, wh);

The result is to display the "★" properly.

I now cut and paste the same code into a different WSH panel within the same application.  In this panel, the displayed output is completely different:
The result is something like this (as shown between the quotemarks):  "â~..." 

What would cause the code to display the star differently in the second panel?






  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2564
marc2003, can't state strongly enough how much I enjoy your scripts.  I use your Musicbrainz script quite a bit to understand the releases of artists as I play music, and appreciate the ability to use the primary and secondary filters you've included.  It would be great if you could consider adding filters for MB secondary types of "compilation" and "remix" (in addition to the existing filter for the secondary type of "live").  If it's a pain, don't bother, but if straightforward it would be much appreciated.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2565

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2566
Thanks - works great!

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2567
I need help..
I played a little with Br3tt Library Search, and add some genre preset, and change the look: http://pastebin.com/twt4qigJ
I love how it works...
The only thing I don't know is how to tell script to search, not only Library but single playlist?
Does anyone know how to do that?

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2568
Hey guys, I'm working on a rather large WSH script which has as an optional feature the lyrics panel that Falstaff wrote 3 years ago. He (and now I) is using the FSO object to open the text files on your computer and then parsing and displaying them. This works great, except for the little problem with Unicode characters. They show up as gibberish on the screen.

Someone asked him about the Unicode issue, and he said it wasn't possible to read them correctly from files. I'm not entirely convinced this is true, because the FSO.OpenTextFile function has an optional 4th parameter, where if you pass -1 you can open the file as Unicode. However, when I do this, it's not just the unicode characters that are gibberish, it's even the ASCII characters. Last file I tried it on had Unicode apostrophe's and when I open it as Unicode, the entire thing shows as Chinese characters for some reason. Has anybody seen this before and figured out how to work around it?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2569
i use utils.ReadTextFile(filename).

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2570
i use utils.ReadTextFile(filename).

Well that simplifies things quite a bit and I can rip out all the old FSO stuff that Falstaff was originally using (in rereading this thread it seems that at some point he did the same although he never published that code), however I still have the same problem. My .lrc files which have unicode in them are still showing the unicode characters as gibberish:

See for yourself with the following sample .lrc file.

My code essentially looks like this:
    fb.trace(utils.ReadTextFile(pathName));
   
and the first line of lyrics is shown in the console as: [00:19.29]I know what’s going on inside your crooked mind

Obviously I can keep doing what I'm doing, and replace special characters that I know about, but this won't work for lyrics with foreign characters in them which seems extremely bad.
  • Last Edit: 26 September, 2013, 03:55:48 PM by MordredKLB

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2571
that function takes an optional argument of a codepage...

Quote
utils.ReadTextFile(filename, codepage)


there is a codepages.txt file listing them all in the docs folder of the component but i tried the one for your file and it doesn't work

Code: [Select]
utils.ReadTextFile(filename, 28605);


it changes slightly but it's still not right.

edit: codebox removed, the forum or browser is mangling what WSH panel mod is displaying. it looks like this...



can you change how the lrc files are saved in the first place? other than that, i have no idea. i'll be honest and say i don't really understand all this codepage stuff because i've never needed it.
  • Last Edit: 26 September, 2013, 04:25:30 PM by marc2003

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2572
can you change how the lrc files are saved in the first place? other than that, i have no idea. i'll be honest and say i don't really understand all this codepage stuff because i've never needed it.

Thanks for looking into it.

As far as I know, nothing is happening to the lrc files when they're saved. I just use the lyrics_show_panel3 to download them because I don't have the capability to search and don't want to reinvent the wheel when someone is doing it much better than I could. What I don't get is why the lyrics can load perfectly in every other editor, but not from WSHPanelMod.
  • Last Edit: 26 September, 2013, 04:59:46 PM by MordredKLB

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2573
After further playing around with it, and doing a little light reading, it turns out that the encoding listed is actually wrong. There's also no way to read the codepage from the file. You either have to know it, or you have to guess it using heuristics, which is seemingly what almost everybody does.

Loading that file as UTF-8 (codepage 65001) correctly fixes everything. Of course, that's only useful for 8-bit characters. If I were to get a UTF-16 file (i.e. Japanese lyrics) it would completely barf on them. Not sure what I can do about that. I'll see if things are generally okay with Roman alphabets if I use 65001 for everything.

Edit:
Actually, I'm wrong and stupid. UTF-8 can handle multibyte characters (i.e. Japanese)... that's why they are multibyte in the first place. UTF-16 would be 16-bit wide characters and isn't very common. Since UTF-8 is the web standard, and typically these lyrics are being downloaded from the web I think it's safe to assume that's what they are. I'll test it and make sure, but I think I'm okay now.
  • Last Edit: 26 September, 2013, 05:26:09 PM by MordredKLB

  • mire777
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2574
Actually, I'm wrong and stupid. UTF-8 can handle multibyte characters (i.e. Japanese)... that's why they are multibyte in the first place. UTF-16 would be 16-bit wide characters and isn't very common. Since UTF-8 is the web standard, and typically these lyrics are being downloaded from the web I think it's safe to assume that's what they are. I'll test it and make sure, but I think I'm okay now.


I interested for lyrics script you work, i also edited falstaff lyrics, and add posibility to force save option in lyrics show 3, so you can see lyrics at first play, exactly in same time when it's find from net.. http://mire777.deviantart.com/art/Lyrics-R...h4nge-393946997
Please upload your script when you finish. Thanks..


I found a way to disable WSH script to load on startup and parsing file if their panel is hidden.
This is useful if you have a lot of scripts that are not in use.



You can see that 'Tabed Playlist', 'Album Art' and 'Spinning disc' are initialized in 0 sec.

This can be done simply adding backslash before @import.


//==PREPROCESSOR==
//@name"Tabed Playlist"
///@import"%fb2k_profile_path%scripts\WSH scripts\Tabed Playlist.txt"
//==/PREPROCESSOR==


I think now if posible to make some menu, that can manipulate with this caracter at the beginning, and disable-enable script in panel.
If that menu initialize on startup in 5sec or less it can be useful, because it will consuming less memory than script do on startup..
  • Last Edit: 27 September, 2013, 06:13:48 AM by mire777