event in relation with tracks changes...

Help each other out

event in relation with tracks changes...

Postby alamata on Tue Mar 25, 2008 2:15 pm

hey,

here is the situation

i would like have an event (cat refresh) when the track change in winamp

is it possible to have an event in relation with tracks changes in winamp...

...
alamata
 
Posts: 70
Joined: Thu Jan 11, 2007 12:03 pm

Re: event in relation with tracks changes...

Postby Marbles_00 on Tue Mar 25, 2008 3:29 pm

Is the reason for this so your "playing" symbol follows the music if you have the playlist in shuffle mode? What you may want is to use the xMusic plugin with its smart shuffle feature. Just wondering why you'd want to refresh a category every music track.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: event in relation with tracks changes...

Postby alamata on Tue Mar 25, 2008 3:43 pm

hey Marbles_00,

i dont use an existing skin, i try to make one ... :roll: :arrow: :oops:

i have made a "nowplaying screen"
with information about "now" et "next" cover,artist ,album, trackname, year ,genre

and i have made a cat with custom search to have on this screen all the albums from the artist is nowplaying

but when i stay on this screen and that the track is changing

the cat with custom search for the all album from the artisit is nowplaying show
the albums for the track is playing when a go to this screen...

so i would like refresh at each track change for have the real all albums from the artist is now playing...
alamata
 
Posts: 70
Joined: Thu Jan 11, 2007 12:03 pm

Re: event in relation with tracks changes...

Postby dalanik on Tue Mar 25, 2008 7:30 pm

I'm afraid your only choice is the timer... I needed something similar a while back (while XLobby was still free) and it sadly never got implemented.

Use XScriptNG, and make a timer to execute every, let's say, 10 seconds. Then check via variables if the song/band changed and execute search. It shouldn't slow down your system, I use several timers in XLobby and notice no slowdown.

D.
dalanik
 
Posts: 885
Joined: Mon Apr 19, 2004 12:35 pm
Location: Prague, Czech Republic

Re: event in relation with tracks changes...

Postby alamata on Tue Mar 25, 2008 8:10 pm

thanks a lot, :D

for this precious information...

i'll tried....
alamata
 
Posts: 70
Joined: Thu Jan 11, 2007 12:03 pm

Re: event in relation with tracks changes...

Postby P3rv3rt B3ar on Tue Mar 25, 2008 8:13 pm

I have a mechanism in place on xpert to observe track change, remind me to add command trigger to it when i get back coding... that is unless ofcourse defrag beats me to it, he must have same capability within his xlive
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: event in relation with tracks changes...

Postby defrag on Tue Mar 25, 2008 10:42 pm

I use the humble timer, well sort of, it's a thread that sleeps for a second or two then wakes, checks the nowplaying variables that are available through if they have changed from last time then do something, otherwise nap time again.

Something like:

Code: Select all
while (true)
            {
                if (helper != null) // xlobby plugin helper
                {
                    string artist = helper.ConvertVariables(@"audioplayer>now>%artist%");
                    string track = helper.ConvertVariables(@"audioplayer>now>%trackname%");
                    string album = helper.ConvertVariables(@"audioplayer>now>%albumname%");
                    if (artist != string.Empty && track != string.Empty && album != string.Empty)
                    {
                        // do somthing
                    }
                    else
                    {
                        // don't do something
                    }
                }
                Thread.Sleep(5000); // thread is created on plugin constructor
            }


I'm sure you could knock something out easier than using a thread just using a timer with xscript - I just like threads :D
defrag
 
Posts: 376
Joined: Mon Jan 16, 2006 7:56 am
Location: Didcot, UK

Re: event in relation with tracks changes...

Postby alamata on Tue Mar 25, 2008 11:13 pm

thanks a lot for the code :arrow: :D

but i cant how put the action in the script ... :oops:
i suppose i must change the "do somehting" by something...

this thing is the event

custom search
artist
audioplayer>now>%artist%

but i cant "implement" this on the script

can you explain me the method to do that possible

thanks for your comprehension
alamata
 
Posts: 70
Joined: Thu Jan 11, 2007 12:03 pm

Re: event in relation with tracks changes...

Postby defrag on Tue Mar 25, 2008 11:21 pm

so let me get this straight... you want to do a category refresh when the track changes, yes?

If so, in your "do something" you would need to fire the category refresh command. Now, if you are using xscript then you would want something like:

