Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #100
i've been thinking about image support but it's not something i'm particularly bothered about. my main motivation is always going to be making something that i'm going to use. sharing it requires no effort at all. maybe i'll consider it when i'm really bored.

can you point me towards a page that shows the &nbsp?

  • Scidd0w
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #101
After checking alot of artists in my collection when I came back from work it seems a very minor issue. I coud only find one bio so far. I seem to have hit the same artist alot last night or something.

Here's the link btw but don't feel rushed to fix it. It seems the only one as stated above:
http://www.last.fm/music/The+Temper+Trap

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #102
you can just open "scripts\marc2003\lastfm.js" and at the end, you'll see this line of code....

Code: [Select]
return value.replace(/&/g,"&");

just add this on the line before it.

Code: [Select]
value = value.replace(/ /g," ");

BTW, i'm just finishing off a panel to download album artist art from last.fm. i'll post it later on.

screenshot

edit: damn typo.
  • Last Edit: 26 January, 2010, 03:04:26 PM by marc2003

  • Maf
  • [*]
WSH Panel Mod script discussion/help
Reply #103
Is it possible to Graphical Browser for WSH?

  • Scidd0w
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #104
marc2003;
Thanks for the fix.
The screenshot looks great, I'm looking forward to it!

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #105
right i've bundled all my scripts into 1 package. these should be usable by anybody even without scripting knowledge. if you know how add panels to a layout and use things like an "import" button, you pass the test.

download here: http://cid-649d3bfeaf541fbb.skydrive.live....ide/samples.zip

i normally leave a trail of dead links but i'll make sure this one stays. any updates will use this link

the usage of this assumes you have WSH panel mod installed and that safe mode is disabled (File>Preferences>Tools>WSH panel mod>uncheck "Safe mode")

extract the scripts folder from zip into your main foobar directory. overwrite any files if prompted. i've used my username as a subfolder so it shouldn't conflict with anybody else's scripts. now you just need to edit this file foobar path\scripts\marc2003\lastfm.js (this file is compatible with my "playcount stats" script. all settings go in this single file. i hope the comments are self explanatory. and you can just ignore the ones for the panels you're not using. for most people, just adding their username and api key will be enough - an api key is something needed to access lastfm's webservices. get one here

then add as many WSH panels as you want to use to your layout and import 1 or more of text files. no further configuration should be required.

list of panels:

enhanced artwork panel
meant to be a straight replacement for the default CUI/DUI artwork panels.
features:
--always prioritise embedded album art if present
--full support of patterns set in display preference
--on the fly refresh. this means you can add/edit artwork for the currently playing track and use the "Refresh" context menu item to update the panel. with the standard panels, you have to restart playback.
--tooltip to show image dimensions and current display size. also shows if image is embedded or not.
--has the usual context menu items to set front/back/artist/correct aspect etc

simple text only biography panel
--built in caching support so it doesn't update on every track change (default expiry time is 24 hours because it shows your playcount for each artist. i figured an update every day would be enough)
--button to launch last.fm radio / browse last.fm website

simple seekbar
--shows realtime seek position when dragged.
--move mouse out of bounds downwards to automatically release the drag in the currently playing position

last.fm artist art panel
--download and display artist artwork from last.fm. must be triggered manually using the context menu.
--option to set the number of images to download in the aforementioned configuration file. i've set a default of 5. be warned, some of the images can be very large. i've had some 2-3mb files.
--when images are downloaded, you can scroll through them with your mouse wheel. also, double clicking the panel will open the current image in your default viewer.
--shows new random image on each new track (assuming there are images present for that artist)
--does not use the foobar artreader at all - it stores it's owns files. panel has "open containing folder" option for easy access.

playback buttons
--sample buttons for use in DUI. supports any size images you like. you can replace the included images with your own.

all panels support the default colouring scheme of CUI and DUI as can be seen in this screenshot i posted above.
  • Last Edit: 26 January, 2010, 06:47:32 PM by marc2003

  • Bollerkopp
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #106
Hey Marc,

great work... thank you very much.

But I'm getting the following error if I want to use your "simple biography":

Quote
WSH Panel Mod (GUID: 8CFF1E32-BA19-428C-9A98-4852EAFD9818): Microsoft JScript runtime error:
Invalid procedure call or argument
Ln: 112, Col: 2
<source text only available in compile time>

