Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • trout
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1775
Neonphytismo, thanks for that reminder!

I actually just saw such an example in the sample scripts, and it made me wonder. But I did not remember reading that warning.

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1776
Quote
3. Don't call repaint functions such as window.Repaint() in callback function on_size() {}, especially in pseudo transparent mode.

I've always found that warning odd, because I'm not sure how it ensures the on_size() call happens first and it worries me that on some occasion it might not...

Edit: However looking through all my scripts, only the one I glanced it to help trout has on_size() calling Window.Repaint() unnecessarily. I have one other (type of) script which employ this as well - via an intermediate function - so far it seems necessary to this (type of) script, i.e. I took it out and it broke...I'm going to meddle with it a bit more, although my view of the warning is still the same.
  • Last Edit: 31 July, 2012, 08:42:01 AM by rawny

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1777
I'm trying to tweak a java script to recognize each of the values in multivalue artist tag fields to generate paths to image folders that I've saved:

Currently, the script allows a user to add paths for images, and a user can add as many paths as desired.  For example, I've entered the following:

C:\\Users\\xxz\\AppData\\Roaming\\foobar2000\\wsh_lastfm\\$crc32(%artist%)\\*.jpg
C:\\Users\\xyz\\AppData\\Roaming\\foobar2000\\wsh_lastfm\\$crc32(%artist%)\\*.png

(thanks to marc2003 for your script capturing and saving last.fm images that we can use elsewhere, as I'm doing here!)

The above entries work well for single value artist tag fields, but currently don't retrieve anything for multivalue artist tag fields (the crc function generates a crc for the string of all the artists in the tag field, and there is no such folder).  But most of the time I've got image folders for each of the artists separately and I'd like to add paths to each of those artists, if possible.

Is there some kind of loop I could add that would generate the separate paths for each artist in a multivalue artist tag field, and if so what would that look like?  Whether the right answer is a loop or not, any suggestions appreciated!


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

Code: [Select]
crcs = [];
num = fb.TitleFormat("$meta_num(artist)").EvalWithMetadb(g_metadb)
for(i =0; i < num; i++) {
    crcs[i] = fb.TitleFormat("$crc32($meta(artist," + i + "))").EvalWithMetadb(g_metadb);
}

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1779
Thanks, marc2003 - that code was the key to making it work!

I currently use a crude but effective way to download images for the nth artist for a track: I use your thumbs script and remap the artist field in the context menu to $meta(artist,n) and restart the song to trigger the search and download.  If there is a more elegant way to grab images for all artiists for a multivalue artist track, suggestions are appreciated, including any tweaks to put in the thumbs script or common4.js.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1780
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

i've shamelessly stolen romor's allmusic script from the foo_uie_biography thread. 

this can display either album reviews or artist bios. the reason i've put this in a WSH panel is because i can support caching which means instant panel updates and offline usage after the initial download of each item. you can also switch between reviews and bios on the fly using the context menu.

existing users of my scripts need to extract the marc2003 folder from the zip as it contains a new file required by this script.

@godrick, i'll look into it.
  • Last Edit: 22 August, 2012, 08:09:46 AM by marc2003

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1781
Marc, I'm very grateful for your work. Just tried out your allmusic script - with each and everything I select I get "no text" - I am really sure I copied everything over to the appdata marc2003 folder. The console has no error at all.
Is there something I can do?

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1782
i've shamelessly stolen romor's allmusic script from the foo_uie_biography thread. 


Wow thanks for this - you rule... and I'm not just sayin' it. =D

It works fine for me - returns results as regularly as the bio panel, however throws up errors occasionally (2 times so far in 10 tracks tested):

Error: WSH Panel Mod (Allmusic by marc2003, Uses a modded version of foo_allmusic.vbs by romor): Microsoft JScript runtime error:
Invalid procedure call or argument
File: <main>
Ln: 70, Col: 2

I can't offer more any more details than that yet as to 'causes...

UPDATE:

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):

line 13; char 7
error Object doesn't support this property or method: 'i.firstchild.firstchild.getAttribute'
code 800A01B6
MS VBScript runtime error.

This error does not appear for albums that are not at Allmusic.
  • Last Edit: 22 August, 2012, 12:24:14 PM by mjm716

  • Dario
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1783
marc, how can I edit your .txt file reader to display preformatted text (such as EAC and CUETools logs)?

Thank you for all your work.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1784
@Emerelle, do you not even see a "fetching info" message for a few seconds? if you see that before the "no text" message, it means the info wasn't found.

also, a limitation of the script is that the album must be on the allmusic site, even in artist bio mode. if there is no album tag, then the script won't run.

