IPB

Welcome Guest ( Log In | Register )

142 Pages V  « < 90 91 92 93 94 > »   
Reply to this topicStart new topic
WSH Panel Mod script discussion/help
tarkus721
post Apr 17 2013, 18:00
Post #2276





Group: Members
Posts: 5
Joined: 17-April 13
Member No.: 107713



Hi marc!

Your News / Reviews / Blogs wsh panel crashes when scrolling down (mouse wheel) on 'Reviews' view if the artist name contains an ampersand.
ex: Emerson, Lake & Palmer; Bog Seger & The Silver Bullet Band.

Error: WSH Panel Mod (News / Reviews / Blogs by marc2003): Microsoft JScript runtime error:
Invalid procedure call or argument
File: C:\My Applications\Placebo Monolithic\foobar2000\marc2003\common7.js
Ln: 1615, Col: 6
<source text only available at compile time>

Thanks smile.gif
Go to the top of the page
+Quote Post
marc2003
post Apr 17 2013, 18:29
Post #2277





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



it's not the ampersands. i can't explain why but some of the article's text consists of a single space and that is causing the problem. anyway, fixed version uploaded. right click>Update script.

changelog - https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt
full download - https://dl.dropboxusercontent.com/u/22801321/samples.zip
Go to the top of the page
+Quote Post
tarkus721
post Apr 17 2013, 19:01
Post #2278





Group: Members
Posts: 5
Joined: 17-April 13
Member No.: 107713



That did the trick...thanks! cool.gif
Go to the top of the page
+Quote Post
matav
post Apr 18 2013, 14:26
Post #2279





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



hey marc,
say my code for a button for the time being is:
CODE
//...
//tipText = {normal: "Next", alternate: "Random"}
//func = function(){fb.next();}
//altFunc = function(){fb.random();}

function Button(x, y, w, h, defaultImage, hotImage, func, tipText, altFunc)
{
    //...

    if(altFunc === null){
        this.altFuncFlag = false;
    }
    else{
        this.altFuncFlag = true;
        this.altFunc = altFunc;
    }
}

what i want to do is check if the altFunc parameter was passed within the button function.
so i start the if condition to do my business as:
if(is there an altFunc?){...}

but how should i go about it?
unsure.gif

This post has been edited by matav: Apr 18 2013, 15:04


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
marc2003
post Apr 18 2013, 16:31
Post #2280





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



that looks rather complicated. for buttons without an alternate function, just assign the normal function to the variable.
Go to the top of the page
+Quote Post
matav
post Apr 18 2013, 19:38
Post #2281





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



QUOTE (marc2003 @ Apr 18 2013, 16:31) *
that looks rather complicated...
true that but i am basically modding T.P. Wang & Tedgo's script for the moment.
So, i am kinda messing it up (progressively but i am happy with the results)
tongue.gif
i did, however, achieve this (thanks to this link at stackoverflow)

now, i have it done this way:
CODE
//func = function(){fb.next();}
//func_alt = function(){fb.random();}

function Button(x, y, w, h, img_src, func, tiptext, func_alt) {
    //...

    this.func = func;

    if(typeof func_alt === 'undefined'){
        this.func_alt_flag = false;
    }
    else{
        this.func_alt_flag = true;
        this.func_alt = func_alt;
    }
}

and for buttons without any alternate function, it doesn't matter cuz that's where the the flag comes handy (the only place it comes handy)

This post has been edited by matav: Apr 18 2013, 19:46


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
marc2003
post Apr 18 2013, 19:57
Post #2282





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



this is how i'd do it.

CODE
this.func = func;
this.func_alt = func_alt || func;


if func_alt is undefined, it will use the default function.
Go to the top of the page
+Quote Post
matav
post Apr 18 2013, 20:01
Post #2283





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



lol
that's even better
*sigh*

thanks
biggrin.gif

--
headbang.gif

This post has been edited by matav: Apr 18 2013, 20:03


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
Curly
post Apr 22 2013, 19:38
Post #2284





Group: Members
Posts: 11
Joined: 17-September 10
Member No.: 83913



Hi!

I am using this script as a volume bar;


QUOTE
// vi:set ft=javascript ff=dos ts=4 sts=4 sw=4 et:

// ==PREPROCESSOR==
// @name "Volbar"
// @author "T.P Wang"
// ==/PREPROCESSOR==

function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}

