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

WSH Panel Mod script discussion/help

Reply #3250
Hi Marc,

I try to modify your "Themed Toolbar Buttons" script to switch between my audio card and headphones. I have two buttons for that:

Code: [Select]
b12: new button(p.w - (bw * 6) - 36, 5, bw, bh, {normal: "audio-card.png"}, function() { fb.RunMainMenuCommand("Playback/Device/M-Audio Delta AP Multi"); }, "Audiocard", true),
b13: new button(p.w - (bw * 5) - 37, 5, bw, bh, {normal: "headphones.png"}, function() { fb.RunMainMenuCommand("Playback/Device/USB Audio CODEC"); }, "Headphones", true),


Sadly it doesn't work. Could you give me a hint what to do?

Here is a screenshot of the device menu:

[a href="http://abload.de/image.php?img=fb2k_devicesf6u2f.png" target="_blank"]

WSH Panel Mod script discussion/help

Reply #3251
as i don't have your hardware, i tested 2 buttons on my layout with these commands and they work fine.

Code: [Select]
fb.RunMainMenuCommand("Playback/Device/Null Output");
fb.RunMainMenuCommand("Playback/Device/Primary Sound Driver");


presumably the menu and keyboard shortcuts work?? i can't explain why they're not working from the button.    it looks like you've typed in everything correctly.

WSH Panel Mod script discussion/help

Reply #3252
Yes, the menu and keyboard shortcuts work.

If I change "USB Audio CODEC" to "Null Output", I can switch between "M-Audio Delta AP Multi" and "Null Output" without problems. There seems a problem with the "USB Audio CODEC" name. This thing is a cheap "BEHRINGER U-CONTROL UCA 202".

WSH Panel Mod script discussion/help

Reply #3253
can you check under the keyboard shortcut preferences that it appears with the same name?? i have vague recollections of DSP chains not working from a button and when i checked the keyboard shortcuts it appeared as something like DSP #1 instead of its given name. changing the script to that made it work.

WSH Panel Mod script discussion/help

Reply #3254
The delete script was helpful in narrowing down problems. Still trying to convert everything, but it seems most problems remaining are:
1) artist images from streams (I guess I'll just lose those if I don't convert them manually)
2) artist images with an apostrophe and their associated album reviews (artists with ctrl 0146 character) - I don't want to lose those. It appears that a new folder was created, but with an altered name (prime mark instead of ctrl 0146 character)

Any suggestions especially on #2 are appreciated.

FWIW, for artists with nonenglish letters (grave accents, umlauts and the like), a new folder was created with the correct letters and images were moved, but reviews were copied. I just deleted the leftover reviews manually.

WSH Panel Mod script discussion/help

Reply #3255
i don't think i can do much about number 1. i guess the images inside are named after the artist so that might help you if you decide to do some manually.

edit: thinking about it, i suppose it would be possible to loop through folders and try and parse the filename upto the first underscore and use that to create the new folder.

as for 2, i can't reproduce that. all my artists are tagged with the "wrong" apostrophe on my keyboard but i did a quick test with the typographically correct one and it works as expected. it's a legal character for filenames and the foobar title formatting function isn't doing anything weird with it either.

i just noticed you edited your post...

Quote
It appears that a new folder was created, but with an altered name (prime mark instead of ctrl 0146 character)


that's not happening here. the folder is created use the exact characters from the artist tag. the first folder here was created by my copy script. i'm now using the properties dialog>artist to try and create a new folder manually...


WSH Panel Mod script discussion/help

Reply #3256
The looping through method as a separate little script sounds like an efficient way to deal with leftovers like streamed artists as well as the apostrophe artists, and I can just move the reviews manually as a last step. I edited problem 2 after your last response that clarifies the issue, but in any case a looping script would probably solve it.

WSH Panel Mod script discussion/help

Reply #3257
Quote
but in any case a looping script would probably solve it.


no it wouldn't. the copy script uses the same method for naming folders as the new scripts. IF characters get changed then they will be ignored and new folders will be created. but if you see my edit with screenshot above, i just don't see how that could happen. 

i've also thought again about creating new folders based on the filenames of what's inside. i'm willing to give it a try but if the files inside the folders were created by very old versions of my script that used art.exe to download files, they will be useless because the illegal character substitution is different. it replaces everything with a hyphen (-). as i mentioned before, mine uses the characters that foobar expects and does the following:

/\|: get replaced with -
* gets replaced with x
" gets replaced with ''
<> get replaced with _
? is stripped completely

WSH Panel Mod script discussion/help

Reply #3258
@godrick, i've had a bash at making something that will create new folders based on the filename inside the old folder.

again i'd be working on a copy of the wsh_lastfm folder preferably after running the script that deletes folders that exist for artists in your library.

first download this into the root of your wsh_lastfm folder

https://dl.dropboxusercontent.com/u/2280132.../clean%20up.cmd

double click to run and it will remove all json files and empty folders.

