going back and forth


#1

Hi,
i’m using a grouplist to navigate a drive where some music files are stored.
I generate an xml with a php script with all the info i need:

<?xml version="1.0" encoding="UTF-8"?>
<data>
    <item id_group="0">
        <name>Album - Daft Punk</name>
        <fullname></fullname>
        <item id="0">
            <name>01. Give Life Back to Music.mp3</name>
            <fullname>..\Audio\\Album - Daft Punk\\01. Give Life Back to Music.mp3</fullname>
            <extension>mp3</extension>
        </item>
        <item id="1">
            <name>02. The Game of Love.mp3</name>
            <fullname>..\Audio\\Album - Daft Punk\\02. The Game of Love.mp3</fullname>
            <extension>mp3</extension>
        </item>
   ...
        <item id="15">
            <name>E.Cassidy-I wish I was a single girl again.wav</name>
            <fullname>..\Audio\\Album - Daft Punk\\E.Cassidy-I wish I was a single girl again.wav</fullname>
            <extension>wav</extension>
        </item>
    </item>
    <item id_group="1">
        <name>dEUS - The Ideal Crash (1998)</name>
        <fullname></fullname>
        <item id="17">
            <name>dEUS - The Ideal Crash - 01 - Put The Freaks Up Front .mp3</name>
            <fullname>..\Audio\\dEUS - The Ideal Crash (1998)\\dEUS - The Ideal Crash - 01 - Put The Freaks Up Front .mp3</fullname>
            <extension>mp3</extension>
        </item>
        <item id="26">
            <name>dEUS - The Ideal Crash - 10 - Dream Sequence 1 .mp3</name>
            <fullname>..\Audio\\dEUS - The Ideal Crash (1998)\\dEUS - The Ideal Crash - 10 - Dream Sequence 1 .mp3</fullname>
            <extension>mp3</extension>
        </item>
    </item>
    <item id_group="2">
        <name>The Frames</name>
        <fullname></fullname>
        <item id="27">
            <name>04 - Evergreen.mp3</name>
            <fullname>..\Audio\\The Frames\\04 - Evergreen.mp3</fullname>
            <extension>mp3</extension>
        </item>
        <item id="28">
            <name>04 - Evergreen_1.mp3</name>
            <fullname>..\Audio\\The Frames\\04 - Evergreen_1.mp3</fullname>
            <extension>mp3</extension>
        </item>
        <item id="32">
            <name>10 - Denounced.mp3</name>
            <fullname>..\Audio\\The Frames\\10 - Denounced.mp3</fullname>
            <extension>mp3</extension>
        </item>
    </item>
    <item id="33">
        <name>avevate ragione voi.mp3</name>
        <fullname>..\Audio\\avevate ragione voi.mp3</fullname>
        <extension>mp3</extension>
    </item>
    <item id="34">
        <name>Cher Backer - Autumn Leaves.mp3</name>
        <fullname>..\Audio\\Cher Backer - Autumn Leaves.mp3</fullname>
        <extension>mp3</extension>
    </item>
    <item id="35">
        <name>Cher Backer - Autumn Leaves.wav</name>
        <fullname>..\Audio\\Cher Backer - Autumn Leaves.wav</fullname>
        <extension>wav</extension>
    </item>
    <item id="52">
        <name>willy_moon-i_wanna_be_your_man.mp3</name>
        <fullname>..\Audio\\willy_moon-i_wanna_be_your_man.mp3</fullname>
        <extension>mp3</extension>
    </item>
</data>

The tree is perfectly shown: directories,sub directories and files. Folders are shown first.
I’m now tryng to play all the files in sequence, one after the other.

Problems start when, from within a folder I have to go one level up (->root) and then one level down (->next directory) and start playing the first track of the next directory…
I’m trying to use this code:

    function play_next()
    {
	current_music_id = music_id;
        next_music_id = (parseInt(music_id)+1).toString();
                    
        if($$(\"music\").item(next_music_id)!=undefined)
        {
        	next_music_level = $$(\"music\").item(next_music_id).\$level;

		if(next_music_level==current_music_level)
		{
			current_folder = $$(\"music\").item(current_music_id).fullname.substr(0,$$(\"music\").item(current_music_id).fullname.length-$$(\"music\").item(current_music_id).name.length);
				next_folder = $$(\"music\").item(next_music_id).fullname.substr(0,$$(\"music\").item(next_music_id).fullname.length-$$(\"music\").item(next_music_id).name.length);
				if(next_folder!=current_folder)
				{
					$$('music').on_click.dhx_list_item.call($$('music'),{},$$(\"music\").item(current_music_id).\$parent);
					$$('music').on_click.dhx_list_item.call($$('music'),{},$$(\"music\").item(next_music_id).\$parent);
				}
			}
			else
			{
				if(next_music_level<current_music_level)
					$$('music').on_click.dhx_list_item.call($$('music'),{},$$(\"music\").item(current_music_id).\$parent);
				if(next_music_level>current_music_level)
					$$('music').on_click.dhx_list_item.call($$('music'),{},$$(\"music\").item(next_music_id).\$parent);
			}

            $$('music').on_click.dhx_list_item.call($$('music'),{}, next_music_id);

            // and then i call the "play" method on my player
    	} 
    }

The result is that the next track correctly starts playing BUT no visual feedback is provided to the user…I’m only able to go up from the current folder to the root but could not manage to go down and select the current track…

Any help???


#2

Hi,

Could you attach a demo and explanation how to reproduce the issue in it ? (the demo should not contain server-side scripts).


#3

Dear Alexandra,
the situation is depicted in the image below:

The Folder structure I have is shown in “1”.
What I’m trying to do is:
I’m in the first folder (see 2 in picture above) and listen to the last song in the folder. What I expect next is that once the last song is over, the first track of the next folder starts playing: 3 in picture above.
I’ve successfully managed to obtain this behaviour, that is the first track of the next folder starts playng, BUT I cannot show the user the new track playing (the current track should be highlighted), What I show to the user is “1” again…while I’d like to show him “3”.

Hope to have been clearer this time


#4

Hello,

Unfortunately, the pictures did not make the issue clearer. However, you mentioned that you want to show an item. There is showItem(id) in grouplist. This method opens a folder with an item and scrolls to item position.

$$(“yourList”).showItem(id);


#5

I tried this method last week with no success… :confused: I’ve just tried it again and it works like a charm!!!

Thank you! :mrgreen:


#6

You are welcome!


#7

Can you tell us what kind of issue youn are facing my attaching any file so that particular solution can be given to you.