@mjm716, i've managed to stop the script erroring (extract marc2003 folder again and import the allmusic.txt into your panel) but i can't fix why it won't display various artist albums that do exist. you'll have to ask romor about that. i'm assuming they also fail in the foo_uie_biography panel as well???

@Dario, right click the panel and select "path to text file". use titleformatting to enter the filename. as an example,  if the filename is "eac.log" and it sits in the same folder as the playing file then you would use

Code: [Select]
$directory_path(%path%)\eac.log


  • Dario
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1785
You didn't understand my query (or perhaps I didn't phrase it well).

I'm talking about something like this:

Code: [Select]
[CUETools log; Date: 23/08/2012 02:12:15; Version: 2.1.4]
[CTDB TOCID: EbOzQZA2.F7k_wn4ygo8ZQjbXW4-] found.
Track | CTDB Status
  1  | (3/3) Accurately ripped
  2  | (3/3) Accurately ripped
  3  | (3/3) Accurately ripped
  4  | (3/3) Accurately ripped
  5  | (3/3) Accurately ripped
  6  | (3/3) Accurately ripped
[AccurateRip ID: 000a4a8e-0036c64a-4c09cd06] found.
Track  [  CRC  |  V2  ] Status
 01    [3c12ca33|d6783547] (2+2/4) Accurately ripped
 02    [ed4a2680|68c012ea] (2+2/4) Accurately ripped
 03    [5c81b1b1|2a9cc5af] (2+2/4) Accurately ripped
 04    [4a491601|508711d5] (2+2/4) Accurately ripped
 05    [99538ce0|1aff3f26] (2+2/4) Accurately ripped
 06    [24fccfc5|301d2fe3] (2+2/4) Accurately ripped

Track Peak [ CRC32  ] [W/O NULL] [  LOG  ]
 --  97.7 [82DD0EAB] [E0DDA975]  CRC32 
 01  97.7 [FC49B125] [C640A7E7]         
 02  97.7 [E1E665AD] [94E1D6EE]         
 03  97.7 [E707FB25] [B2326DDB]         
 04  97.7 [56C2CF85] [808E4293]         
 05  64.0 [F18C3285] [EE5A4EDB]
 06  97.7 [5C5D1E5E] [2C20C7EA]

The whitespaces are preserved and the text is formatted properly, but if I were to just "paste" it, it'd end up being a mess (which is what the .txt reader ends up displaying).
  • Last Edit: 23 August, 2012, 10:54:16 AM by Dario

  • db1989
  • [*][*][*][*][*]
  • Global Moderator
WSH Panel Mod script discussion/help
Reply #1786
Do fixed-width fonts such as Courier New not preserve whitespace when used within the panel?
  • Last Edit: 23 August, 2012, 10:51:00 AM by db1989

  • Dario
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1787
Do fixed-width fonts such as Courier New not preserve whitespace when used within the panel?

Awesome. They do; but what am I supposed to change the normal_font variable with:

Code: [Select]
gr.GdiDrawText(text_array[i + offset], normal_font, g_textcolor, 6, 16 + (i * row_height), ww - 16, row_height, DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);

It uses the generic font, in my case, Ubuntu Condensed, which isn't monospaced. I'd like to change it to Ubuntu Mono or Courier New (the latter preferred).
  • Last Edit: 23 August, 2012, 10:57:45 AM by Dario

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1788
Marc yes I see that message as well - but no info gets displayed even on albums /artists that are on Allmusic (and the tags are intact).

  • Dario
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1789
Okay, I figured the way through my issue by myself. Reading the WSH Panel Mod docs can get you a long way. Thank you guys.

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1790
Adding examples to my post above:
Joy Division - has text, exactly one match in the artist panel (found straight away using the webbuttons of your samples)
Infected Mushroom - also has text, exactly one match, also found through the webbutton from the sample. Still no error in console.

Is it possibly incompatible with anything like the other bio panel?

PS: Ok, now I got for the first time the very same error like a couple of posts above - error in VB Script etc. It is the same message text as posted above.
  • Last Edit: 23 August, 2012, 02:07:35 PM by Emerelle

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1791
the script searches for the album first and then tries to match the artist so it's no good searching for the artist on it's own. can you give some artist/album combinations to test?

also, if you're seeing script errors, that's not a good sign. but i did mention above that i updated the script so it doesn't display errors anymore. it now fails silently.

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):


this is now fixed. the script needs re-importing and the marc2003 folder needs extracting again.

http://dl.dropbox.com/u/22801321/samples.zip
  • Last Edit: 24 August, 2012, 07:34:01 AM by marc2003

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1792
I wasnt aware of an update, your post seemed not modified, I will download that again and report back. I also didnt know I should search for the album first, I will use this advance now.
PS: Ok, now I see the update
  • Last Edit: 24 August, 2012, 10:18:20 AM by Emerelle

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1793
the script searches for the album first and then tries to match the artist so it's no good searching for the artist on it's own. can you give some artist/album combinations to test?