// gdi.Font is changed, the last paramter is style flags
// FontStyleRegular = 0,
// FontStyleBold = 1,
// FontStyleItalic = 2,
// FontStyleBoldItalic = 3,
// FontStyleUnderline = 4,
// FontStyleStrikeout = 8
// Here is 0, means FontStyleRegular
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;

function on_paint(gr) {
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos = window.Width * ((100 + volume) / 100);
var txt = (Math.ceil(volume)) + "dB";
gr.FillGradRect(0, 0, pos, wh, 90, RGB(240, 240, 240), RGB(100, 230, 100));
gr.FillGradRect(pos, 0, ww - pos, wh, 90, RGB(240, 240, 240), RGB(190, 190, 190));
gr.DrawString(txt, g_font, RGB(64, 64, 128), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0, 0, ww - 1, wh - 1, 1.0, RGB(150, 150, 150));
}

function on_mouse_lbtn_down(x, y) {
g_drag = 1;
}

function on_mouse_lbtn_up(x, y) {
on_mouse_move(x, y);
g_drag = 0;
}

function on_mouse_move(x, y) {
if (g_drag) {
var v = x / window.Width;
v = (v < 0) ? 0 : (v < 1) ? v : 1;
v = -100 * (1 - v);
if (fb.Volume != v) fb.Volume = v;
}
}

function on_mouse_wheel(delta) {
if (delta > 0) fb.VolumeUp();
else fb.VolumeDown();
}

function on_volume_change(val) {
window.Repaint();
}


Is there any way of modifying this script to act as a seekbar?
Go to the top of the page
+Quote Post
matav
post Apr 22 2013, 21:29
Post #2285





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



curly... you want to modify this sample or simply want a seekbar?
cuz imho, to make this a seekbar is as good as modifying the entire script.

if you want a similar type seekbar then check this post:
http://www.hydrogenaudio.org/forums/index....st&p=628170
...the one starting with "var DT_TOP = 0x00000000;"

This post has been edited by matav: Apr 22 2013, 21:35


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
Curly
post Apr 22 2013, 21:54
Post #2286





Group: Members
Posts: 11
Joined: 17-September 10
Member No.: 83913



QUOTE (matav @ Apr 22 2013, 22:29) *
curly... you want to modify this sample or simply want a seekbar?
cuz imho, to make this a seekbar is as good as modifying the entire script.

if you want a similar type seekbar then check this post:
http://www.hydrogenaudio.org/forums/index....st&p=628170
...the one starting with "var DT_TOP = 0x00000000;"


Thanks for the help! Got it working. smile.gif
Go to the top of the page
+Quote Post
matav
post Apr 23 2013, 08:33
Post #2287





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



QUOTE (marc2003 @ Apr 17 2013, 14:40) *
yes that's definitely possible.

this is the callback for a left mouse click and you can check whether shift was held.

CODE
function on_mouse_lbtn_up(x, y) {
    if (utils.IsKeyPressed(0x10)) {
        //shift key was pressed. do something
    } else {
        //do something else
    }
}

hey marc, i was reading Flags.html and was wondering whether i can skip "utils.IsKeyPressed(...)" and use the flag mask "MK_SHIFT" in, say, "on_mouse_lbtn_up(x, y, mask) {}".
but since i don't have much experience in WSH/jscript per say, i am unable to get this to work.

i am doing it so:
CODE
var MK_SHIFT = 0x0004;
function on_mouse_lbtn_up(x,y,MK_SHIFT){
    fb.trace("something");
}
but it ignores the mask and works like a normal mouse callback function.

i can't figure out what i may be doing wrong.


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
ExtremeHunter
post Apr 23 2013, 08:56
Post #2288





Group: Members
Posts: 133
Joined: 5-October 08
From: Estonia
Member No.: 59398



function on_mouse_lbtn_up(x, y, mask){

if (mask == 4) {
//shift key was pressed. do something
} else {
//do something else
}

}
Go to the top of the page
+Quote Post
matav
post Apr 23 2013, 09:03
Post #2289





Group: Members
Posts: 147
Joined: 27-November 10
From: Earth
Member No.: 86055



aah...
thanks
rolleyes.gif


--------------------
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb
Go to the top of the page
+Quote Post
marc2003
post Apr 24 2013, 15:37
Post #2290





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

QUOTE
added new "last.fm album info" script. just be aware
many albums have no content. however, clicking the
logo should open the last.fm website on
most album pages.

Go to the top of the page
+Quote Post
marc2003
post Apr 25 2013, 05:18
Post #2291





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

new script: spectrogram seekbar



