IPB

Welcome Guest ( Log In | Register )

121 Pages V  < 1 2 3 4 > »   
Reply to this topicStart new topic
WSH Panel Mod script discussion/help.
Hitchhiker427
post Jan 16 2010, 14:33
Post #26





Group: Members
Posts: 232
Joined: 11-December 09
Member No.: 75848



QUOTE (carmenm @ Jan 16 2010, 07:24) *
Great job marc2003.
Just one thing. You know that biography view can get those info for you and cache them. As it works as a background process i suppose it also works with DUI.
i am using biograview tags to do what you do.


Yes, it can. But it causes some minor pauses (for me at least) when switching tracks even when only running as a background process. Not relying on the biography plugin seems to solve that problem.
Go to the top of the page
+Quote Post
carmenm
post Jan 16 2010, 14:35
Post #27





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (Hitchhiker427 @ Jan 16 2010, 15:33) *
QUOTE (carmenm @ Jan 16 2010, 07:24) *
Great job marc2003.
Just one thing. You know that biography view can get those info for you and cache them. As it works as a background process i suppose it also works with DUI.
i am using biograview tags to do what you do.


Yes, it can. But it causes some minor pauses (for me at least) when switching tracks even when only running as a background process. Not relying on the biography plugin seems to solve that problem.

Oh i didnt know that. Sorry wink.gif
Go to the top of the page
+Quote Post
Hitchhiker427
post Jan 16 2010, 14:40
Post #28





Group: Members
Posts: 232
Joined: 11-December 09
Member No.: 75848



It might not be the case for CUI, but I can notice it on DUI. If you use a crossfader (I do) or gapless playback, there's a small (yet noticeable) blip between tracks. Additionally, this "blip" also freezes the UI display, so it effectively breaks the fading effect in your new album art script.
Go to the top of the page
+Quote Post
marc2003
post Jan 16 2010, 16:02
Post #29





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



QUOTE (carmenm @ Jan 16 2010, 13:24) *
You know that biography view can get those info for you and cache them.


i didn't. but at least mine gives people a blank canvas to work with. it could easily be expanded to use the foobar artreader for images, adding backgrounds, styling, buttons, etc.
Go to the top of the page
+Quote Post
carmenm
post Jan 16 2010, 16:33
Post #30





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (marc2003 @ Jan 16 2010, 17:02) *
QUOTE (carmenm @ Jan 16 2010, 13:24) *
You know that biography view can get those info for you and cache them.


i didn't. but at least mine gives people a blank canvas to work with. it could easily be expanded to use the foobar artreader for images, adding backgrounds, styling, buttons, etc.

Yes you are right. Great job
Go to the top of the page
+Quote Post
marc2003
post Jan 16 2010, 16:51
Post #31





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



an update on my bio panel. just a little bug fix.

Moderation: (Link removed by request.)

This post has been edited by Yirkha: Jan 22 2010, 00:01
Go to the top of the page
+Quote Post
Fractal_Mortalit...
post Jan 16 2010, 18:19
Post #32





Group: Members
Posts: 374
Joined: 20-June 05
Member No.: 22863



carmenm, be sure to post your similar artists script when you get to a point where you think it's stable, that looks amazing!


--------------------
http://www.last.fm/user/magnumforce2006
Go to the top of the page
+Quote Post
carmenm
post Jan 16 2010, 18:26
Post #33





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (Fractal_Mortality @ Jan 16 2010, 19:19) *
carmenm, be sure to post your similar artists script when you get to a point where you think it's stable, that looks amazing!

Thanks i will. But seeing problems people have with Biography view, i am writing a background script to do its caching job. All my other lastfm scripts will depend on it. Will post as soon as it is stable.
Go to the top of the page
+Quote Post
TomBarlow
post Jan 16 2010, 18:39
Post #34





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



I have a script to share, it's an album art/lyrics view. Also, I made a quick script to get the colours and font, name it getColoursFonts.js in your scripts directory: http://pastebin.com/f194f3496

