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 1507076 times) previous topic - next topic
0 Members and 16 Guests are viewing this topic.

WSH Panel Mod script discussion/help

Reply #1625
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


Might help to name/describe the scripts you are using, how many WSH panels you have open, which playlist components you are using etc.

WSH Panel Mod script discussion/help

Reply #1626
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


for the crash on rename (i assumed you use my WSH tabbed playlist manager script), just untick (as usual) the "Safe Mode" option in WSH settings in foobar2000 Preferences pages!

for the crash issue on sort, if you talk about the search menu from my WSH playlist viewer, it should work except if you're not using the last version of WSH PAnel Mod which is 1.5.3.1, or you said you got it (verify please in Preferences> Components...), so thanx to give here more details or most of all the content of the console (error message + line number in error) ==> menu View>Console.

HTH

WSH Panel Mod script discussion/help

Reply #1627
Hi again.
I have another issue trying to understand some examples. I'm looking at the sample scripts drawing buttons. Both the basic samples and those provided by marc2003 use the same constructor function. I'm clueless on this part :
Code: [Select]
    this.draw = function (gr) {
           if (this.state == ButtonStates.hide) return;
          
           switch (this.state)
           {
          ... <snip> ...
           }
  
           g_theme.DrawThemeBackground(gr, this.x, this.y, this.w, this.h);
           gr.GdiDrawText(this.text, g_font, RGB(0,0,0), this.x, this.y, this.w, this.h, DT_CENTER| DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
       }

The method defined here receives an argument called gr and uses it as an argument to g_theme.DrawThemeBackground. However, whenever a <button>.draw method is called in any sample i've seen, the argument passed to it is also simply gr. But nowhere i found a statement defining gr 
I found a reference to gr in callbacks but it states it's invalid outside of two specific callbacks : on_tooltip_custom_paint and on_paint. Here it's used by drawAllButtons(gr) function.

Surely i'm missing something. I guess i could just copy-paste working scripts without wondering how they are working but this looks like a sure-way to big mistakes later on.

Also, there is also this gr.GdiDrawText() method used in the sample. According to what i understood from the doc this method belongs to an IGdiGraphics interface that fist has to be created by the method GetGraphics() of an IGdiBitmap interface, itself created by some methods of the "first-level" interfaces window or gdi. Again, i guess i missed something.

Can someone help me understand how this works?

WSH Panel Mod script discussion/help

Reply #1628
When I try and rename my playlist tabs or sort the playlist, WSH mod crashes. Using foobar 1.1.11 wsh panel mod 1.5.3.1 any help would be appreciated


for the crash on rename (i assumed you use my WSH tabbed playlist manager script), just untick (as usual) the "Safe Mode" option in WSH settings in foobar2000 Preferences pages!

for the crash issue on sort, if you talk about the search menu from my WSH playlist viewer, it should work except if you're not using the last version of WSH PAnel Mod which is 1.5.3.1, or you said you got it (verify please in Preferences> Components...), so thanx to give here more details or most of all the content of the console (error message + line number in error) ==> menu View>Console.

HTH


Thanks, I've solved both problems. Loving the scripts!

WSH Panel Mod script discussion/help

Reply #1629
I found a reference to gr in callbacks but it states it's invalid outside of two specific callbacks : on_tooltip_custom_paint and on_paint. Here it's used by drawAllButtons(gr) function.


drawAllButtons is just a function called from within on_paint. you can pass gr to any other function you want.

as for your 2nd point, you don't reallly need to think about using GetGraphics. that's only for more complex tasks such as creating images from scratch. for displaying images frin disk or drawing text, using gr.GdiDrawText or gr.DrawImage is more than enough.


WSH Panel Mod script discussion/help

Reply #1630
Thanks.
OK, i managed to find the original on_paint call. Sometimes it's hard to find where the original call lies when you did not write the script 
This also means i can't use those methods outside of an on_paint call to e.g. repaint only one button rather than the whole panel. Is it an issue performance wise or am i again "over-thinking" the issue?

And something totally unrelated to those. Is there a way to update an auto-playlist query (from some jscript code i mean, not with the playlist properties pane) after it was created? Currently i'm removing the auto-playlist and then re-create it but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty.
I guess i could activate the playlist but i don't really like this approach as it tends to interfere with playback.

WSH Panel Mod script discussion/help

Reply #1631
with more complex panels, it's more efficient to use window.repaintrect() where you can supply x, y, w and h. but for the example buttons scripts, the panels are likely be to be pretty small so it's ok to repaint the whole panel. also, if you look in the code in mouse move sections, the functions exit if nothing has changed. window.repaint only gets called if it needs to be.

and no, it's not to possible to directly edit an existing autoplaylist. removing and re-creating is the way i do it.

Quote
but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty


i have no idea what's going on there. it works perfectly fine for me.

WSH Panel Mod script discussion/help

Reply #1632
with more complex panels, it's more efficient to use window.repaintrect() where you can supply x, y, w and h. but for the example buttons scripts, the panels are likely be to be pretty small so it's ok to repaint the whole panel.

Thanks for pointing this one. It will perfectly fit the toolbar object i'm building to hold buttons.
Well, the example script is just that. I already borrowed/stole the code and put it in a bigger panel, thus my question about performances. 
Quote
Quote
but the drawback is that a play-list view showing this auto-playlist won't update correctly and will be left empty

i have no idea what's going on there. it works perfectly fine for me.

I have a Playlist Tab splitter with NG Playlist on it (columns UI as you have guessed). When the tab for my auto-playlist is active, if i remove-create it to change the query, the playlist view is left empty until i switch to another tab and back.
I could probably work this around using two playlists, one normal and one auto but i would prefer to use only one.

There is no method to populate a non auto playlist directly from the library is there? I didn't found a way to get a metaDbHandlesList directly from the library or more precisely, I didn't found a way to select using jscript code items from the library so i can get handles with fb.GetSelections.
I could probably make a temporary autoplaylist to get the handles and then keep the metaDbHandleList object in memory rather than dispose of it after use but i'm not sure how big it can grow

WSH Panel Mod script discussion/help

Reply #1633
if you only have one playlist active and remove/re-create it, then it makes sense to switch focus to it through the script. i can't see why you wouldn't want to do this.

WSH Panel Mod script discussion/help

Reply #1634
I have several playlists. Some are autoplaylists and others are not. I don't like the idea of activating a playlist through the script because i noticed that when some components activate a playlist, playback will jump to that playlist after the current track finishes even thought there are still tracks on the currently playing playlist. This might have something to do with the obscure playing queue (i wish i could disable it completely) but as i'm not sure why this happens, i prefer not to "activate" playlists at all.
foobar2000 is great but the way playlists interact with each other and with the playing queue is kind of confusing. 

That's why i'm (probably over-)cautious about playlist activation. I think i found a way of doing what i have in mind by storing metaHandles in an object. If what i understood of Falstaff coverflow script is right, he's keeping metaHandles in memory for it to work. If those are just what the name suggest, they shouldn't be that big.

WSH Panel Mod script discussion/help

Reply #1635
You could disable the playback from following the cursor, which would prevent it following the change in playlists. You could either do this manually (via toggling the playback menu -> playback follows cursor) or from your script:

Code: [Select]
fb.PlaybackFollowCursor = false;

This could also be combined with having the script to store a reference to the playing playlist when it starts and then making sure that it sets that playlist as the active one once the script finishes everything else it's doing.

WSH Panel Mod script discussion/help

Reply #1636
I don't like the idea of activating a playlist through the script because i noticed that when some components activate a playlist, playback will jump to that playlist after the current track finishes even thought there are still tracks on the currently playing playlist.


well that's not right. where playback goes after the current track has finished depends on what playback follows cursor and cursor follows playback settings you have on the main playback menu.

edit: too slow.

WSH Panel Mod script discussion/help

Reply #1637
Hehe, only just

WSH Panel Mod script discussion/help

Reply #1638
Thanks both. Now i know what those settings do. 
I always wondered what my mouse cursor had to do with playback 
I have both un-set by default so i guess the issue came from some component or script overwriting them.

 

WSH Panel Mod script discussion/help

Reply #1639
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

similar artists has been merged into a new panel which can fetch more feeds. as always, use the mouse wheel to scroll and the text is clickable taking you to pages on the last.fm website...




WSH Panel Mod script discussion/help

Reply #1642
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

new script: musicbrainz releases



-like romor's script, it will use MUSICBRAINZ_ARTISTID if it exists in your tags, otherwise it will do a simple text match
-click the text to open the musicbrainz website which will give more details
-unlike romor's script, there is no pagination because i'm lazy. i've countered this slightly by using release-group instead of release so there shouldn't be as many results.

IMPORTANT: existing users of my scripts need to extract the marc2003 folder again.

WSH Panel Mod script discussion/help

Reply #1643
Your last update(s) are looking great marc2003. A pitty, i've no time to play with them at the moment.
Been trying to understand the json-file you pull from lastfm in your other scripts as i was planning on constructing something similar. No more need for that now by the looks of it.

I've no scripting skills higher than markuplanguage-abuse (aka. titleformatscript), but i've been reading/digging/gazing trough your scripts for some time now.
I've reached the stage in wich i can tweak some custom visual stuff and update things without crashes... & planning on really learning some jscript whenever i find the motivation (= time) for it.
It would make my foobar much more futureproof for sure.

Great work and a good job on sharing it, thanks. 
(PS, Always found it a bit tricky to keep track of your 'samples.zip' versions. As they have no version indication at all a.f.a.i.k. I rename 'samples.zip' with a timestamp when i download them which helps a bit.
So last version(s) will be  12-05-22_marc2003_samples. (...and 12-05-23_marc2003_samples, you go fast, lol) Ever considered introducing some kind of versionnumbers?)

WSH Panel Mod script discussion/help

Reply #1644
Quote
Ever considered introducing some kind of versionnumbers?


no. 

perhaps i should but i never keep old work. i always overwrite everything thinking newer is better. dropbox keeps backups of recent changes for 30 days so that's enough to restore files if i make catastrophic changes and need to revert.

also:

-update to musicbrainz releases just uploaded. there was a possibility the text would overlap with the date. also changed the scroll step from 1 to 3. oops...
-update to news / reviews / blogs. the main title has been changed to make it consistent with all my other panels where it now follows artist: description

WSH Panel Mod script discussion/help

Reply #1645
i've countered this slightly by using release-group instead of release so there shouldn't be as many results.


Good idea, that is the way to go, I updated my script accordingly

Additionally I limit to Album/EP/Single

WSH Panel Mod script discussion/help

Reply #1646
 marc2003 awesome new script

WSH Panel Mod script discussion/help

Reply #1647
Additionally I limit to Album/EP/Single


i've shamelessly stolen that idea also. script updated.

edit: updated again.  i've now added a toggle on the context menu for 'live' releases which people can turn on or off.

WSH Panel Mod script discussion/help

Reply #1648
You're also pretty shameless about admitting your shameless-ness 

Does anyone have a track details script? Something with a bit more customisation possibilities than foo_textdisplay. Custom font sizes, colours, etc. Defaultui seems to be lacking in that area, columns has track info mod as well as 'Item Details'

edit: would it be possible to sort the discography? Would be nice to have the releases displaying in date-descending order.