Line 112 is:

Quote
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh-40,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();


I'm an absolute beginner in this JScript-thing and I don't know what it means. Do you have an idea?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #107
have you definitely got the scripts folder from the zip extracted into your foobar install directory? i can't think what else would cause that. also, are you running the very latest version of WSH panel mod?

http://code.google.com/p/foo-wsh-panel-mod/downloads/list
  • Last Edit: 26 January, 2010, 08:16:46 PM by marc2003

  • Bollerkopp
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #108
Yes, I run the latest version and I extracted the "scripts"-folder into the foobar install directory. I checked not only once.

I deleted the "foo_uie_wsh_panel_mod.dll.cfg"-file in the configuration-folder and tried it again, too, but no luck.

In the line 112 it's about text and font. Perhaps it's a missing font? It seems that you use "Segoe UI", or? But I have it on my system. No idea...
  • Last Edit: 26 January, 2010, 08:32:07 PM by Bollerkopp

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #109
i've been testing in columns UI and default UI all along and other people have been using that script for quite awhile without problems. just now i did a clean portable install and used only the files in the download to setup from scratch and it all works as it should. i even booted into my xp install and that works with no problems as well. i'm totally stumped. 

WSH Panel Mod script discussion/help
Reply #110
Is there a way to use a WSH panel to cycle through images in a folder path like \Artist Images\%artist%\%artist%*.jpg, cycling either by mouse click/wheel, or preferably by changing every X seconds?

I've tried to look at some of the scripts posted here and elsewhere but finding a difficult time to glean the appropriate lines.  Any help would be appreciated!

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #111
i've updated my sample package a few posts up with a crude image cycling script. might not be tested as much it should. give it a try. settings have to be set inside the script.

you can ignore all the waffle about configuring the last.fm script - obviously not needed. just extract scripts folder and import the image cycler script.
  • Last Edit: 27 January, 2010, 05:10:42 AM by marc2003

  • Scidd0w
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #112
Thank you marc2003.
Can't wait to test them out tonight. As it's a complete package of your scripts, I'm missing the rating panel and the last.fm playback stats sync panel. Any reason why you left them out? (Not as good as you want them to be yet?)

WSH Panel Mod script discussion/help
Reply #113
The image cycle script works great out of the box, but I can't figure out how to point to my image folder.

I've tried changing the line

folder_title_format = "$directory_path(%path%)\\";

to many different methods to point to M:\Artist Images\%artist% both with and without the $directory_path function without success.  Is this the line I should be editing or is it elsewhere?  Can you help?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #114
did you use double backslashes to separate folders like the comments said?

Code: [Select]
folder_title_format = "M:\\Artist Images\\%artist%\\"


sorry i forgot to mention to include trailing slashes for the folder- only the example showed this.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #115
(Not as good as you want them to be yet?)


you've just made me cry. 

  the last.fm playback stats has it's own thread and i must admit, i totally forgot about rating - this is because i don't use it. but i'll include it later on.

edit: oh flip. double post. sorry mods.
  • Last Edit: 27 January, 2010, 06:25:53 AM by marc2003

WSH Panel Mod script discussion/help
Reply #116
Marc - The image cycle script works perfectly!  Thanks for the help!

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #117
I'm still working on my lyrics display but have some questions on how to do some things i still need to improve in the script.

Here is the current script:
http://pastebin.de/3519

- It displays all lyrics as plain text (doesn't supports timestamps, only ignores the stamps on display).
- Can be switched to "Autoscroll" via context menu (only for lyrics longer than the panel)
- a "fading effect" can also be turned on (only when autoscroll option for long texts is active, because it may "disguise" textparts otherwise  . Maybe i change it next time...)
- a manual "reset" option is available via context menu, too (if one adds an external textfile to the search path folder during playback it will be displayed immediately)
- via "Properties" padding settings can be made
- also in "Properties" search paths for Lyrics can be changed
- and - if foo_lyricsgrabber or foo_lyricsdb is present in the components folder - a online search command can be executed (set up in Properties as well).

My Problems:
1.) I don't know exactly if i have used Dispose() correctly...

