[gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 6/18] playlists: Add a SmartPlaylist class
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/playlists-core-rewrite-prep-work: 6/18] playlists: Add a SmartPlaylist class
- Date: Wed, 3 Jul 2019 16:45:58 +0000 (UTC)
commit 2d6a986c00ac37982fb8cfaad9d1595b1012fce6
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Nov 28 18:33:07 2016 +0100
playlists: Add a SmartPlaylist class
The SmartPlaylist basically has the ::is_smart property
set to True. All smart playlists now inherit from this
class.
gnomemusic/playlists.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 4c207b48..7912dc9b 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -59,7 +59,19 @@ class Playlist(GObject.GObject):
self.props.title = title
-class MostPlayed(Playlist):
+class SmartPlaylist(Playlist):
+ """Base class for smart playlists"""
+
+ def __repr__(self):
+ return "<SmartPlaylist>"
+
+ def __init__(self):
+ super().__init__()
+
+ self.props.is_smart = True
+
+
+class MostPlayed(SmartPlaylist):
"""Most Played smart playlist"""
def __init__(self):
@@ -71,7 +83,7 @@ class MostPlayed(Playlist):
self.props.query = Query.get_never_played_songs()
-class NeverPlayed(Playlist):
+class NeverPlayed(SmartPlaylist):
"""Never Played smart playlist"""
def __init__(self):
@@ -83,7 +95,7 @@ class NeverPlayed(Playlist):
self.props.query = Query.get_never_played_songs()
-class RecentlyPlayed(Playlist):
+class RecentlyPlayed(SmartPlaylist):
"""Recently Played smart playlist"""
def __init__(self):
@@ -95,7 +107,7 @@ class RecentlyPlayed(Playlist):
self.props.query = Query.get_recently_played_songs()
-class RecentlyAdded(Playlist):
+class RecentlyAdded(SmartPlaylist):
"""Recently Added smart playlist"""
def __init__(self):
@@ -107,7 +119,7 @@ class RecentlyAdded(Playlist):
self.props.query = Query.get_recently_added_songs()
-class Favorites(Playlist):
+class Favorites(SmartPlaylist):
"""Favorites smart playlist"""
def __init__(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]