From 55e0dd0609d621c449221e0df97d3acf8d6ff08a Mon Sep 17 00:00:00 2001 From: Frederick Gnodtke Date: Mon, 20 Mar 2017 17:27:15 +0100 Subject: [PATCH] Add documentation --- mopidy_subidy/library.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mopidy_subidy/library.py b/mopidy_subidy/library.py index 8e11042..a319a49 100644 --- a/mopidy_subidy/library.py +++ b/mopidy_subidy/library.py @@ -43,8 +43,11 @@ class SubidyLibraryProvider(backend.LibraryProvider): ("artists", "Artists"), ("albums", "Albums"), ] + # Create a dict with the keys being the left sides in `vdir_templates` ("rootdirs", "artists", ...) + # and the values being objects containing the key as `id` as well as the human readable name as `name`. vdirs = dict((template[0], dict(id=template[0], name=template[1])) for template in vdir_templates) if browse_uri == uri.ROOT_URI: + # Sort directories by name. root_vdirs = sorted((vdirs[vdir_name] for vdir_name in ["rootdirs", "artists", "albums"]), key=lambda a: a["name"]) return [Ref.directory(name=vdir["name"], uri=uri.get_vdir_uri(vdir["id"])) for vdir in root_vdirs] elif browse_uri == uri.get_vdir_uri("rootdirs"):