2.) As you can see i have two Properties for lyrics path, one for TXT-files, one for LRC-files.
I'd have them in one Property but have no idea about, how i can make it that utils.ReadTextFile auto-recognizes the file ending and only uses txt or lrc.
I asked T.P Wang still and he said to me, i could use utils.Glob() for this (as var arr = utils.Glob("{$filename}.*").toArray();), but i have no clue how to add it (haven't seen any sample using it and you have to know: i'm a scripting-idiot...  )
And then i had to test this array with /\.(lrc|txt)$/m.
Can anyone give me an example how to use/include it in my script?

I think these are my only problems.
If someone finds any errors in my script or have ideas improving it, please let me know
Thanks

EDIT:
After reading my own post, if haven't understood myself... 

So let me specify:
I want something like this:
var ext_lyrics = window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");
var filetype = (This is my problem... How can i make it to only recognise "lrc" and "txt" and prefer "lrc" when both are in the search path?)
var reading = utils.ReadTextFile(fb.TitleFormat(ext_lyrics).Eval() + filetype);

Anybody an idea?
Or a better solution?
  • Last Edit: 27 January, 2010, 09:19:47 AM by tedgo

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #118
something like

Code: [Select]
var lrc = utils.Glob(ext_lyrics + ".lrc").toArray();
var txt = utils.Glob(ext_lyrics + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) file = arr[0];


or maybe use fso.FileExists with an if else if?
  • Last Edit: 27 January, 2010, 10:24:44 AM by marc2003

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #119
No, i want to avoid using FSO.
I want it working without user action (with FSO "Safe mode" has to be disabled first).

Thanks for this snippet.
Maybe i found out how to use it in my script with that fb.Titleformat
(i want to call fb.Titleformat only once, not more than necessary)

I'd need to call it twice with this snippet, do I?
Code: [Select]
var lrc = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".lrc").toArray();
var txt = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) file = arr[0];
var reading = utils.ReadTextFile(file);

Is it correct?
(You see, i really have only basic knowledge about what i'm doing... )

  • T.P Wang
  • [*][*][*][*]
  • Developer
WSH Panel Mod script discussion/help
Reply #120
What the utils.Glob() do is using wildcards and return a VBArray of matched items:
e.g:
Code: [Select]
var arr = utils.Glob("D:\\something.*").toArray();

will match:
D:\something.txt
D:\something.dat
D:\something.blah
...

and then iterate that array, exclude unnecessary items:
Code: [Select]
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.txt$/m) {} // text file
    else if (arr[i].match(/\.lrc$/m) {} //lrc file
    ....
}
  • Last Edit: 27 January, 2010, 10:47:44 AM by T.P Wang

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #121
Ah, thanks, now its more clear
Haven't found anything about utils.Glob() except the short description in "Interfaces.txt".
(And you know, i need looooooooooong descriptions and explanations always twice ).

Thanks again
  • Last Edit: 27 January, 2010, 10:54:22 AM by tedgo

  • TomBarlow
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #122
Thanks for the last.fm script Marc, it works well. The only problem I have with it is it seems immensely slow when it comes to scrolling. I think it is because of the longs lines that have to be wrapped, I have a lyric panel that is far far quicker to scroll. I wonder if it would be possible to wrap the text before painting it then paint that?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #123
I'd need to call it twice with this snippet, do I?


just once. what i'd do is this...

Code: [Select]
//outside of any functions so it gets set (if needed) on script load
window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");

//inside your function
var lyrics_path = fb.TitleFormat(window.GetProperty("Lyrics Path")).Eval();
var lrc = utils.Glob(lyrics_path + ".lrc").toArray();
var txt = utils.Glob(lyrics_path + ".txt").toArray();
arr = lrc.concat(txt);
if(arr.length > 0) var reading = utils.ReadTextFile(arr[0]);


I wonder if it would be possible to wrap the text before painting it then paint that?


hehe, i have no idea what any of that means. i'm still very noob at this. i'm using the sample script T.P provided to calculate the height. maybe you can ask him?

I have a lyric panel that is far far quicker to scroll.


if that's the case, can't you just modify the on paint bits from that into the biog script?
  • Last Edit: 27 January, 2010, 11:45:08 AM by marc2003

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #124
Thanks, i'll try it, too