Now here is my art viewer. It has the following features: double click to swap between prefer now playing and prefer focused track, middle click to swap between prefer art and prefer lyrics, and mouse scroll to change art type or to scroll lyrics. http://pastebin.com/f3d25a237

I haven't got a fade transition on the art, and I'm not sure the lyrics scroll quite right. It also doesn't handle synced lyrics, but it probably could be modified to.
Go to the top of the page
+Quote Post
marc2003
post Jan 16 2010, 19:17
Post #35





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



thanks for those tom. can't believe i didn't think of using the mouse wheel to scroll my biography panel. rolleyes.gif

updated version with scrolling support.

Moderation: (Link removed by request.)

@tom, your script needs a little fixing. starting foobar with an empty playlist causes your panel to crash.

This post has been edited by Yirkha: Jan 22 2010, 00:01
Go to the top of the page
+Quote Post
Fractal_Mortalit...
post Jan 16 2010, 20:20
Post #36





Group: Members
Posts: 374
Joined: 20-June 05
Member No.: 22863



Hey Marc, I don't want to discourage your efforts, but take a look at the biography view thread: http://www.hydrogenaudio.org/forums/index....5&start=225


--------------------
http://www.last.fm/user/magnumforce2006
Go to the top of the page
+Quote Post
marc2003
post Jan 16 2010, 20:40
Post #37





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



oh well.... tongue.gif

i hope ssenna ports over his other components to DUI. library tree and ELPlaylist would be amazing
Go to the top of the page
+Quote Post
carmenm
post Jan 16 2010, 20:42
Post #38





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



Wow that s a great news.

I wanted to show what i managed to build with WSH panel Mod. Every panel is made with WSH.
I have no Biography View. There is a background wsh that download everything necessary from Lastfm. All the others are just triggered for new data.
I could use biography view to do so, but syncing with my panel would be hard and would still have to communicate with lastfm for love, etc ... And i prefer to limit the number of connections.
Moreover the back script does not only download data for the playing track, it also download small artist images for similar.
All images are cached.

For the similar artists, those are buttons that link to the lastfm page

I will released as soon as possible. I still need to debug and use an ini file for all panels.

Hope you like it

Go to the top of the page
+Quote Post
marc2003
post Jan 16 2010, 21:00
Post #39





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



my menu is better than yours.... tongue.gif



T.P has provided code for this in the samples. smile.gif

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





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



QUOTE (marc2003 @ Jan 16 2010, 18:17) *
@tom, your script needs a little fixing. starting foobar with an empty playlist causes your panel to crash.

Thanks, I think I fixed it: http://pastebin.com/f1e4b9ee6
Go to the top of the page
+Quote Post
Andre69
post Jan 18 2010, 18:12
Post #41





Group: Members
Posts: 9
Joined: 18-January 10
From: Berlin
Member No.: 77277



QUOTE (marc2003 @ Jan 15 2010, 17:01) *
here's another script. this is for DUI only. it allows you to create your own buttons of any size, using any images you like. by default it uses the DUI background colour (it changes colour as you change theme).

..ZIP..
I want to make a buttonpanel. I use your scripts.
I setup a run service to aktivate Album Art Downloader with the Artist and Title of the selected song.
If I press the button nothing happends. Only if I play the song the button will work.

Can I change this ?
Go to the top of the page
+Quote Post
marc2003
post Jan 18 2010, 18:28
Post #42





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



you can add add this to your script.....

CODE
var g_metadb = fb.GetFocusItem();

function on_item_focus_change() {
if (g_metadb) window.UnwatchMetadb();
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
on_metadb_changed();
window.WatchMetadb(g_metadb);
}
}

function on_playlist_switch() {
on_item_focus_change();
}