now add this new script into a panel. again it's blank white and you double click to run. it actually creates a temp folder in your profile directory. this is so you can inspect the folder names before merging the results into your "good" wsh_data folder.

it simply finds the first image in a folder that contains an underscore and uses the characters before it for the new name.

https://dl.dropboxusercontent.com/u/2280132...mp/godrick2.txt

WSH Panel Mod script discussion/help

Reply #3259
? is stripped completely

Although it always seems difficult to find definitive information, I thought the foobar2000 hardcoded substitution was to replace ? with _

e.g. see http://www.hydrogenaud.io/forums/index.php...st&p=635843

http://wiki.hydrogenaud.io/index.php?title...ions#Usage_Tips

Although the latter link is for the file operations component, I believe Frank Bicking has said somewhere that the album art viewer uses the same scheme.

WSH Panel Mod script discussion/help

Reply #3260
it would seem those references are outdated...




WSH Panel Mod script discussion/help

Reply #3261
marc2003, he additional scripts were very helpful - I've gotten everything converted. But in testing, I have a few problems for which I don't have solutions yet:

1) AC/DC images are not recognized in my scripts, but they are in yours. The artist folder name has what seems to be the correct string: AC-DC (reflecting the character substitution as discussed above) when the artist field is AC/DC. But no joy in my script displays.

2) Artists with double quotes in their names also do not display in my scripts, but again display in thumbs8. The artist folder names again appear correct in that the double quotes have been replaced with double primes.


My scripts currently use lines like the following to evaluate the artist value:
Code: [Select]
fb.TitleFormat("$meta(artist,0)").Eval()

It seems the way I evaluate tag field values is the issue.  Is there a better or different way to evaluate to try? I looked at the thumbs section of common8, but I've never gotten up to speed on how to use objects with "this" constructs.

Thanks again for the help!

WSH Panel Mod script discussion/help

Reply #3262
the filenames are purely cosmetic. the script will load all images in a given folder regardless of how they are named. the important bit is how you determine the folder name where they live. if you check inside the common8 file, it's the code on line 1451.

Code: [Select]
this.folder = p.new_artist_folder(p.artist_tf);


p.new_artist_folder is a function shared by all my other scripts and this is the code that does the work....

Code: [Select]
    this.new_artist_folder = function(tf) {
        return this.artists_folder + this.eval(tf).validate() + "\\";
    }


this.artists_folder will resolve to your profile path\wsh_data\artists.
tf is the title formatting usually defined by using the artist field remapping option (default is %artist%)
this.eval is my fb.TitleFormat function and finally, validate() does the illegal character replacement.

because i provide the artist field remapping option, you could just right click the panel and put $meta(artist,0) in there and not edit the script.

WSH Panel Mod script discussion/help

Reply #3263
@godrick and any other gluttons for punishment... here are the rest of my scripts updated to use the new folder naming scheme. there is no readme so it is assumed you already are a user of my previous scripts

https://dl.dropboxusercontent.com/u/2280132...amples8beta.zip

you must download the zip and extract the contents of the marc2003 folder into your foobar profile folder. it contains a new images folder rendering the old images folder inside obsolete. i've now split them into subfolders making them easier to manage/replace.

first of all, i must say there is no compelling reason for people to update. there is nothing new. i've done this out of boredom more than anything else. these scripts will run side by side with my old scripts just fine as they are independent of each other.

there are some minor changes which i will list here:
-any scripts that fetch info online will no longer use the wsh_lastfm folder to cache data. instead, a new folder named wsh_data will be created. inside that will be an artists folder and inside that, each artist will have its own folder which is actually readable - rather than using the $crc32 function which generated folders with a bunch of random numbers.
-new scripts will not pick up your old settings so will need to be re-configured using the right click menu. exceptions to this rule are autoplaylist queries and last.fm user credentials which are stored in files.
-when no info is found online, the panel will remain blank instead of displaying text saying nothing was found.
-artreader / cd jewel case will open the art in your default image viewer when double clicked. the previous version opened the containing folder. there is a new option on the right click menu should you want the old behaviour.
-playcount sync / rating have new images
-allmusic review will display a bit more info in the console about what it's doing. i found it's quite common for some albums to have pages on the website but no review. this just lets you know.
-web links and now playing have been removed. if enough people cry about it, i may consider doing something new.
-spectrogram seekbar now uses a different file naming scheme meaning all previous images are useless. the old cache folder can be deleted to save space. this uses a new pattern which ignores the first 3 letters of the path. this means it won't rescan files when the drive letters have changed. the script will also warn you if ffmpeg and/or sox are missing.
-all scripts that fetch info online now have an open containing folder option on the right click menu taking you to the cached file.

WSH Panel Mod script discussion/help

Reply #3264
Got the pictures transferred - the tips on validation were the missing thing for me and I didn't get it until your last post on the topic. Thanks!

