Decibel doesn't understand subfolders

Bug #179998 reported by seanh
8
Affects Status Importance Assigned to Milestone
Decibel Audio Player
Fix Released
Wishlist
Anonym25712

Bug Description

For example, I have one album that comes in two discs. The album is contained in a folder which has two subfolders which contain the music files for the two discs. The top folder for this album doesn't show up as a music folder (no CD icon) and I can't drag-drop it to the playlist. I propose that it should be marked with the CD icon and drag-dropping it should all files in the folder or any of it's subfolders to the playlist, and in the correct order (ordered by subfolder name and then by filename).

Generally, my Music folder, which contains all my music in many subfolders, should have a CD icon on it and I should be able to drag it to the playlist and add all my music if I want to.

Revision history for this message
Anonym25712 (anonym25712) wrote :

The problem is to decide when a directory is "playable". Currently, it is playable when it contains at least one file (music file, playlist) that can be played.

If we consider your example, how can DAP know that your top-level directory (the one that contains the two subfolders) is playable? To determine that, the file analysis would have to go one level deeper, and the time needed to do that can be huge (it evolves with the square of the depth). And why should we stop at depth 2? IMHO DAP cannot analyze recursively all your disk when you open a directory.

Changed in decibel-audio-player:
assignee: nobody → athropos
status: New → Incomplete
Revision history for this message
phil (philippwnrt) wrote :

I think the problem could be partially solved if DAP would recognize the mp3 tag called CD. It could sort the libraries like this: Alphabetic the interprets, then alphabetic their albums, then - if it appears in the mp3 tag - the cds of this album and finally the contained tracks.
This would be really great!
phil.

Revision history for this message
Anonym25712 (anonym25712) wrote :

I don't think it's related to this bug, which is about the way the file explorer shows directories with playable subdirectories. Moreover, tags are not read while browsing files with the file explorer.

Revision history for this message
phil (philippwnrt) wrote :

Maybe, it's not directly related to this "bug" but it could be a "work-around" with the help of libraries.

Changed in decibel-audio-player:
status: Incomplete → Won't Fix
Revision history for this message
Ryan Haigh (ryanhaigh) wrote :

For those interested I have figured out how to make decibel recursively add subdirectories. While I understand the developers point regarding how to determine if a directory is 'playable' for my purposes I am happy for DAP to assume that any directory I want to play/add to playlist is 'playable'.

First step: Make decibel think ANY directory is playable so that the right click>play/add to playlist options become available:

1. gksudo gedit /usr/share/decibel-audio-player/src/modules/FileExplorer.py
2. Find this section:
            hasContent = False
            hasMediaContent = False
            for (file, path) in tools.listDir(directory, self.showHiddenFiles):
                if isdir(path):
                    hasContent = True
                elif isfile(path) and (media.isSupported(file) or playlist.isSupported(file)):
                    hasContent = True
                    hasMediaContent = True
                    break
3. Change to this:
            hasContent = True
            hasMediaContent = True
            #for (file, path) in tools.listDir(directory, self.showHiddenFiles):
                #if isdir(path):
                    #hasContent = True
                #elif isfile(path) and (media.isSupported(file) or playlist.isSupported(file)):
                    #hasContent = True
                    #hasMediaContent = True
                    #break
4. Save file.

You can now start decibel and you should have the option to play/add to playlist any directory although it won't actually add subdirectories yet.

Second Step: Make decibel add subdirectories to the playlist when adding a parent directory:

1. gksudo gedit /usr/share/decibel-audio-player/src/media
2. Find this section:
    allTracks = []

    # Directories
    for directory in [filename for filename in filenames if os.path.isdir(filename)]:
3. Change it to
    allTracks = []

    #adding subdirectories
    subdirs = []
    for directory in [filename for filename in filenames if os.path.isdir(filename)]:
        for root,dirs,dirfiles in os.walk(directory):
         for dir in dirs:
          subdirs.append(os.path.join(root,dir))
 filenames = filenames + subdirs

    # Directories
    for directory in [filename for filename in filenames if os.path.isdir(filename)]:
4. Save the file and close the editor.

Start decibel again and you should be able to add any directory to the playlist and the files within that directory as well as any subdirectories, should be added to the playlist.

I'm sure there are better ways to do add this functionality to decibel however I have only limited experience with python and no gui programming experience at all so I'm pretty happy that I was able to get it working at all.

Revision history for this message
Ryan Haigh (ryanhaigh) wrote :

The indentation on the code sections I included in the previous comment isn't being preserved properly so I have attached my copies of the files mentioned for reference.

These files are from my 0.10 version of decibel. so copying them into your install directly may not work if you are using a later version.

Revision history for this message
Ryan Haigh (ryanhaigh) wrote :
Revision history for this message
Sam Bartle (sambartle) wrote :

I have to agree with Ryan.. Without this feature one of the most promising audio players I have ever seen is useless too me.. Even if its disabled by default and has to be configured via the plugins menu.. this is a feature that has to go in!

Thanks for the patch Ryan. I've just found Decibel today and then discovered this 'feature' which almost made me remove it again.. I thought I'd have a browse to see if there was a solution.. and you've provided one.

Revision history for this message
Anonym25712 (anonym25712) wrote :

This should be fixed in the next release.

Changed in decibel-audio-player:
importance: Undecided → Wishlist
status: Won't Fix → In Progress
Revision history for this message
Ryan Haigh (ryanhaigh) wrote :

Great news François. Thanks for all your work.

Revision history for this message
Anonym25712 (anonym25712) wrote :

Fixed on trunk.

Media folders no longer exist, and directories' contents is added recursively.

Changed in decibel-audio-player:
status: In Progress → Fix Committed
Revision history for this message
Anonym25712 (anonym25712) wrote :

See v1.01

Changed in decibel-audio-player:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.