=== modified file 'data/ui/cover_prefs_pane.ui' --- data/ui/cover_prefs_pane.ui 2009-12-29 06:12:17 +0000 +++ data/ui/cover_prefs_pane.ui 2010-01-24 17:24:38 +0000 @@ -63,6 +63,53 @@ + + True + + + True + Preferred cover filename: + + + False + False + 0 + + + + + + + + True + True + + + + False + False + end + 1 + + + + + False + 2 + + + + + True + + + False + False + 8 + 3 + + + True @@ -127,7 +174,7 @@ False - 2 + 4 @@ -152,7 +199,7 @@ False - 3 + 5 === modified file 'xl/cover.py' --- xl/cover.py 2010-01-22 22:37:20 +0000 +++ xl/cover.py 2010-01-24 17:44:04 +0000 @@ -474,7 +474,7 @@ name = "localfile" uri_types = ['file', 'smb', 'sftp', 'nfs'] extensions = ['.png', '.jpg', '.jpeg', '.gif'] - preferred_names = ['album', 'cover'] + preferred_names = 'cover, album' fixed = True fixed_priority = 31 def find_covers(self, track, limit=-1): @@ -487,7 +487,10 @@ if not basedir.query_info("standard::type").get_file_type() == \ gio.FILE_TYPE_DIRECTORY: return [] - covers = [] + + preferred_names = settings.get_option('covers/filename', + self.preferred_names).split(", ") + cover_buckets = [[] for x in range(len(preferred_names)+1)] for fileinfo in basedir.enumerate_children("standard::type" ",standard::name"): gloc = basedir.get_child(fileinfo.get_name()) @@ -497,10 +500,18 @@ base, ext = os.path.splitext(filename) if ext.lower() not in self.extensions: continue - if base in self.preferred_names: - covers.insert(0, gloc.get_uri()) - else: - covers.append(gloc.get_uri()) + uri = gloc.get_uri() + try: + idx = preferred_names.index(base) + except ValueError: # not a preferred name + idx = -1 + cover_buckets[idx].append((ext.lower(), uri)) + + covers = [] + for b in cover_buckets: + b.sort(key=lambda x: self.extensions.index(x[0])) + covers.extend([x[1] for x in b]) + if limit == -1: return covers else: === modified file 'xlgui/prefs/cover_prefs.py' --- xlgui/prefs/cover_prefs.py 2009-12-29 06:12:17 +0000 +++ xlgui/prefs/cover_prefs.py 2010-01-24 17:42:07 +0000 @@ -64,3 +64,7 @@ class AutomaticCoverFetching(widgets.CheckPrefsItem): default = True name = 'covers/automatic_fetching' + +class FavouriteCover(widgets.PrefsItem): + default = 'cover, album' + name = 'covers/filename'