Exaile finds the wrong 'local' cover

Bug #417463 reported by Kees Kuip
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
Low
Unassigned

Bug Description

I have 3 cover jpgs in each directory (album):
  cover.jpg
  coverSmall.jpg
  coverLarge.jpg

Now exaile always find 'coverSmall.jpg'.
What I would like is:

1. search for covers with the name: 'album.[jpg|png|gif]' or 'cover.[jpg|png|gif]' or 'front.[jpg|png|gif]'
2. If (1) didn't give a cover then search for files which end in 'jpg|png|gif'

So I changed "./xl/cover.py" into:

       """
            Sets up the cover search method
        """
        CoverSearchMethod.__init__(self)
        self.preferred_names = ['album.jpg', 'cover.jpg', 'front.jpg',
                                'album.png', 'cover.png', 'front.png',
                                'album.gif', 'cover.gif', 'front.gif']
        self.exts = ['.jpg', '.jpeg', '.png', '.gif']

    def find_covers(self, track, limit=-1):
        covers = []
        try:
            search_dir = os.path.dirname(track.local_file_name())
        except AttributeError:
            raise NoCoverFoundException()

        if not os.path.isdir(search_dir):
            raise NoCoverFoundException()
        for file in os.listdir(search_dir):
            if not os.path.isfile(os.path.join(search_dir, file)):
                continue

            # check preferred names
            if file.lower() in self.preferred_names:
                covers.append(os.path.join(search_dir, file))
                if limit != -1 and len(covers) == limit:
                    return covers

        for file in os.listdir(search_dir):
            if not os.path.isfile(os.path.join(search_dir, file)):
                continue

            # check for other names
            (pathinfo, ext) = os.path.splitext(file)
            if ext.lower() in self.exts:
                covers.append(os.path.join(search_dir, file))
                if limit != -1 and len(covers) == limit:
                    return covers

Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

I think the proper way to fix that is to allow users to specify a file name / regexp as a favourite local cover name. For instance, I always name mines .folder so that I don't see them when browsing music.

Changed in exaile:
assignee: nobody → Steve Dodier (sidi)
importance: Undecided → Low
milestone: none → 0.3.1
status: New → Confirmed
Revision history for this message
reacocard (reacocard) wrote :

the new covers system will pick up all jpg/png/gif images in local folders. if there is one with the name of album or cover, is is preferred, otherwise which one is picked initially is arbitrary, but the cover chooser will offer all of them for the user to select among.

Changed in exaile:
assignee: Steve Dodier (sidi) → nobody
status: Confirmed → Fix Committed
reacocard (reacocard)
Changed in exaile:
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.