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

WSH Panel Mod script discussion/help

Reply #1125
Good idea.  Thanks!

Hum, sorry, but IMO that doesn't work.  I can save the paths to a m3u (or an INI or text file) and reload them when I need them, but I have no way to rebuild a new IFbMetadbHandleList from the paths.  Have I missed something?

WSH Panel Mod script discussion/help

Reply #1126
you need to use the standard foobar methods of loading a playlist. i don't know what else you were thinking.

WSH Panel Mod script discussion/help

Reply #1127
Well, I don't want to load the items in the GUI.  The list is not a playlist accessible by the user, but just a "variable" maintained by my script internally.  In other words, I just need the handles.  I want to recreate the temp IFbMetadbHandleList from the path stored in the file, to remember what sets of the active playlist have not been played during the last foobar session, and continue to play them randomly.

I could of course load the m3u in a playlist, copy the playlist in the IFbMetadbHandleList, and delete the playlist.  But it's slow, the playlist will probably appear in the GUI for a short time, and the method is not clean.

I was thinking that it should be possible to load some files from disc directly to an IFbMetadbHandleList.  But I think now that it's probably not possible, as the files tags and properties must be parsed by foobar to create the handles.  If that means that creating a playlist in the GUI is necessary, then there is no good solution, and I will have to create a temp playlist.

Anyway, thanks again for your suggestion.

 

WSH Panel Mod script discussion/help

Reply #1128
I'm now trying to add a "Sort Playlist: Randomize by Sets" function to my script, but I can't get InsertPlaylistItems() to work.

The function gets the content of the current playlist in a IFbMetadbHandleList, then reorder that list by sets, empties the current playlist, and use InsertPlaylistItems() to replace the items of the IFbMetadbHandleList in the playlist.  The first part works as expected, but when I use InsertPlaylistItems(), I have always a type mismatch error.

What are exactly the types of the arguments of InsertPlaylistItems(playlistIndex, base, handles, select = false) ?
I assume this:
UINT playlistIndex
UINT base
IFbMetadbHandleList handles
bool select

The comment about InsertPlaylistItems() in the doc says "Inserts new items into specified playlist, at specified position.", so I assume that base is the "specified position".

You can check the problem with this simplified code, that should duplicate all elements of the active playlist, but crashes:
Code: [Select]
var pl = plman.ActivePlaylist;
var all_handles = plman.GetPlaylistItems(pl);
plman.InsertPlaylistItems(pl, 0, all_handles);

Error message:
Code: [Select]
[13:51:37] Error: WSH Panel Mod ({8B5414E5-92F3-4BE8-BBB3-A7CF680847A7}): Microsoft JScript runtime error:
Type mismatch
Ln: 3, Col: 1
<source text only available at compile time>

What am I doing wrong?

WSH Panel Mod script discussion/help

Reply #1129
I have a few "requests" or how to say, I think these would be useful, and lack the knowledge to write them myself.

- last.fm tag cloud, or just listing of tags. Would be useful to quickly see what genre or subgenre to tag music by.
- last.fm comments, maybe with the option to choose between song, artist and album comments.
- last.fm recommended artists, listed with links to google or wiki pages.
- songmeanings.net comments?

I don't know though if these are even possible to do, or if they've already been done. If so I cannot find them, and would be happy to be pointed to the code.

WSH Panel Mod script discussion/help

Reply #1130
@r0lZ:
What a shame, it's a bug, thanks for reporting...

WSH Panel Mod script discussion/help

Reply #1131
@r0lZ:
What a shame, it's a bug, thanks for reporting...

Don't be ashamed; it's still a beta!
Anyway, I'm glad to help.

BTW, to remove all items in the playlist, currently, I do this:
Code: [Select]
    plman.ClearPlaylistSelection(pl);
    plman.SetPlaylistSelectionSingle(pl, 0, true);
    plman.RemovePlaylistSelection(pl, true);
    plman.RemovePlaylistSelection(pl, false);

Seems a bit complicated!
Can you add the functions RemovePlaylistItemRange(playlistIndex, from, num) and RemovePlaylistAllItems(playlistIndex) ?

WSH Panel Mod script discussion/help

Reply #1132
Oh, another thing.  I need to create an empty IFbMetadbHandleList, but I haven't found the way to do it.  Currently, I need to retrieve the list from any playlist, and remove all elements from the list.

Is this supposed to work?
Code: [Select]
handles = new IFbMetadbHandleList();

It produces the error: 'IFbMetadbHandleList' is undefined

[EDIT] Sorry, I've found the way to create an empty list:
Code: [Select]
handles = fb.GetSelections(0);

WSH Panel Mod script discussion/help

Reply #1133
Yo marc2003!!!
I have a question for the thumbs WHS script from your samples.
I want to add an custom folder but it doesn't work...
...i tryed

E:\foobar 2000\lastfm\artist\%artist%*.*
.\lastfm\artist\%artist%*.*

...please help me 

WSH Panel Mod script discussion/help