notes-
-it requires ffmpeg and SOX. download links are in the script.
-because it uses ffmpeg for decoding files, you're limited to the codecs it supports. what foobar input components you might have are irrelevant.
-images are generated automatically as songs are played. there can be a delay of a few seconds when playing something for the first time. foo_wave_seekbar users should be used to this.
-current settings create images around 80KB in size per track. these are stored in a folder inside your foobar2000 profile.
-tooltips indicate track position without having to drag
-does not support cuesheets

files changed / added:
CODE
marc2003\common7.js
marc2003\images\hourglass.png
samples\spectrogram seekbar.txt


This post has been edited by marc2003: Apr 25 2013, 05:23
Go to the top of the page
+Quote Post
marc2003
post Apr 25 2013, 10:31
Post #2292





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

QUOTE
7.2013.04.25.02

"Spectrogram seekbar". Bugfix. Panel would show previous
spectrogram when switching to an unsupported format like
a stream.


files changed:
CODE
marc2003\common7.js
samples\spectrogram seekbar.txt
Go to the top of the page
+Quote Post
marc2003
post Apr 25 2013, 15:08
Post #2293





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



samples updated. same links as above. added a few options to my spectrogram seekbar script.



other seekbars have been cleaned up slightly.

files changed:
CODE
marc2003\common7.js
samples\nyan cat seekbar.txt
samples\simple seekbar.txt
samples\spectrogram seekbar.txt
samples\themed seekbar.txt
Go to the top of the page
+Quote Post
r0k
post Apr 25 2013, 18:14
Post #2294





Group: Members
Posts: 74
Joined: 8-September 11
Member No.: 93574



Hi marc. Nice addition to your panels. Couple suggestions, feel free to ignore them wink.gif
  • Name is quite long as you use the full path. I'm not sure how much you can put in a filename in windows 7/8 but i'm surprised my system doesn't complain names are too long. This might cause some issues if the path is compicated. Maybe using some sort of crc32 or hash of the music file would be better. Not sure it's possible.
  • Reading the panel size from and producing a spectro image fitting the panel would give a cleaner display.
  • You can reduce the size of the png images in the cache ( to about 2/3 of their size in my tests) by using OptiPNG. It's only a 97k command line portable tool (and open source like all tools you've used so far).


BTW, as i was posting this, i just had your "Now Playing" panel crash on me out of the blue
CODE
WSH Panel Mod (Now Playing by marc2003): initialized in 17 ms
Error: WSH Panel Mod (Now Playing by marc2003): Erreur d'exécution Microsoft JScript:
Objet requis
File: C:\Users\Roland\AppData\Roaming\foobar2000\marc2003\common7.js
Ln: 1393, Col: 4
<source text only available at compile time>

