[gnome-music] playlists: Add base class for static playlists



commit fe6ca621513d2ee30f3367c6f53730a08ed5e99e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Oct 18 10:48:02 2016 -0200

    playlists: Add base class for static playlists
    
    Since the all share the same fields internally, it makes
    sense to have the static playlists descend from the same
    class.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773192

 gnomemusic/playlists.py |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 0341b08..9aef67f 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -40,37 +40,40 @@ import logging
 logger = logging.getLogger(__name__)
 
 
+class Playlist:
+    """ Base class of static and intelligent playlists """
+    ID = None
+    QUERY = None
+    TAG_TEXT = ""
+    TITLE = ""
+
+
 class StaticPlaylists:
 
     def __repr__(self):
         return '<StaticPlaylists>'
 
-    class MostPlayed:
-        ID = None
+    class MostPlayed(Playlist):
         TAG_TEXT = "MOST_PLAYED"
         # TRANSLATORS: this is a playlist name
         TITLE = _("Most Played")
 
-    class NeverPlayed:
-        ID = None
+    class NeverPlayed(Playlist):
         TAG_TEXT = "NEVER_PLAYED"
         # TRANSLATORS: this is a playlist name
         TITLE = _("Never Played")
 
-    class RecentlyPlayed:
-        ID = None
+    class RecentlyPlayed(Playlist):
         TAG_TEXT = "RECENTLY_PLAYED"
         # TRANSLATORS: this is a playlist name
         TITLE = _("Recently Played")
 
-    class RecentlyAdded:
-        ID = None
+    class RecentlyAdded(Playlist):
         TAG_TEXT = "RECENTLY_ADDED"
         # TRANSLATORS: this is a playlist name
         TITLE = _("Recently Added")
 
-    class Favorites:
-        ID = None
+    class Favorites(Playlist):
         TAG_TEXT = "FAVORITES"
         # TRANSLATORS: this is a playlist name
         TITLE = _("Favorite Songs")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]