[gnome-music/wip/gbsneto/contained-playlists: 5/29] playlists: Add a StaticPlaylist class
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/gbsneto/contained-playlists: 5/29] playlists: Add a StaticPlaylist class
- Date: Thu, 1 Dec 2016 23:25:59 +0000 (UTC)
commit 9615b00d0985e0efd9c0705c195f3ef04e3ebbbf
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Nov 28 18:33:07 2016 +0100
playlists: Add a StaticPlaylist class
The StaticPlaylist basically has the ::is_static property
set to True. All static playlists now inherit from this
class.
gnomemusic/playlists.py | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 762f427..a746784 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -59,52 +59,72 @@ class Playlist(GObject.Object):
self.query = query
self.tag_text = tag_text
self.title = title
+ self.is_static = False
-class MostPlayed(Playlist):
+class StaticPlaylist(Playlist):
+ """Base class for static playlists"""
+ @log
+ def __init__(self):
+ Playlist.__init__(self)
+
+ self.is_static = True
+
+
+class MostPlayed(StaticPlaylist):
"""Most Played static playlist"""
@log
def __init__(self):
+ StaticPlaylist.__init__(self)
+
self.tag_text = "MOST_PLAYED"
# TRANSLATORS: this is a playlist name
self.title = _("Most Played")
self.query = Query.get_never_played_songs()
-class NeverPlayed(Playlist):
+class NeverPlayed(StaticPlaylist):
"""Never Played static playlist"""
@log
def __init__(self):
+ StaticPlaylist.__init__(self)
+
self.tag_text = "NEVER_PLAYED"
# TRANSLATORS: this is a playlist name
self.title = _("Never Played")
self.query = Query.get_never_played_songs()
-class RecentlyPlayed(Playlist):
+class RecentlyPlayed(StaticPlaylist):
"""Recently Played static playlist"""
@log
def __init__(self):
+ StaticPlaylist.__init__(self)
+
self.tag_text = "RECENTLY_PLAYED"
# TRANSLATORS: this is a playlist name
self.title = _("Recently Played")
self.query = Query.get_recently_played_songs()
-class RecentlyAdded(Playlist):
+class RecentlyAdded(StaticPlaylist):
"""Recently Added static playlist"""
@log
def __init__(self):
+ StaticPlaylist.__init__(self)
+
self.tag_text = "RECENTLY_ADDED"
# TRANSLATORS: this is a playlist name
self.title = _("Recently Added")
self.query = Query.get_recently_added_songs()
-class Favorites(Playlist):
+class Favorites(StaticPlaylist):
"""Favories static playlist"""
@log
def __init__(self):
+ StaticPlaylist.__init__(self)
+
self.tag_text = "FAVORITES"
# TRANSLATORS: this is a playlist name
self.title = _("Favorite Songs")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]