Looks like it's pointing to this part of common7.js
CODE
function cd(x, y, w, h) {
    this.draw = function(gr) {
        if (this.shadow) p.draw_image(gr, this.shadow_img, this.x, this.y, this.w, this.h, "centre");
        p.draw_image(gr, this.case_img, this.x, this.y, this.w, this.h, "centre");
        if (this.img) {
→           this.ratio = Math.min(this.w / this.case_img.Width, this.h / this.case_img.Height);
            this.nw = 488 * this.ratio;
            this.nh = 476 * this.ratio;
            this.nx = Math.round((this.w - (452 * this.ratio)) / 2);
            this.ny = Math.round((this.h - this.nh) / 2);
            p.draw_image(gr, this.img, this.nx + this.x, this.ny + this.y, this.nw, this.nh, "crop");
        }
        p.draw_image(gr, this.semi_img, this.x, this.y, this.w, this.h, "centre");
        if (this.gloss) p.draw_image(gr, this.gloss_img, this.x, this.y, this.w, this.h, "centre");
    }
    ...

This all occured at the same time i had my Router crash, as i've noticed when trying to post this i no longer had internet connection. Probably related to the LastFM biography.

EDIT : On the other hand, it might be totally unrelated. I have the panel crashed again right now, and still have Internet access.

This post has been edited by r0k: Apr 25 2013, 18:53
Go to the top of the page
+Quote Post
marc2003
post Apr 25 2013, 19:51
Post #2295





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



i've just removed the spectrogram seekbar from the zip temporarily because it randomly crashes on track changes and i can't figure out why. it's been fine all afternoon but it's just started playing up now. dry.gif

spectrogram seekbar has been restored. it should be ok now. just right click>update script to fix.

@r0k, that error would suggest it can't find the case images. but if you've been using it for sometime without issue then i have no idea what would cause it to go wrong all of a sudden.

This post has been edited by marc2003: Apr 25 2013, 20:00
Go to the top of the page
+Quote Post
r0k
post Apr 25 2013, 22:00
Post #2296





Group: Members
Posts: 74
Joined: 8-September 11
Member No.: 93574



OK. I re-extracted the zip and it's working again. For whatever reason this picture had gone missing. Don't know how it got removed ... huh.gif

This post has been edited by r0k: Apr 25 2013, 22:01
Go to the top of the page
+Quote Post
marc2003
post Apr 25 2013, 22:12
Post #2297





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



about your other points, i'll consider adding an option where you can specify SOX parameters yourself for image creation.
Go to the top of the page
+Quote Post
PeteG
post Apr 26 2013, 09:10
Post #2298





Group: Members
Posts: 56
Joined: 10-June 12
From: Denmark
Member No.: 100577



@marc2003 | Spectrogram Seekbar

Thank you very much for your latest brainchild smile.gif. The time tooltip is one of those details that comes in very handy.
A minor problem (for me, that is) has however popped up: Either ffmpeg or Sound eXchange are having problems with at least some 'foreign' characters resulting in nil output to screen and disk.
No blurps from the Console with fb.trace activated in the front end script:

CODE
Opening track for playback: "H:\Rhythmic\K\Aiko Kitahara\Piece Of Love\05 - サヨナラを告げた日が近すぎて.mp3"
cmd /c ""C:\Users\PG\AppData\Roaming\foobar2000\sox\ffmpeg.exe" -i "H:\Rhythmic\K\Aiko Kitahara\Piece Of Love\05 - サヨナラを告げた日が近すぎて.mp3" -f
sox - | "C:\Users\PG\AppData\Roaming\foobar2000\sox\sox.exe" -p -n channels 2 spectrogram -d 3:27 -Y 2000 -r -o
        "C:\Users\PG\AppData\Roaming\foobar2000\spectrogram_cache\HRhythmicKAiko KitaharaPiece Of Love05 - サヨナラを告げた日が近すぎて.mp3.png""

Opening track for playback: "H:\Rhythmic\M\Magma\Üdü Wüdü\01 - Üdü Ẁüdü.flac"
cmd /c ""C:\Users\PG\AppData\Roaming\foobar2000\sox\ffmpeg.exe" -i "H:\Rhythmic\M\Magma\Üdü Wüdü\01 - Üdü Ẁüdü.flac" -f
sox - | "C:\Users\PG\AppData\Roaming\foobar2000\sox\sox.exe" -p -n channels 2 spectrogram -d 4:17 -Y 2000 -r -o
        "C:\Users\PG\AppData\Roaming\foobar2000\spectrogram_cache\HRhythmicMMagmaÜdü Wüdü01 - Üdü Ẁüdü.flac.png""

Notice the 'Ẁ'.
I've changed channels to 2 and the Y parameter to 2000, but the innate values make of course no difference.
A shot in the dark: creating png file and writing to disk fails. Maybe another file naming schema would eliminate the problem? md5 or what do I know?

Btw, I'm trying to figure out how to change SoX' standard colours to something that's matching my layout. Not an easy task it seems.







Go to the top of the page
+Quote Post
marc2003
post Apr 26 2013, 11:04
Post #2299





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



^i now use the $crc32 title formatting function on the path. hopefully that will resolve it.

right click>Update script should work for current users.

samples updated: https://dl.dropboxusercontent.com/u/22801321/samples.zip

changelog: https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

QUOTE
7.2013.04.26.01

"Spectrogram seekbar". The naming scheme for images has
been changed so you should clear all old files using the
right click menu. You can now set SOX parameters via a
dialog. See sox.pdf for all options. These
parameters also form part of the cached image filename
so changing them will update the display immediately.



files changed:
CODE
marc2003\common7.js


This post has been edited by marc2003: Apr 26 2013, 11:37
Go to the top of the page
+Quote Post
marc2003
post Apr 26 2013, 11:32
Post #2300





Group: Members
Posts: 4866
Joined: 27-January 05
From: England
Member No.: 19379



i meant to edit my previous post and not post a new reply. delete me please. tongue.gif

This post has been edited by marc2003: Apr 26 2013, 11:34
Go to the top of the page
+Quote Post

142 Pages V  « < 90 91 92 93 94 > » 
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th December 2014 - 13:56