IPB

Welcome Guest ( Log In | Register )

120 Pages V  « < 4 5 6 7 8 > »   
Reply to this topicStart new topic
WSH Panel Mod script discussion/help.
tedgo
post Jan 27 2010, 18:20
Post #126





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



I think i got it:
CODE
var ext_lyrics = window.GetProperty("Lyrics Path", "$directory_path(%path%)\\%artist% - %title%");

var arr = utils.Glob(fb.TitleFormat(ext_lyrics).Eval() + ".*").toArray();
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.lrc$/m)) d = utils.ReadTextFile(arr[i]);
    else if (arr[i].match(/\.txt$/m)) d = utils.ReadTextFile(arr[i]);
}

Seems to work at least...
It excludes all files beside lrc and txt.
But it prefers txt files over lrc, although i ask for lrc first.
Any idea how to solve this?
(Or did i made again an error?)

I want to prefer lrc because it is always a lyrics file, but txt may contain something else than lyrics...

This post has been edited by tedgo: Jan 27 2010, 18:21
Go to the top of the page
+Quote Post
marc2003
post Jan 27 2010, 18:31
Post #127





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



you'll want to break the loop when the first file is found. your problem is that the last file in the array is used.

as the filenames are the same, this should be safe to do because .lrc comes before .txt alphebetically.

This post has been edited by marc2003: Jan 27 2010, 18:32
Go to the top of the page
+Quote Post
tedgo
post Jan 27 2010, 18:34
Post #128





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



And how can i solve it? Any idea?
Go to the top of the page
+Quote Post
marc2003
post Jan 27 2010, 18:40
Post #129





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



just thinking about it, it's a bit presumptuous of me to assume the files will be in the array in alphabetical order. let's hope so. tongue.gif

to break out of a loop....

break;

(or increase i beyond the maximum boundary)

edit: just had another thought. i'd never really noticed that utils.ReadTextFile function before. wouldn't it be easier just to try and load the files with that? as you only have 2 possibilities, it saves messing about with all this array nonsense. tongue.gif

This post has been edited by marc2003: Jan 27 2010, 18:50
Go to the top of the page
+Quote Post
tedgo
post Jan 27 2010, 18:52
Post #130





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



I don't think that break would help here.
I guess the problem is utils.ReadTextFile(arr[i]).
It seems that this arr[i] will always match the last one in alphabetical order...
(Renamed lrc to xxx and tried it again. now it is loaded no matter if i ask for it first or last...)