function on_metadb_changed() {
if(!g_metadb) return;
//you need to move your buttons declaration into here
Buttons = {
but1: new Button(0,0,bw,bh, {normal: images + "stop.png", hover: images + "stop_h.png"}, function(){fb.Stop();}, "Stop"),
but2: new Button(bw,0,bw,bh, {normal: images + "pause.png", hover: images + "pause_h.png"}, function(){fb.Pause();}, "Pause"),
but3: new Button(bw*2,0,bw,bh, {normal: images + "play.png", hover: images + "play_h.png"}, function(){fb.Play();}, "Play"),
but4: new Button(bw*3,0,bw,bh, {normal: images + "previous.png", hover: images + "previous_h.png"}, function(){fb.Prev();}, "Previous"),
but5: new Button(bw*4,0,bw,bh, {normal: images + "next.png", hover: images + "next_h.png"}, function(){fb.Next();}, "Next")
};
}

function on_playback_new_track() {
on_item_focus_change();
}

on_item_focus_change();


you need to use this as your function

CODE
fb.RunContextCommandWithMetadb("context menu command goes here", g_metadb);


also, be aware that WSH panel mod can only run commands on the selected/playing item only and not a selection.

This post has been edited by marc2003: Jan 18 2010, 19:03
Go to the top of the page
+Quote Post
T.P Wang
post Jan 20 2010, 08:28
Post #43





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



This is a simple demo that using GdiDrawText() with scroll (mouse):

EDIT: Improved
EDIT2: Improved again, now both mouse whell and mouse drag work.

http://pastebin.ca/1758754

CODE

var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

String.prototype.repeat = function( num ) {
return new Array( num + 1 ).join( this );
}

var g_font = gdi.Font("Tahoma", 12);
var g_text = ("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n" +
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n" +
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n" +
"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\n").repeat(5);

var ww = 0, wh = 0;
var g_textcolor = 0xff000000;
var g_backcolor = 0xffffffff;
var g_need_calc = true;
var g_textheight = 0;
var g_offset = 0;
var g_drag = false;
var g_drag_y = 0;

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

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, g_backcolor);

if (g_need_calc) {
calc();
} else {
gr.GdiDrawText(g_text, g_font, g_textcolor, 0, g_offset, ww, wh - g_offset, DT_CENTER | DT_WORDBREAK | DT_NOPREFIX);
}
}

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

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

function on_mouse_move(x, y) {
if (g_drag) {
applyDelta(y - g_drag_y);
g_drag_y = y;
}
}

function on_mouse_wheel(step) {
applyDelta(step * 20);
}

function calc() {
// Using a temp IGdiGraphics interface
var temp_bmp = gdi.CreateImage(1, 1);
var temp_gr = temp_bmp.GetGraphics();

// Calculate
arr = temp_gr.GdiDrawText(g_text, g_font, g_textcolor, 0, 0, ww, wh, DT_VCENTER | DT_CENTER | DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX).toArray();
g_textheight = arr[3] - arr[1];
g_offset = wh / 2;
g_need_calc = false;

// Free the resources
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
window.Repaint();
}

function applyDelta(delta) {
var temp = g_offset + delta;

if ((temp <= wh / 2) && (temp >= wh / 2 - g_textheight)) {
g_offset = temp;
window.Repaint();
}
}

function reset() {
g_need_calc = true;
g_offset = 0;
}



This post has been edited by T.P Wang: Jan 20 2010, 12:10
Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 09:39
Post #44





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



It s faster than with the other method. I like it a lot.
Using it right now.
Go to the top of the page
+Quote Post
saivert
post Jan 20 2010, 23:50
Post #45





Group: Members
Posts: 167
Joined: 13-June 06
Member No.: 31801



MediaInfo panel

Grab script: http://pastie.org/787344

Screenshot:


Requires:
MediaInfo CLI version

Notes:
Using the WshShell.Exec to grab output from a console application via STDOUT will throw up a console window for a fraction of a second. This is ugly so we have get the output from MediaInfo in a different manner. Instead I use WshShell.Run to run my app via CMD so I can redirect output to a text file and then read this text file back to a variable. This is a roundabout way because WshShell.Exec is badly implemented (should have hidden the console window).