Reply #1134
Oh, another thing.  I need to create an empty IFbMetadbHandleList, but I haven't found the way to do it.  Currently, I need to retrieve the list from any playlist, and remove all elements from the list.

Is this supposed to work?
Code: [Select]
handles = new IFbMetadbHandleList();

It produces the error: 'IFbMetadbHandleList' is undefined

[EDIT] Sorry, I've found the way to create an empty list:
Code: [Select]
handles = fb.GetSelections(0);


Code: [Select]
handles = fb.GetSelections(0);

will not always create a empty list, it might include the now playing item inside this list.
Code: [Select]
handles = fb.GetSelections(1);

is more reasonable.
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #1135
Quote
Looking for a simple script to list the playback queue in a WSH panel.
I've found 2 components but they kinda suck. Any suggestions solutions?


Never mind. I'm sorry, my friend is silly. Ignore me.

WSH Panel Mod script discussion/help

Reply #1136
Code: [Select]
handles = fb.GetSelections(1);

is more reasonable.

You're right.  fb.GetSelections(0) returns the playing item.  I've tested the function when foobar was not playing.  Thanks for the tip!

But GetSelections(1) returns the active playlist selection, and therefore the playing item, or more items!  It is not suitable either.

So, it seems that is not possible to create an empty list with a single instruction.  I will have to use my old and cumbersome method.  :-(

WSH Panel Mod script discussion/help

Reply #1137
@Jango, it's just the path to a folder. don't use wildcards as it automatically reads all images.

Code: [Select]
E:\foobar 2000\lastfm\artist\%artist%


should work.

WSH Panel Mod script discussion/help

Reply #1138
Sorry i explained it wrong to you. 
I use the Biography View 0.4.2.4 (foo_uie_biography) to download my bio and the artist pictures.
everything is downloadet in to one folder in the foobar directory...
... E:\foobar 2000\lastfm\artist\

ACDC.jpg
ACDC_01.bmp
ACDC_02.jpg
ACDC_03.jpg
ACDC_04.png
ACDC_05.jpg

...would it be possible to edit the script a litle bit to support the  foo_uie_biography
grouping and naming scheme.
Thank You!

WSH Panel Mod script discussion/help

Reply #1139
i'm not modifying the script to use the same filename patterns as the biography component. it can already download images from last.fm by itself so it seems rather pointless using the 2 in combination. pick one or the other.

WSH Panel Mod script discussion/help

Reply #1140
I need to retrieve the handle of the first item in the playback queue, but currently I can't do it.

Not sure how to use GetPlaybackQueueContents(), but this code prints nothing in the console, even when there are items in the queue.
Code: [Select]
    if (plman.IsPlaybackQueueActive()) {
        var arr = plman.GetPlaybackQueueContents();
        fb.trace(arr.length);
    }

The returned VBArray seems always undefined or empty.

What's wrong with that code?

WSH Panel Mod script discussion/help

Reply #1141
you typically need to use toArray() whenever VBarray is mentioned in the docs. try this....

Code: [Select]
var arr = plman.GetPlaybackQueueContents().toArray();

WSH Panel Mod script discussion/help

Reply #1142
you typically need to use toArray() whenever VBarray is mentioned in the docs. try this....

Code: [Select]
var arr = plman.GetPlaybackQueueContents().toArray();

Yeah, that works!  Thanks! 

WSH Panel Mod script discussion/help

Reply #1143
not tested yet, but according to the doc, it's maybe an array of handles, so you can't display the content, it will always display nothing. Use APi from the doc to get idenx of an handle or try to browse the array to find an handle by using .Compare() method.


WSH Panel Mod script discussion/help

Reply #1144
Thanks for the precision, but it's exactly what I had the intention to do.
ie, my code will be something like this:
Code: [Select]
if (plman.IsPlaybackQueueActive()) {
        var handle = plman.GetPlaybackQueueContents().toArray()[0].Handle;
        // then I use fb.TitleFormat to get the content of the handle.
}


WSH Panel Mod script discussion/help

Reply #1145
Marc2003, maximum respect for the CD Jewel Case script for WSH  Panel Mod. Is there a similar script to show the rear CD artwork in a case?

Many thanks

Dan

WSH Panel Mod script discussion/help

Reply #1146
i don't have any back images so it's not something i've ever considered.

WSH Panel Mod script discussion/help

Reply #1147
Fair enough. I have rear images for most of my music. Would you be willing to tweak the script and create a rear image one too?

WSH Panel Mod script discussion/help

Reply #1148
well i don't have a CD back template. if you can find one i might take a look.

and it won't be for a week or so. i'm away from home and don't really have the time at the moment.

if you don't need the template, simply use my artreader script (or default artwork panel) as they both have options to display the back image.

WSH Panel Mod script discussion/help

Reply #1149
Hi Marc,

How about something like this:



It's fairly basic but would nicely complement your front CD case script, and would look good when viewed together on the screen. The rear artwork would just sit inside the edges of the box. The user would be able to "trim" the spines of the image or have them showing.

Thanks

Dan