also, if you're seeing script errors, that's not a good sign. but i did mention above that i updated the script so it doesn't display errors anymore. it now fails silently.

Different error:
further testing gives me steady script errors for %album artist% "Various Artists" (on albums that exist at Allmusic):


this is now fixed. the script needs re-importing and the marc2003 folder needs extracting again.

http://dl.dropbox.com/u/22801321/samples.zip

YES! and YES! thank you so much.

I've tried about 50 tracks, and no errors, and I've finally been getting results from 'Various Artists' items - the approximate album name matching seems very robust.

Now comes the annoying follow-up wish!  It would be fantastic to get it to scan the whole library instead of only the current track, to make a complete local data set. =D
[Hopefully that's something I can figure out if you're not interested.]

I do have one general question that doesn't make any sense to me.
The wsh script uses %album artist% (twice). I've tried changing that to %artist% instead (with the idea for example, that when it retrieves a compilation review, it could simply pull the normal artist bio). However, using %artist% returns no results, for regular albums or compilations (checked against known artists with bios).
am I missing something?

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1794
@mjm716, yes I think you are missing something 

The search string in romor's script contains "URL = "http://www.allmusic.com/search/albums/...", for a very good reason if one is looking for both an album review and the right artist bio in one elegant search.  So if you want an artist bio not linked to an album search result, you need to do a different search.  I think the code you need to borrow is already in the script.

For example, consider replacing the "then" portion of of the following "if" statement in the current script:
Code: [Select]
If Lcase(ARG(0)) = "various artists" And ARG(2) = "bio" Then Wscript.Quit() End If

to execute a search using an artist search string:
Code: [Select]
URL = "http://www.allmusic.com/search/artists/" & LCase(Replace(ARG(0), " ", "+"))

So the "then" portion of the "if" statement above would conduct an artist search.  I looked at the web page's source code for such a search result, and I believe you can use the same code as that used to assign artist_link in the current script to find an artist bio, keeping mind that the script will return the first matching search result, which may or may not be the artist you are looking for if it's a common name. 

Make sure you quit the script at the end of this "then" section, and add an "else" line after your new code and just before the existing code that follows the "if" statement above so that the script continues to work as before for album artists that are not "various artists".
  • Last Edit: 24 August, 2012, 06:07:26 PM by godrick

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1795
@mjm716, yes I think you are missing something 

Make sure you quit the script at the end of this "then" section, and add an "else" line after your new code and just before the existing code that follows the "if" statement above so that the script continues to work as before for album artists that are not "various artists".


Thanks G - yes, for some reason, the script logic only sinks in briefly and disappears promptly again.

One other error to report:

If there is no internet  connection, it really freaks out - sends many pop-up error reports that makes the app unresponsive.

vbs script error: line 34, char 3; system cannot locate the resource specified
code 800c0005; source msxml3.dll

with no connection, it should be pulling from a saved file if it exists, or otherwise dumping gracefully?

----
thanks for the good work guys!
  • Last Edit: 25 August, 2012, 09:32:55 AM by mjm716

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1796
yesterday i accidentally removed the part that hides popup errors. at the moment line 101 starts like this....

Code: [Select]
WshShell.Run(script_path....


edit it so it becomes...

Code: [Select]
WshShell.Run("cscript //nologo " + script_path...


i hope it doesn't hang in the background when it fails but i have no way to test this as i'm using a computer at my library where i have no control over any settings.

WSH Panel Mod script discussion/help
Reply #1797
marc2003, regarding your Now Playing script...

Depending on the dimensions of the panel, some artist images work quite a lot better than others. And often, one particular image looks just right.

Would it be possible to add a function to lock a certain image into place? Or to have the panel remember the last image selected?
Alternately, a "delete all but current image" function would work too.

I know this can be accomplished manually, but with thousands of artists it would take a bit of time

Thanks!

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1798
i hope it doesn't hang in the background when it fails but i have no way to test this as i'm using a computer at my library where i have no control over any settings.


that seemed to fix the no internet pop-ups.

however one other bug - if 'allmusic_bio.txt' exists, it's not being read.

   if (fso.fileExists(filename)) g_text = read(filename);

I tested that filename path was correct and file exists = true; but if read is a function, it's missing?
  • Last Edit: 25 August, 2012, 05:09:41 PM by mjm716

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1799
another strange issue -

the WSH version only displays & saves to allmusic_bio.txt the 1st paragraph from allmusic, while the biography panel displays the whole bio text...

=|
  • Last Edit: 27 August, 2012, 11:27:04 AM by mjm716