FS#7077 - List title in filetree sometimes wrong.

Attached to Project: Rockbox
Opened by PaulJam (PaulJam) - Tuesday, 24 April 2007, 19:14 GMT
Last edited by Jonathan Gordon (jdgordon) - Wednesday, 02 July 2008, 13:03 GMT
Task Type Bugs
Category User Interface
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


When using the random folder advance feature and follow playlist enabled, sometimes when skipping to the next (random) directory an unexpected behaviour happens when entering the filebrowser (by pressing navi):
When entering the filetree and then press left to go up one level, the browser shows the correct directory, but the title says "Files" (like in the root directory) instead of the name of the directory. When you press left again, the browser stays in the same directory and the title now shows the correct name of the directory. Pressing then left again goes up one level (like expected).
I wasn't able to reproduce this bug reliably, so maybe you have to try several times to reproduce this behaviour.

The bug also happens with list titles disabled (you don't see the wrong title, but you still have to press left twice to get one level up).
Tested with H300, Version: r13254-070424.
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Wednesday, 02 July 2008, 13:03 GMT
Reason for closing:  Fixed
Comment by Will Robertson (aliask) - Tuesday, 15 May 2007, 05:33 GMT
I believe that my patch over at  FS#7170  should fix this as well.
Comment by PaulJam (PaulJam) - Tuesday, 15 May 2007, 11:15 GMT
Unfortunately i can still reproduce this behavior with revision 13390-070515 which includes the patch from  FS#7170 .
Comment by Will Robertson (aliask) - Tuesday, 15 May 2007, 13:15 GMT
Is there any trick to reproducing this, I can't manage to do it
Comment by PaulJam (PaulJam) - Tuesday, 15 May 2007, 13:44 GMT
I reproduced it with the following steps:

1. Reset settings and reboot.
2. Set the following settings:
- Follow Playlist: Yes
- Show Path: Current Directory Only
- Auto-Change Directory: Random
- Repeat: Off
3. Run the random_folder_advance_config plugin.
4. start playing a song via the filetree.
5. In the WPS press PLAY+RIGHT to jump to a random directory
6. Press NAVI to enter the filetree
7. Press LEFT once to go up one level. If the title now shows the correct directoryname then press PLAY to go back to the WPS and repeat from step 5.
Comment by PaulJam (PaulJam) - Tuesday, 10 July 2007, 15:04 GMT
Here are some observations that might be helpful for fixing this bug:
I tested a little but in the uisimulator and noticed that there are changes in the .playlist_control file depending on how the playback if this folder was initiated.

When starting playback normally from the filetree the file looks like this:

P:2:/Neuer Ordner/Apocalyptica/Apocalyptica (Special Edition):

After skipping to the next randon directory (without the bug happening) it looks like this (notice the additional "/" at the start and end of the path):

P:2://Neuer Ordner/Apocalyptica/Reflections/:

When the bug occurs it looks like this:

P:2://Neuer Ordner/Apocalyptica//Apocalyptica (Special Edition):

After that i started playback normally from the filetree, stopped playback and then edited the .playlist_control file by inserting an additional "/" somewhere in the path. After resuming playback i got the same behaviour of the wrong list title at the position where the "/" was added.
I hope this might help in finding the cause of the bug.
Comment by PaulJam (PaulJam) - Tuesday, 10 July 2007, 19:22 GMT
Here are possible solutions to the problems

1. The additional "/" at the beginning of the path:
It seems like  FS#7074  fixes this (and also adds nice functionality).

2. The additional "/" at the end or in the middle of the path:
The function "check_subdir_for_music" gets called in line 1403 in apps/playlist.c with an empty second parameter. And this causes a single "/" to be added to the end of the path in line 1528. So maybe this line should be in an "if (strlen(subdir))".

3. There is a locic eror, because the function "check_subdir_for_music" checks the dir itself, but also all subdirectorys for musicfiles and changes the first inputvariable to the path of the dir with the first musicfile. This causes that some dirs have a higher chance of being played. So maybe there should be another parameter added (e.g. bool check_subdirs) that tells the function to not search for musicfiles in subdiretorys.
Comment by Marc Guay (Marc_Guay) - Wednesday, 02 April 2008, 22:19 GMT
Reproducible on the e200 w/ r16929
Comment by Marc Guay (Marc_Guay) - Wednesday, 02 July 2008, 11:40 GMT
Can't reproduce after r17912 but will wait for Paul to confirm before closing.