Browse Source

Properly init mopidy plugin

Colin Powell 3 weeks ago
parent
commit
17eec1e32f
2 changed files with 24 additions and 2 deletions
  1. 0 1
      MANIFEST.in
  2. 24 1
      mopidy_smartplaylists/init.py

+ 0 - 1
MANIFEST.in

@@ -1,3 +1,2 @@
-
 include README.md
 include mopidy_smartplaylists/ext.conf

+ 24 - 1
mopidy_smartplaylists/init.py

@@ -1 +1,24 @@
-from .extension import Extension
+import mopidy
+
+class Extension(mopidy.ext.Extension):
+    dist_name = "Mopidy-SmartPlaylists"
+    ext_name = "smartplaylists"
+    version = "0.1.0"
+
+    def get_default_config(self):
+        return """
+        [smartplaylists]
+        genres = rock,jazz,blues
+        max_tracks = 50
+        playlist_prefix = [Smart]
+        """
+
+    def get_config_schema(self):
+        schema = super().get_config_schema()
+        # You can add: schema["genres"] = config.String()
+        return schema
+
+    def setup(self, registry):
+        from .backend import SmartPlaylistsBackend
+        registry.add("backend", SmartPlaylistsBackend)
+