Code: Select all
Xlobby.SendCommand("category", "refresh", "<the name of your cat>"); // err... not your cat so to speak but the category name  :shock:


There is a timer example in the XscriptNG plugin package I recall which you could use to achieve all this...
defrag
 
Posts: 376
Joined: Mon Jan 16, 2006 7:56 am
Location: Didcot, UK

Re: event in relation with tracks changes...

Postby P3rv3rt B3ar on Tue Mar 25, 2008 11:40 pm

def, i use same principle... i think u pasted wrong code snippet though... that 1 afaik does not compare to old values like u explain.and willend up been called constantly does h it not? anyway i was more thinking mayby u or i could wrap this in our plugins as general track change tricker using runevent rather than make alamate write his own. afterall this functionality is rather general
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: event in relation with tracks changes...

Postby defrag on Tue Mar 25, 2008 11:47 pm

well spotted b3ar - I grabbed that straight out of the messenger plugin source and all I do is hammer messenger every 5000 milliseconds :lol: I did the saving somewhere else, serves me right for typing and not thinking :wink:

Don't have a prob making it generic, apart from time...

BTW, did you, in your dark couldren of xlobby code, ever manage to track a when the selection changes in a category? That one I have not been able to nail...
defrag
 
Posts: 376
Joined: Mon Jan 16, 2006 7:56 am
Location: Didcot, UK

Re: event in relation with tracks changes...

Postby P3rv3rt B3ar on Wed Mar 26, 2008 12:04 am

defrag wrote:BTW, did you, in your dark couldren of xlobby code, ever manage to track a when the selection changes in a category? That one I have not been able to nail...



well i kinda do since i do lot of catwalking i need a way to determine if some other process changed item in middle of walk andtry to recover from that. in essence it checks few key cat attributes, but theres a more than meets the eye... threads and locks... its real monster... most complex part of xpert... cause it has to handle multi tiercats and yet perform reial fast... besides all that its not bombsure :(

edit but simply checking if item has changed is easy if u require key attributes like xpert does... if u r just interested whether there has been change sofar and the fact that item can change again before apropriate process cgets called is indifferent.
Last edited by P3rv3rt B3ar on Wed Mar 26, 2008 12:13 am, edited 1 time in total.
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: event in relation with tracks changes...

Postby defrag on Wed Mar 26, 2008 12:12 am

ok - I think we spoke about this before, didn't think it was simple. I had a nice reflection plugin going on, but it relied on when a selection changed or the cat paged (auto) - I might keep digging.

... and also whilst digging in the forum i noticed you added MSN support in xPert back in 2006 :shock: :shock: oh well...

alamata: sorry to drag your thread elsewhere.. are you happy to keep going? or do you want us to knock something up for you?
defrag
 
Posts: 376
Joined: Mon Jan 16, 2006 7:56 am
Location: Didcot, UK

Re: event in relation with tracks changes...

Postby P3rv3rt B3ar on Wed Mar 26, 2008 12:21 am

defrag wrote:ok - I think we spoke about this before, didn't think it was simple. I had a nice reflection plugin going on, but it relied on when a selection changed or the cat paged (auto) - I might keep diggingt


check my edit above... its easy if u only require kinda trigger on change... but items need to be unique u can either require it from user like i do... or autokey all cats
P3rv3rt B3ar
 
Posts: 1364
Joined: Fri Apr 07, 2006 9:52 pm
Location: West Coast Funland

Re: event in relation with tracks changes...

Postby alamata on Wed Mar 26, 2008 12:50 am

defrag wrote:alamata: sorry to drag your thread elsewhere.. are you happy to keep going? or do you want us to knock something up for you?


there is absolutly no problem... :wink: :D

but i try the script...
but i have 32 error :shock: ...

NB : my english is poor so sorry if i dont understand all...

but i think the problem is a bit "more complex" (for me :wink: )...

the good event to make appears the all album in "nearly in real time"
is not refresh cat but

it s a new "instance" of

custom search
artist
audioplayer>now>%artist%

and the category is never empty
but it is fulled with the custom search when i call the screen ( i have put the custom serach event in the go to screen event)

can you show me the approriate code
with custom search
and with the no empty cat...

that ll be christmas ... :D
alamata
 
Posts: 70
Joined: Thu Jan 11, 2007 12:03 pm

Next