EDIT (to your edit):
Is one other solution, yes.
But i wanted a more elegant way smile.gif
Should work, though (why i haven't had this idea by myself? Grrr... biggrin.gif)

This post has been edited by tedgo: Jan 27 2010, 18:58
Go to the top of the page
+Quote Post
marc2003
post Jan 27 2010, 18:58
Post #131





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



QUOTE (tedgo @ Jan 27 2010, 17:52) *
I don't think that break would help here.


2nd edit... blink.gif (sorry for the misinformation before)

CODE
loop:
for (var i = 0; i < arr.length; ++i) {
    if (arr[i].match(/\.lrc$/m)) {
        d = utils.ReadTextFile(arr[i]);
        break loop;
    } else if (arr[i].match(/\.txt$/m)) {
        d = utils.ReadTextFile(arr[i]);
        break loop;
    }
}


3rd edit: my original post using 2 arrays and concat would have preferred lrc files but you went with T.Ps code... tongue.gif

this is getting very messy. laugh.gif

This post has been edited by marc2003: Jan 27 2010, 19:06
Go to the top of the page
+Quote Post
tedgo
post Jan 27 2010, 19:10
Post #132





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



QUOTE (marc2003 @ Jan 27 2010, 18:58) *
3rd edit: my original post using 2 arrays and concat would have preferred lrc files but you went with T.Ps code... tongue.gif

biggrin.gif
Looked more logical.
I'll see what i do now...

EDIT:
You break loop doesn't change anything.
utils.ReadTextFile(arr[i]) still prefers the last file in an alphabetical row.
How the hell could i make this [i] to LRC?
Or i advice all the possible users of my script to delete all their lrc's, would be the easiest to code laugh.gif

This post has been edited by tedgo: Jan 27 2010, 19:13
Go to the top of the page
+Quote Post
marc2003
post Jan 27 2010, 19:25
Post #133





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



QUOTE (tedgo @ Jan 27 2010, 18:10) *
You break loop doesn't change anything.


works for me. try fb.trace to see if they are in order like mine....

CODE
arr = new Array("a.lrc", "a.txt");
fb.trace(arr[0]);
fb.trace(arr[1]);
loop:
for(var i = 0; i < arr.length; i++) {
    if (arr[i].match(/\.lrc$/m)) {
        d = arr[i];
        break loop;
    } else if (arr[i].match(/\.txt$/m)) {
        d = arr[i];
        break loop;
    }
}
fb.trace(d);

//console output
a.lrc
a.txt
a.lrc

//confirmed by removing break statement
a.lrc
a.txt
a.txt


This post has been edited by marc2003: Jan 27 2010, 19:28
Go to the top of the page
+Quote Post
tedgo
post Jan 27 2010, 19:41
Post #134





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



Guess what?
It is working now. Thanks smile.gif
Maybe i made a typo before, but now it works.

Now i can finish my lyrics panel smile.gif
Go to the top of the page
+Quote Post
jmccrohan
post Jan 27 2010, 23:24
Post #135





Group: Members
Posts: 20
Joined: 11-August 07
Member No.: 46121



I have taken marc2003's lastfm biography code and modified it to display lyrics stored within ID3 tags.
I liked the style of the lastfm code, so I created this to work around that.

link
Go to the top of the page
+Quote Post
tedgo
post Jan 27 2010, 23:49
Post #136





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



Very short code smile.gif
But why do you create a context menu with the default context menu entries only?
You could delete the whole on_mouse_rbtn_up() section.

Here is my current preliminary lyrics panel script:
http://pastebin.de/3533

Maybe someone finds it useful smile.gif
If anybody has ideas to improve it, please let me know.
Go to the top of the page
+Quote Post
icedtea
post Jan 28 2010, 15:02
Post #137





Group: Members
Posts: 87
Joined: 26-January 10
Member No.: 77538



Guys any idea why
WshShell.run("http://www.last.fm/music/" + encodeURIComponent(artist).replace(/\s+/,"+"));
doesn't replace the space in the artist name with a + ?
Go to the top of the page
+Quote Post
marc2003
post Jan 28 2010, 16:45
Post #138





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



try

CODE
"http://www.last.fm/music/" + artist.replace(/\s+/g,"+")


i only use encodeURIComponent for accessing the webservices.

This post has been edited by marc2003: Jan 28 2010, 16:49
Go to the top of the page
+Quote Post
marc2003
post Jan 28 2010, 17:07
Post #139





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



just another update to my samples....

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

as my old pack contained 3 separate artwork panels, i've taken a big hammer and merged them all into one. it has 3 modes.

-default foobar artreader
-lastfm artist art with built in download facility (uses this command line tool made by paradog (runs silently - you won't notice it at all). you don't need to download it - i've included it. it's just 8kb in size. and the effort it's saved me is untrue. biggrin.gif)
-cycle folder. you just set some title formatting and it will automatically cycle all the images. options are off, 5, 10 and 20 seconds.

(the last.fm mode supports this cycling as well.)

everything is controlled via context menu except the path for the "cycle folder". you need to edit the script itself to set that.



i've also added NEMO7538's rating script but added support to follow the DUI/CUI background colours. this has no settings or dependencies. it's to be used in conjunction with the official playback statistics component.

this post contains details on the other samples and how to use.

EDIT: there have been no changes to "lastfm.js" so if you already have a pre-configured file from earlier versions or use my playback statistics script, there is no need to overwrite your file with the one in this package. i really should put some proper documentation in the archive. rolleyes.gif

This post has been edited by marc2003: Jan 28 2010, 17:27
Go to the top of the page
+Quote Post
icedtea
post Jan 28 2010, 18:46
Post #140





Group: Members
Posts: 87
Joined: 26-January 10
Member No.: 77538



marc can you please take a shot at this?
QUOTE
Can some kind soul convert the playback section of this theme (buttons, progress, volume etc) to a script for someone like me who doesn't know even a little but of jscript
Thanks
http://fanco86.deviantart.com/art/MonoLite-122756120
Go to the top of the page
+Quote Post
marc2003
post Jan 28 2010, 19:15
Post #141





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



the playback controls and background are panel stack splitter. the volume control, seekbar and playback order button are 3 separate WSH scripts. you can right click those, select configure to open the editor and then export the contents to a text file. or you can use the columns UI layout page to copy panels between layouts. i

This post has been edited by marc2003: Jan 28 2010, 19:20
Go to the top of the page
+Quote Post
marc2003
post Jan 30 2010, 10:39
Post #142





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



edit: question removed. totally unrelated to the scripting. rolleyes.gif

This post has been edited by marc2003: Jan 30 2010, 11:18
Go to the top of the page
+Quote Post
geoslay
post Jan 30 2010, 12:08
Post #143





Group: Members
Posts: 10
Joined: 11-October 08
From: Greece,Larisa
Member No.: 59914



Hi i want to make a seek bar with WSH panel mod but i dont know nothing about script's.Any help? Here is a pic of my Foobar
Thanks in advance.



By wizard20 at 2010-01-30


This post has been edited by geoslay: Jan 30 2010, 12:09
Go to the top of the page
+Quote Post
jeremija
post Jan 30 2010, 12:22
Post #144





Group: Members
Posts: 328
Joined: 27-September 08
From: Zagreb
Member No.: 58696



here is what i use:

SEEKBAR

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

var g_font = gdi.Font("Segoe UI", 12, 0);
var g_drag = 0;

function on_paint(gr){
    gr.SetTextRenderingHint(5);
    var ww = window.Width;
    var wh = window.Height;
    var pos = 0;
    var length = fb.PlaybackLength;
    

    
    if (length>0){
        if(g_drag){
            pos = ww * g_drag_seek;
        } else {
            pos = ww * (fb.PlaybackTime / length);
        }
    }

       var txt = "Seekbar";
       gr.DrawRect(0,0,ww-1,wh-1,1.0,RGB(0,0,0));
       gr.FillSolidRect(1,1,ww-2,wh-2,RGB(28,28,28));
      
    var dio1 = 0.375*(wh-2);
       var dio2 = 0.625*(wh-2);

       gr.FillSolidRect(1,1,pos-1,dio1,RGB(119,187,255));
       gr.FillSolidRect(1,1+dio1,pos-1,dio2,RGB(51,153,255));

}
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;
    g_drag_seek = x / window.Width;
    g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
    fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
    window.Repaint();
}
function on_mouse_move(x,y){
    if(g_drag){
        g_drag_seek = x / window.Width;
        g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
        window.Repaint();
    }
}

function on_playback_new_track(info){
    window.Repaint();
}

function on_playback_stop(){
    window.Repaint();
}

function on_playback_seek(time){
    window.Repaint();
}

function on_playback_time(time){
    window.Repaint();
}
//EOF
Go to the top of the page
+Quote Post
geoslay
post Jan 30 2010, 12:40
Post #145





Group: Members
Posts: 10
Joined: 11-October 08
From: Greece,Larisa
Member No.: 59914



Thank you,is very good.anything for playbak order? I ask too much... sad.gif
Go to the top of the page
+Quote Post
icedtea
post Jan 30 2010, 16:46
Post #146





Group: Members
Posts: 87
Joined: 26-January 10
Member No.: 77538



QUOTE (marc2003 @ Jan 28 2010, 19:15) *
the playback controls and background are panel stack splitter. the volume control, seekbar and playback order button are 3 separate WSH scripts. you can right click those, select configure to open the editor and then export the contents to a text file. or you can use the columns UI layout page to copy panels between layouts. i


I tried that but it is not possible to remove borders for wsh panel, I thought there would be a way to draw the whole thing using one wsh panel
Go to the top of the page
+Quote Post
icedtea
post Jan 30 2010, 18:49
Post #147





Group: Members
Posts: 87
Joined: 26-January 10
Member No.: 77538



marc can you please provide a snippet to convert the play button into a play/pause button. I have no idea how to switch images and I am using the layout
< || >
Thanks

This post has been edited by icedtea: Jan 30 2010, 18:49
Go to the top of the page
+Quote Post
marc2003
post Jan 30 2010, 21:21
Post #148





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



QUOTE (icedtea @ Jan 30 2010, 15:46) *
I thought there would be a way to draw the whole thing using one wsh panel


that's way beyond my capabilities. dry.gif

as for the buttons, i already told you, they're done in panel stack splitter for that config. there isn't much need to make buttons in WSH panel mod when you're using columns UI/PSS because you already have much easier ways (using standard columns UI toolbar or $imagebutton in PSS).

This post has been edited by marc2003: Jan 30 2010, 21:22
Go to the top of the page
+Quote Post
TomBarlow
post Jan 30 2010, 21:48
Post #149





Group: Members
Posts: 585
Joined: 30-July 07
Member No.: 45750



Here is something that might come in handy, but I don't know exactly what your script looks like Icedtea so it probably won't work without some tweaking.

CODE
function on_playback_stop()
{
    buttons.pop.icon=gdi.Image(dir+"play"+".png");
    buttons.pop.tooltiptxt="Play";
    window.Repaint();
}
function on_playback_pause(is_paused)
{
    buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
    buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
    window.Repaint();
}
function on_playback_starting(cmd, is_paused)
{
    buttons.pop.icon=is_paused?gdi.Image(dir+"play"+".png"):gdi.Image(dir+"pause"+".png");
    buttons.pop.tooltiptxt=is_paused?"Play":"Pause";
    window.Repaint();
}
Go to the top of the page
+Quote Post
icedtea
post Jan 31 2010, 04:36
Post #150





Group: Members
Posts: 87
Joined: 26-January 10
Member No.: 77538



QUOTE (marc2003 @ Jan 30 2010, 21:21) *
QUOTE (icedtea @ Jan 30 2010, 15:46) *
I thought there would be a way to draw the whole thing using one wsh panel


that's way beyond my capabilities. dry.gif

as for the buttons, i already told you, they're done in panel stack splitter for that config. there isn't much need to make buttons in WSH panel mod when you're using columns UI/PSS because you already have much easier ways (using standard columns UI toolbar or $imagebutton in PSS).


sorry for the confusing message
What I meant was in the button example in your samples is there a way to convert the play button to a Play/Pause button. The function replacement fb.PlayOrPause() works ok but I have no idea on how to switch the images between play and pause i.e. when the playback is paused the button should be play.png and when the song is playing the button should be pause.png, with the hover effects of course.
Thanks
Go to the top of the page
+Quote Post

120 Pages V  « < 4 5 6 7 8 > » 
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: 20th April 2014 - 06:54