Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1575
to make it work you have to eval the TF with true, just by testing if a track is playing... here is the fix (note: bitrate wasn't declared as global ==> added too)

Code: [Select]
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var bitrateTF = fb.TitleFormat("%bitrate%' kbit/s'");
var bitrate;

var textFont = gdi.Font("Tahoma", 10, 1);
var textColour = RGB(255, 255, 255);

if (fb.IsPlaying){
update();
}

function on_size() {
ww = window.Width;
wh = window.Height;
}

function update() {
if (fb.IsPlaying) bitrate = bitrateTF.Eval(true);
window.Repaint();
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
}

function on_playback_dynamic_info() {
update();
}
function on_playback_dynamic_info_track() {
update();
}

  • amalone
  • [*]
WSH Panel Mod script discussion/help
Reply #1576
Using WSH Playlist Viewer Beta 9. I have the playlist, album list and album art viewer all visible. Start playing a FLAC file and correct cover art is visible in album art viewer. Highlight a different FLAC file in album list and the cover art for that file is now visible. Click back on FLAC that is playing and cover art does not change back. With ES Playlist cover art changes back to the playing FLAC cover art. It is like a disconnect with WSH Playlist Viewer after highlighting a file in album list. Not sure if that is how it has to work.

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1577
Using WSH Playlist Viewer Beta 9. I have the playlist, album list and album art viewer all visible. Start playing a FLAC file and correct cover art is visible in album art viewer. Highlight a different FLAC file in album list and the cover art for that file is now visible. Click back on FLAC that is playing and cover art does not change back. With ES Playlist cover art changes back to the playing FLAC cover art. It is like a disconnect with WSH Playlist Viewer after highlighting a file in album list. Not sure if that is how it has to work.

sorry but it's not really clear ...

Start playing a FLAC file and correct cover art is visible in album art viewer

ok, art viewer, so not my wsh playlist... let's go next

Highlight a different FLAC file in album list and the cover art for that file is now visible.

why you say "now" wasn't ok before in playlist? "visible", where ? in art viewer or playlist or both ?

Click back on FLAC that is playing and cover art does not change back.

what do you mean by "Click back on" ? could you explain on what you click please, and when you said "cover art does not change back, yu mean in playlist or art viewer ?


*waits for details and answers*

thanks by advance
  • Last Edit: 05 May, 2012, 05:47:37 AM by Falstaff

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1578
to make it work you have to eval the TF with true, just by testing if a track is playing... here is the fix (note: bitrate wasn't declared as global ==> added too)


Sweet that fixed it and I missed bitrate being a global when I converted it to a simpler example 

It may be worth mentioning that I had to change the on_paint function to the following:
Code: [Select]
function on_paint(gr) {
     gr.FillSolidRect(0, 0, ww, wh, RGB(0,0,0));
     if (fb.IsPlaying) {
         gr.GdiDrawText(bitrate, textFont, textColour, 0, 0, ww, wh);
     }
}

And I also had to add a call to the update function from an on_playback_stop handler.

Cheers for the help

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1579
WSH CoverFlow v1.2: http://pastebin.com/u/Br3tt

- cover placement enhanced by adding a toolbar (like my in my WSH playlist viewer)
- tweaks



  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1580
WSH CoverFlow v1.2: http://pastebin.com/u/Br3tt

- cover placement enhanced by adding a toolbar (like my in my WSH playlist viewer)
- tweaks


I would love to be able to use this, but it massively lags foobar when I try and scroll through the album art (even if I just scroll one cover either direction). I reduced the size of the panel which helped but it's still laggy enough to disrupt the audio as the cover changes 

It may well just be a side-effect of the fact I'm running foobar under WINE, but I was wondering if anyone might have any ideas on reducing the lag in any way. No worries if not.

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1581
@rawny:

running it under linux is for sure not a benefit for performances... you can still try to disable all effects like glass effect, scroll transition ...

but i don't think it's made for the use you make, try it under windows and you'll see the difference

EDIT: ...my script may lag too under Android with a virtualized windows partition
  • Last Edit: 05 May, 2012, 11:25:02 AM by Falstaff

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1582
@Falstaff:

Hehe well I'm not running Linux (Ubuntu specifically) to try and get good performance from your coverflow, I'm just trying to see if I can achieve better performance in the Ubuntu that I was already running 

(And I know that this will inevitably have a bottleneck and I'll probably not be able to use it. I wanted to try and push it anyway just in case it is usable - 'cause I would love to have a coverflow if possible  )

How do I disable said effects? Should I just look for them in the code and comment them out?

Edit: I found the window.getProperty part in the code and changed all the graphics related-ones (reflection, focus rectangle, glass, scroll animation) to return false straight off (and I changed flat style to true) and it's reduced the lag a fair bit. It still lags a tad but it's nowhere near as bad as it was.
  • Last Edit: 05 May, 2012, 11:54:54 AM by rawny

  • amalone
  • [*]
WSH Panel Mod script discussion/help
Reply #1583
WSH Playlist 9. Sorry, that was clear as mud. I have the cover art turned off in WSH Playlist. I strictly view cover art in the Album Art Viewer as I like to view it a little larger. On the left top is the album list, left bottom is the album art viewer, and on the right is WSH playlist. It looks really nice thanks to you.

If I start a FLAC file playing, the details are in the WSH playlist (right), and the correct cover art is in the foobar2000 art viewer (lower left). If I click, without actually starting playback, on another FLAC file in the album list (upper left), the album art changes to that file in album art viewer. Nothing changes in WSH playlist as cover art is turned off. Then I click back on a track actually playing in WSH playlist, and the cover art does not change to the playing FLAC cover. In ES playlist it does as I used that set up for a while. Thank you.

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1584
@marc2003, thanks very much for your "similar artists" WSH script and others.  Concerning the "similar artists" script, I'd like to suggest a tweak or enhancement that is beyond my ability to code.  Context: I use the "artist" tag to include all of the performers for a given song.  Most of the time, it just contains a band name or the name of the person I consider the primary artist for the song, and everything integrates perfectly with your script.  But for some songs I have multiple persons or bands in a single "artist" tag to reflect featured performers, ad-hoc ensembles, etc.  In these cases, the "similar artist" script correctly searches for the string of the entire content of the "artist" tag and returns nothing.

To handle the cases where I have multiple artists in the "artist" tag, I'd like a way to manually enter which artist to search for in the "similar artist" script, perhaps from a context menu prepopulated with the current "artist" content so I can delete all but one artist for a search.  I think a method of manual entry and override of the default action would be the most efficient way to meet this need, instead of trying to identify, parse, select, and search for multiple artists, but I certainly defer to you if there is an easier way to do it.

I think many others use the "artist" tag in a simlar manner and thus this tweak would be of use to many others as well, but if that assumption is incorrect then please let me know.  Thanks again for your efforts!

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1585
you could replace %artist% on line95 with $meta(artist,0) and that would use the first artist.

changing the setting per artist isn't really feasible.

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1586
That will work well enough, and I can just change the zero to another number to select another artist.  Thanks!

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1587
if you are going to tinker with that value for different artists, you might want to comment out line 123 as that will try to fetch updated info from last.fm if the stored data is more than 1 day old. obviously it would use the current setting and not whatever was used to fetch the original data.

  • pIv
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1588
2 Falstaff

If I want use coverflow panel for my media library now - I must create seperate playlist and load in it all song from media library.

It is possible in future use coverflow with media library without playlist with media library content?
  • Last Edit: 07 May, 2012, 03:13:44 AM by pIv

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1589
2 Falstaff

If I want use coverflow panel for my media library now - I must create seperate playlist and load in it all song from media library.

It is possible in future use coverflow with media library without playlist with media library content?


actually not.

WSH Panel Mod script discussion/help
Reply #1590
Maybe if T.P. Wang is kind enough to give us a new feature like GetLibraryItems then it would be possible. 

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1591
updates!

WSH Playlist Viewer v2.0 (final)
WSH CoverFlow v1.4

* Scripts available at http://pastebin.com/u/Br3tt

* I have included them in a simple DefaultUI config (just a .fth to import), for those who are interested, get it at http://fav.me/d4z1j0w

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

changes to news / reviews / blogs, now playing, thumbs and similar artists scripts only.

added artist field remapping option to context menu.



(simple biography already has this feature)

edit: added feature to news / reviews / blogs as well.
  • Last Edit: 08 May, 2012, 09:31:39 AM by marc2003

  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1593
I have added mouse hover-seek popup info to my 'WSH volume control', but it has a small problem;

This is correct:
When I mouse click-drag-seek, the text display range in the 'WSH volume control' main window goes from -100dB at left end to 0dB at right end.

This is NOT correct:
When I mouse hover-seek, the text display range in the 'WSH volume control' hover popup goes from -287dB at left end to 0dB at right end.

Is anybody here familiar with the mathematics of the volume display?
Could you please review my code for the hover info function and tell me what is wrong.
Here is the relevant function (the problem lines are in red):
Quote
function on_mouse_move(x,y) {
      window.SetCursor(32649);
      if(g_drag) {
           var v = x / window.Width;
           v = (v<0) ? 0 : (v<1) ? v : 1;
           v = 25 * Math.log(v+0.00001);
           if(fb.Volume != v)
                fb.Volume = v;
      }
      g_hover_seek = null;
           g_hover_seek = x / window.Width;
           g_hover_seek = (g_hover_seek<0) ? 0 : (g_hover_seek<1) ? g_hover_seek : 1;
           g_hover_seek = 25 * Math.log(g_hover_seek+0.00001);
           g_hover_seek = (Math.ceil(g_hover_seek)) + "dB";

   g_hover = x + 4;
   window.Repaint();
}
  • Last Edit: 08 May, 2012, 09:49:13 AM by derty2

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1594
i'm not really sure what you're doing there???

i took the sample Volbar with GdiDrawText.txt and added hover tooltip support here....

http://pastebin.com/j2JNZHBA

  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1595
I tried out your code there marc.
As soon as my mouse entered hover coordinates, WSH Panel Mod crashed with error: Line 39, Column 9, Object doesn't support property or method.
So I commented out line 39 and tried again.
As soon as my mouse entered hover coordinates, WSH Panel Mod crashed with error: Line 47, Column 9, Object doesn't support property or method.

I am using WSH Panel Mod version 1.4.3 .
I refuse to upgrade to newer versions because my WSH auto-cycling Artwork Viewer doesn't work perfectly with newer versions .

The function code I posted before works perfectly except for the mathematical calculation of the decibel range for the tooltip.
The mathematics of 25 * Math.log(g_hover_seek+0.00001) gives the same scaling as the built-in foobar2000 volume slider (logarithmic).

Here is the full code posted online (it works perfect except for the tooltip info calculation error): http://textsnip.com/my/wsh_volume_control/jscript

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1596
heh, i was using the linear example and it also uses new tooltip functions only found in 1.5.0+. yours doesn't use tooltips so your description is a bit misleading....

i'm not editing your whole script because it makes my head hurt but the main change is here....

Code: [Select]
function on_mouse_move(x,y) {  
    window.SetCursor(32649);  
    v = x / window.Width;  
    v = (v<0) ? 0 : (v<1) ? v : 1;  
    v = 25 * Math.log(v+0.00001);  
    if(g_drag && fb.Volume != v) fb.Volume = v;    
    window.Repaint();  
}


i've removed "var v=..." because it needs to be global. v needs to be used as the hover text in on_paint.

  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1597
Thanks for the help marc, but...

you've just cleaned up a subroutine which was already working (notwithsatnding the removal of "var v=...").
In fact, the "g_hover_seek" section –which you removed– was working too except for one small problem:

When moving the hovered mouse cursor to the extreme left position, the tooltip display should stop at -100dB; but it doesn't, it stops at -287dB.
Nothing else is wrong with my code; the dB display in the WSH window and the tooltip are syncing correctly when I hover seek all through '0db to -100dB';
except the dB display in the the tooltip continues to increase as I go left beyond -100dB.

The mathematics of "window width vs tooltip dB display"  are wrong somewhere in my code; my code fully works.

Your final comment "v needs to be used as the hover text in on_paint." seems to be resolving the issue.
How exactly do I use v in on_paint? Do I have to declare "v" as a variable again at "on_paint(gr)", or is it called from your new "on_mouse_move(x,y)" subroutine.
  • Last Edit: 08 May, 2012, 06:39:40 PM by derty2

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1598
well the maths is too much for my poor brain. but i did find some different code by fbuser. you could try it instead....

on_paint
Code: [Select]
pos = window.Width * Math.pow((100+fb.Volume)/100,2);


on_mouse_move
Code: [Select]
v = x / window.Width;
v = (v < 0) ? 0 : (v < 1) ? v : 1;
v = 100 * (Math.pow(v,1/2) - 1);
if (g_drag) fb.Volume = v;


v is the text string you want to use in on_paint

Code: [Select]
gr.GdiDrawText(v + "dB", g_font, RGB(255,255,255).....



  • derty2
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1599
This is too much for my poor brain too marc; I'm giving up.
For all intents and purposes the code works; one has to try very hard to actually notice the tooltip problem, it is that minor.
Thanks for the help +++