Modification help/request

crimson

22-08-2006 10:36:15

Hi,

I'm trying out vibestreamer (it got a mention in a NZ magazine called NetGuide so I thought i'd take a look). I like what I see so far. I just have to try it over the net rather than locally. Oh, and as an Opera user you have my sincere thanks for designing with it in mind.

I'm going to work on a new CSS layout when I get the chance, but what I want to do first is edit the vibe files to do the following

when a new track is added
IF there is no song currently playing THEN enqueue the new song and play it
ELSE enqueue new song

However I have no idea where to start. Could someone please point me in the right direction?

Many Thanks.

Amish

22-08-2006 16:16:54

Do you have any previous programing experiance? And by programming I dont mean HTML or CSS (thats scripting ;) )

crimson

23-08-2006 03:44:32

Yes, I have programmed in Java, C++, C and Javascript (if it counts).

HTML and CSS aren't code/script in my opinion, they are markup.

crimson

27-08-2006 12:03:22

Am I on my own then?

Bulo

27-08-2006 16:03:31

All what you need is located in the 'player.vibe' file. This is a javascript story.

There is a global variable 'g_objPlayingTrack'. This variable contains the identifier of the current (or last) track opened by the player.
When you add a track in the playlist, the job is done by the function 'add_track'. To play a track, you have to call the function 'play_track'.

So to implement your request, you have to modify the 'add_track' function. You must check that 'g_objPlayingTack' is null. If it's the case, you can call 'play_track' ...
It must be something like that ... not tested of course. These are just ideas!

I hope this will help!

crimson

28-08-2006 11:37:35

Ah, I see. Thanks for your help, I have hit a small snag however.

[codedywenj9p] // START EDIT by crimson @ 28/08/2006
// This edit automatically plays a file when it is added to the list if there is no file currently playing.

if (g_objPlayingTrack == null) { // If the current track is null
objNextTrack = playlist_find_first_track();
if (objNextTrack != null) {
// play next track
play_track(objNextTrack);
}
}

// END EDIT[/codedywenj9p]
This code doesn't change the behaviour of the player, however if I comment out the first if

[codedywenj9p] // START EDIT by crimson @ 28/08/2006
// This edit automatically plays a file when it is added to the list if there is no file currently playing.

//if (g_objPlayingTrack == null) { // If the current track is null
objNextTrack = playlist_find_first_track();
if (objNextTrack != null) {
// play next track
play_track(objNextTrack);
}
//}

// END EDIT[/codedywenj9p]
It will re-play the first track when I add another, indicating to me that g_objPlayingTrack is not null.

This is reinforced by

[codedywenj9p] // START EDIT by crimson @ 28/08/2006
// This edit automatically plays a file when it is added to the list if there is no file currently playing.

//if (g_objPlayingTrack == null) { // If the current track is null
//objNextTrack = playlist_find_first_track();
objNextTrack = g_objPlayingTrack.nextSibling;
if (objNextTrack != null) {
// play next track
play_track(objNextTrack);
}
//}

// END EDIT
[/codedywenj9p]
Which will always immediately play the loaded track.

Apologies if I missed something basic, i'm a bit tired, but as far as I can see, g_objPlayingTrack isn't null when it should be.

Bulo

28-08-2006 18:03:18

g_objPlayingTrack is never reset. It's why I wrote that g_objPlayingTrack contains the identifier of the current ([b1ua2slhz]or last[/b1ua2slhz]) track opened D
So you certainly need to reset this variable in the 'on_trackend' function ...

crimson

29-08-2006 09:28:24

Got it.

I created a new variable to save hastle
inside add_track
[code3wax89c4]// START EDIT by crimson @ 28/08/2006
// This edit automatically plays a file when it is added to the list if there is no file currently playing.

if (crimson_autoPlayNextAdded == true) { // If the current track is null
objNextTrack = g_objPlayingTrack.nextSibling;
if (objNextTrack != null) {
// play next track
play_track(objNextTrack);
}
}

// END EDIT[/code3wax89c4]
in player_ontrackend
[code3wax89c4] // make sure we've found a track to play
if ( objNextTrack==null ) {
// START EDIT by crimson @ 29/08/2006
crimson_autoPlayNextAdded = true; // An identifier to signify that we play the next added track.
// END EDIT
return;
}[/code3wax89c4]

inside play_track
[code3wax89c4]
// make sure we've found a track to play
if ( objNextTrack==null ) {
// START EDIT by crimson @ 29/08/2006
crimson_autoPlayNextAdded = true; // An identifier to signify that we play the next added track.
// END EDIT
return;
}
[/code3wax89c4]

Thanks for your help, this makes the player much more usable in my opinion.

Midnightz

08-10-2007 16:15:07

Very glad to see someone made this - kudos crimson. )

I can't seem to get it to work properly though. ? It would be helpful if you (or anyone???) could post your [b1wfjp5xl]player.vibe[/b1wfjp5xl] file and a link to the mod in action. If not then please at least [i1wfjp5xl]specify where/how[/i1wfjp5xl] we should make these edits? ("inside add_track" is just not enough information for a newcomer like me)

Thanks in advance.

Midnightz

03-11-2007 16:35:12

? 1 month later now and no reply so... *BUMP*