The new scripts seem to work well so far, with one exception: inexplicably, some artist bios are not picked up that are definitely there on the last.fm and wiki websites, and appear in my old config. Since I started over with no json files, the new script should be acquiring new bios and writing new json files for these, but about 10% of the time the script fails to find a bio. Examples: Aimee Mann, Robert Plant, Fiona Apple. The new script is using the same default artist tf as the old script on the same music files, and even for the artists with missing bios the similar artists, links and releases are successfully found and create new jsons.

WSH Panel Mod script discussion/help

Reply #3265
all those artists work fine for me so they definitely should be downloaded. the bio actually comes from the most restrictive of the web services i use (the echonest). we have a limit of 120 requests per minute shared by all users of my script. if that limit is hit, there should be an error in the console.

there will usually be a cached file generated even if the artist does not exist on their site. it's named lastfm_wiki.json in the artist folder. i spammed it with my username and to my amazement, i'm not on there...

if you open the file in notepad...

Code: [Select]
{"response": {"status": {"version": "4.2", "code": 5, "message": "The Identifier specified does not exist"}}}


and even for the artists with missing bios the similar artists, links and releases are successfully found and create new jsons.


these all use different websites. similar artists comes from lastfm and releases/links come from musicbrainz. news-reviews-blogs is the only other script to use the echonest.

WSH Panel Mod script discussion/help

Reply #3266
I was still spamming my console from yesterday's efforts so any message rolled off before I could look. But after waiting a few minutes and seeing your message, the missing bios now appear. It was likely the request limit. thanks again!

WSH Panel Mod script discussion/help

Reply #3267
i've updated the beta zip from a few posts up.

https://dl.dropboxusercontent.com/u/2280132...amples8beta.zip

there have been complete changes to how my buttons scripts work. i've edited several scripts to accommodate this.

if you modify scripts to add/replace buttons, changes are detailed below:

old versions expected stop.png and stop_h.png to live in the marc2003\images folder.

Code: [Select]
b.buttons.stop = new button(0, 0, 32, 32, {normal: "stop.png", hover: "stop_h.png"}, function() { fb.Stop(); }, "Stop");


now you must supply a gdi.Image object. just create these once at the beginning of your panel script, not inside any function.

Code: [Select]
var stop_btn = gdi.Image(fb.ProfilePath + "my_theme\\images\\stop.png");


then when creating a new button, you do it like this...
Code: [Select]
b.buttons.stop = new button(0, 0, 32, 32, {normal: stop_btn", hover: stop_h_btn}, function() { fb.Stop(); }, "Stop");


files changed:
Code: [Select]
marc2003\common8.js
samples8\autoplaylists.txt
samples8\playback buttons.txt
samples8\playcount sync.txt
samples8\rating.txt
samples8\themed toolbar buttons.txt


i've actually completely removed the add button from the autoplaylists script. you now right click and use the menu.

the reason i've made these changes is because i'd really like to discourage people from editing the main file, especially if you're going to share it. you can customise pretty much anything by creating your own custom code in the panel. this means you can still use the Update script feature to get bug fixes but not worry about overwriting any changes that you want to make. obviously it's not easy because i still haven't commented anything but if you do want to make your own customisations, then just ask.

edit: i've actually posted a bug fix for my old scripts as well. autoplaylists would have a blank entry when starting a fresh panel with no save file present. that went unnoticed for a long old time.  just right click panel>Update script.

WSH Panel Mod script discussion/help

Reply #3268
In  both the version from yesterday and the version downloaded today, hitting the "update script" menu item returns "Unexpected error. Not updating"


WSH Panel Mod script discussion/help

Reply #3270
oh balls, thanks for spotting that. this should fix it but obviously you'll need to save it manually...

https://dl.dropboxusercontent.com/u/2280132...2003/common8.js

can you please update the now playing panel as well,
and if could add the a lastFm "Love" button and playback buttons into that it would be perfect.
And what is the editor that you use to write these scripts? , Is there any documentation for wsh scripts and panel stack splitter that can be added for a IDE??

WSH Panel Mod script discussion/help

Reply #3271
i have to say the chances of me making a new panel are slim. instead, i'll write a tutorial explaining how people can include multiple elements in the same panel. it's really quite easy so long as you understand simple concepts of positioning stuff with x,y, w and h. hopefully someone a bit more creative than me can make something nice looking.

as for editing, i just use notepad++. because i have one big file, i have auto-complete available for everything that already exists in it so that saves a bit of time.

 

WSH Panel Mod script discussion/help

Reply #3272
i've now decided to take samples8 out of beta. i've put up a basic setup guide online. it can be read here. the site needs a lot more work before it's done. 

the download will still be hosted on dropbox but it has a slightly different name

https://dl.dropboxusercontent.com/u/2280132...sh/samples8.zip

WSH Panel Mod script discussion/help

Reply #3273
marc2003, your helpfulness in scripting and the capability of your scripts are simply outstanding. Many thanks.

WSH Panel Mod script discussion/help

Reply #3274
thanks for the kind words.... and thanks for helping with the testing. i hope to make a more user friendly version of the folder renaming script at some point today. i really should have done that first.