CODE
function get_mediainfo() {
    if (!g_metadb) return;
    
    var tmp = fb.ProfilePath+"tmp.txt";
    //if (fso.FileExists(tmp)) fso.DeleteFile(tmp); // permission denied?
    var e = "cmd /C \"\"" + mediainfo_path + "\" \"" + g_metadb.Path + "\">\""+tmp+"\"\""; // Mind the quotes!
    //fb.trace(e);
    
    wsh.Run(e, 0, true); // Run hidden and wait for it

    var text = fso.OpenTextFile(tmp, 1, false);
    g_text = text.ReadAll();

}


This post has been edited by saivert: Jan 20 2010, 23:57


--------------------
http://foobar2000.saivert.com - foobar2000 component repository
Go to the top of the page
+Quote Post
tedgo
post Jan 21 2010, 21:47
Post #46





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



I create a simple lyrics panel and have one question about how to remove the timestamps.

For now i use:
replace(/\[\d+:\d+.\d+\]/g,"")

This removes the timestamps, but not the info parts at the beginning of such timestamped lyrics files.
Has anybody an idea how i can remove all "squared brackets" parts?
So [ar:Peter Gabriel] and [01:56.32] for instance will be removed completely?
Is there any "wildcard" in jscript so i could use something like: replace(/\[*\]/g,"")
Thanks.
Go to the top of the page
+Quote Post
fbuser
post Jan 21 2010, 22:04
Post #47





Group: Developer
Posts: 673
Joined: 26-September 07
Member No.: 47369



Try replace(/\[.*\]/g,"")
Go to the top of the page
+Quote Post
marc2003
post Jan 21 2010, 22:05
Post #48





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



CODE
replace(/\[.+\]/g,"")


maybe?
Go to the top of the page
+Quote Post
tedgo
post Jan 21 2010, 22:09
Post #49





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



Thanks smile.gif
I knew it must be something easy...

Seems to work both.
Where are the differences?

EDIT: Nevermind, i found it. Thanks again smile.gif

This post has been edited by tedgo: Jan 21 2010, 22:13
Go to the top of the page
+Quote Post
TomBarlow
post Jan 21 2010, 22:10
Post #50





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



Hi guys, I am currently trying to make some buttons that act more like the main menu, that is, you click once to open the menu and click again to close it. The problem is my buttons at the moment only open the menu. I can't figure out how to stop it from opening in a way that doesn't break it. Here is a simplified script , the red rectangle is the button to open the menu:

CODE
var colour = 0xffff0000;
var menu_on = false;

function menu()
{
var basemenu = window.CreatePopupMenu();
basemenu.AppendMenuItem(0x00000000, 1, "Hi");

menu_on = true;
ret = basemenu.TrackPopupMenu(20, 60);
menu_on = false;

if(ret) fb.trace("Hello there");

basemenu.Dispose();
}

function on_paint(gr)
{
gr.FillSolidRect(0,0,window.Width,window.Height,0xffffffff);
gr.FillSolidRect(20,20,40,40,colour);
}

function on_mouse_lbtn_down(x,y)
{
if(x>=20 && x<=60 && y>=20 && y<=60)
colour = 0xff0000ff;

window.Repaint();
}

function on_mouse_move(x, y)
{
if(x>=20 && x<=60 && y>=20 && y<=60)
colour = 0xff00ff00;
else
colour = 0xffff0000;

window.Repaint();
}

function on_mouse_lbtn_up(x, y)
{
if(x>=20 && x<=60 && y>=20 && y<=60)
{
menu();
colour = 0xff00ff00;
}
window.Repaint();
}

function on_mouse_leave()
{
if(!menu_on)
colour = 0xffff0000;
window.Repaint();
}

If anyone could suggest anything I'd really appreciate it smile.gif
Go to the top of the page
+Quote Post

121 Pages V  < 1 2 3 4 > » 
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: 24th April 2014 - 03:21