Skip to main content


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: My wsh panel code (Read 53035 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

My wsh panel code

Here're my take on some simple WSH panels. Some of them are based on code from marc2003's or derivative. Pics:

I modified the playing panel after these pics to include lastfm info, so here goes:

Instructions are included inside

If you wanna use my entire theme which is shown in the last pic. Just download the whole theme and extract them into your foobar profile folder. You also need to use DUI, es_playlist and wsh_panel_mod. lastfm recent and top tracks panels are not in this config. I don't see much point to it to include in my config after I finished coding them.

My wsh panel code

Reply #1
New version, I fixed stability problems I know in my code and add another artist art panel based on thumbs2 by marc2003.

You can get the latest version from the last post in the thread I linked to in the first post. You will need latest versions of  foobar es_playlist, wsh_panel_mod, official playcount and audioscrobber (optional) components as of this writing to use my DUI theme if you wanna go that route.

My wsh panel code

Reply #2
Updated the theme and panel code

Download in first post.

My wsh panel code

Reply #3
Code updated:
. Major rewrite, move all lastfm query functions into bio panel.
. Artist art retrieval is now done by parsing xml answer from lastfm by my code and wget instead of using art.exe (don't need .NET Framework now).
. No more artist art panel randomly crashes (due to trigger happy playing one file after another with different artists), thanks to the first two changes.
. Improve blacklist feature: no more downloading blacklist image to only delete them later.
. Added Offline functionality.
. User can change biography cache life time, and whether to refresh artist art at the same time.

I also changed the theme to this, hope I can finally settle with this :

Get my stuffs from the first post link.

My wsh panel code

Reply #4
hey, nice setup you got there, thanks for sharing ^^
but i kinda confused 'bout one thing
what's that code under playing track info on albumart panel?

i want to get rid of that as it is kinda distract me lol

and about lyric panel, is that only display %lyric%? so you must use other plugin such as foo_lyric or something to gets lyric?

oh btw, i got this error on albumart panel :
Code: [Select]
Skipping track...
Audioscrobbler: Submitting track...
Error: WSH Panel Mod (Album Art): Microsoft JScript runtime error:
Invalid procedure call or argument
Ln: 69, Col: 5
<source text only available in compile time>

foo_skip is not friendly with your script? >.<

thanks for answer D:

My wsh panel code

Reply #5
Just right click on the album art panel and uncheck "Playing track info" or use Default DUI artist art reader, they're not different if you don't use this feature. My other panel settings can also be set from the right click menu.

About the error you got there, I don't know why the heck you got it and I also don't use foo_skip so it's hard to say. Is it this line:
Code: [Select]
artist = fb.TitleFormat("%artist%").EvalWithMetadb(g_metadb);

If so, you can make it stop that error by adding this line:
Code: [Select]
if (!g_metadb) return;

Thus when getting this error, the script will simply shows nothing on its panel instead of error out.

My wsh panel code

Reply #6
ermm, no
i mean, i want to get rid just that code (in this screenshot it's "L14 P53"), it's not like i want to get rid of all playing info lol, that's the most interesting of all XD

your work around for albumart works, thanks D:

My wsh panel code

Reply #7
Ah, that's track info including user information if it is available, I will add an option to disable that later and add the work around for your previous problem into the code, too. Stay tuned.

My wsh panel code

Reply #9
now it works great, but i can't get the code to be shown again, even when i checked "last fm track info", is that intended? doesn't matter for me though as i can't understand what it is means lol

thanks again thuan D:

My wsh panel code

Reply #10
Not all tracks has that information, in case like that it simply omitted, it does work for me, so I guess the particular track you were playing does not have that information.

EDIT: Also that information is retrieved by the biography text panel, so you have to have that panel in your config for it to work.

My wsh panel code

Reply #11
oh ok, just kinda weird, cause earlier today it always shown, maybe a problem of my internet connection?
EDIT : oh, that's why, i havent use biography text panel in my main setup lol. i'll try later

btw, this error again lol
Code: [Select]
Skipping track...
Error: WSH Panel Mod (Album Art): Microsoft JScript runtime error:
Invalid procedure call or argument
Ln: 72, Col: 9
<source text only available in compile time>

as it seems the same like my previous error i try using your first workaround and now it works great (again)
just so you know D:

about biography text panel, is it possible to move the directory the artistinfo.xml (and the artist art) download to somewhere else? preferably on music files directory (maybe something like "%path%\lastfm_info")... because this script makes directory under wsh_lastfm on foobar profile directory but i want it can be accessed using another foobar instances (i use portable along with my main setup), and it will be a pain when you open wsh_lastfm and see TONS of directories (there's currently 3567 artists on my library XD)

thanks for your support thuan D:

My wsh panel code

Reply #12
I think I need to install foo_skip to know what the heck happened. I really don't like that workaround, I'm pretty sure that trick won't work in all cases.

About your problem with biography panel, I think putting it %path%\lastfm_info directory is not a good idea (not to mention %path% returns file path, not directory path where the song resides in). For various artist album for example, with the way my code currently working, we'll have clashing problem. So IMO, a correct way is "$directory_path(%path%)\lastfm_%artist%_info".

I will try to find the problem with foo_skip and write options for what you want. It might take a while as I want to implement that option logically.

My wsh panel code

Reply #13
ugh, sorry if i bother you too much >.<
i'm pretty happy with that workaround, at least it didnt crash everytime it skips a song lol

ah yeah, i mean %directory_path%
so uh, where must i put that "$directory_path(%path%)\lastfm_%artist%_info"? there's no way you can put that on common.js right? D:

My wsh panel code

Reply #14
Nah, it's fine. I found the problem with foo_skip and found a permanent fix for that, will release the code later with the data folder setting, as I also have an idea how to make it work now.

My wsh panel code

Reply #15
wow thank you so much XD

My wsh panel code

Reply #16
EDIT: [Updating...] Found another way to workaround foo_skip problem.

My wsh panel code

Reply #17
Updated Changes:

. Fix issues with foo_skip: panel crashes and race condition.
. Bio panel: Added ability to change lastfm cache data folder (right click bio panel -> options -> Set data folder)
. Album art panel: Separated lastfm track info and tag info so user can choose to view either or both.
. Lyrics panel: small change, less refresh happy.
. Small changes in common.js and artist art panel to implement custom lastfm cache data folder.

@Primula: Use this string for data folder "?$directory_path(%path%)" (? included). Then for example, you want to get jpg artist art in another foobar installation use "$directory_path(%path%)\wsh_lastfm\$crc32(%artist%)\*.jpg". Particularly for your configuration it might be different, but you get the gist .

My wsh panel code

Reply #18
I'll try right away XD

My wsh panel code

Reply #19
another error, well, not really, the blame is on my files lol
Code: [Select]
Error: WSH Panel Mod (Biography, main panel): Microsoft JScript runtime error:
Bad file name or number
Ln: 274, Col: 40
<source text only available in compile time>

this one :
Code: [Select]
    if(!fso.FolderExists(data_folder)) fso.CreateFolder(data_folder);

now, it happens because the song I played is still  in .zip/.rar thus foobar can't write inside it so i need another workaround XD
it will be great if you can tell me what can i do with that error, maybe adding a line or two? something like, it'll skip writing/downloading info/pics if the folder attributes is read only
if it can't be done then well, i'll be forced to avoid play a compressed files XD
it just that my collection consist almost half of that and extracting 3k+ files in many folders is a pain in the ass lol
well, eventually i'll extract them all but not in the near future so if there's a workaround it'll be very helpful ^^

sorry and thank you D:

My wsh panel code

Reply #20
A better way is to simply set your lastfm cache folder to somewhere else, but if you insist can you send me what %path% and $directory_name(%path%) returns for these compressed files?

My wsh panel code

Reply #21
something like this?
Code: [Select]
Q:\~Music Dump\(C77) (同人音楽) [少女病] 慟哭ルクセイン (tta+cue).rar|(C77) (同人音楽) [少女病] 慟哭ルクセイン (tta+cue)\慟哭ルクセイン.cue
Q:\[ACHGM]\[2007-07-21] [ACHGM-DIE] [3149] [Byousoku 5cm Special Edition] Masayoshi Yamazaki - One more time.rar|01. Masayoshi Yamazaki - One more time, One more chance.mp3
Q:\[ACHGM]\[2005-01-26] [ACHGM-DIE] [450] CLANNAD Arrange Album - Mabinogi.rar|[2005-01-26]_[ACHGM-DIE]_[450]_CLANNAD_Arrange_Album_-_Mabinogi\09 - megumeru.mp3

Code: [Select]
(C77) (同人音楽) [少女病] 慟哭ルクセイン (tta+cue)
[2007-07-21] [ACHGM-DIE] [3149] [Byousoku 5cm Special Edition] Masayoshi Yamazaki - One more time.rar

My wsh panel code

Reply #22
You have two cases, examples below, original string returns by $directory_path(%path%):
Code: [Select]
Q:\~Music Dump\(C77) (同人音楽) [少女病] 慟哭ルクセイン (tta+cue).rar|(C77) (同人音楽) [少女病] 慟哭ルクセイン (tta+cue)

lastfm data will be saved in:
Code: [Select]
Q:\~Music Dump\wsh_lastfm

and this case:
Code: [Select]
Q:\[ACHGM]\[2007-07-21] [ACHGM-DIE] [3149] [Byousoku 5cm Special Edition] Masayoshi Yamazaki - One more time.rar

saved in:
Code: [Select]

basically saved in directory that contains the compressed archive. I can do this, but you will have problem of accessing lastfm data from another foobar installation. Basically you have to reverse what I did. And that won't be pretty with foobar titleformatting language. For it to be pretty, you probably should ask foobar developers to returns archive path of the archive instead of the current behavior when calling %path%.

My wsh panel code

Reply #23
sou desu ka...
ah well, I'll just set the cache folder to somewhere else, maybe in the root of my eksternal hdd
question, hopefully my last XD
can i use relative path?

My wsh panel code

Reply #24
No, as of now. But I can implement that sometime, quite low priority though, as I wanted to look up and implement other features of lastfm, like love and unlove track... . Also another update of the pack will soon be released that'll fix lastfm cache folder can't be put under path that has non-ASCII chars. Why I didn't think of Windows Short Path before? I should blame it on myself, being not a Windows developer, I'm a HPC guy and linux server admin. Still I refuse to use Linux as everyday OS .