]> kaliko git repositories - mpd-sima.git/blobdiff - sima/lib/plugin.py
Cleanup linter warnings
[mpd-sima.git] / sima / lib / plugin.py
index c38683af971e6aad172fe87cbfbe20750be7499b..58a0e57b783cd0bc10f2d3c983cf2d1b614f9feb 100644 (file)
@@ -24,7 +24,7 @@ Plugin object to derive from
 import random
 
 from .track import Track
 import random
 
 from .track import Track
-from .meta import Album, Artist
+from .meta import Album, Artist, MetaContainer
 
 
 class Plugin:
 
 
 class Plugin:
@@ -82,50 +82,42 @@ class Plugin:
         Called when the daemon().run() is called and
         right after the player has connected successfully.
         """
         Called when the daemon().run() is called and
         right after the player has connected successfully.
         """
-        pass
 
     def callback_player(self):
         """
         Called on player changes, stopped, paused, skipped
         """
 
     def callback_player(self):
         """
         Called on player changes, stopped, paused, skipped
         """
-        pass
 
     def callback_player_database(self):
         """
         Called on player music library changes
         """
 
     def callback_player_database(self):
         """
         Called on player music library changes
         """
-        pass
 
     def callback_playlist(self):
         """
         Called on playlist changes
         Not returning data
         """
 
     def callback_playlist(self):
         """
         Called on playlist changes
         Not returning data
         """
-        pass
 
     def callback_next_song(self):
         """
         Could be use to scrobble, maintain an history…
         Not returning data,
         """
 
     def callback_next_song(self):
         """
         Could be use to scrobble, maintain an history…
         Not returning data,
         """
-        pass
 
     def callback_need_track(self):
         """
         Returns a list of Track objects to add
         """
 
     def callback_need_track(self):
         """
         Returns a list of Track objects to add
         """
-        pass
 
     def callback_need_track_fb(self):
         """
         Called when callback_need_track failled to find tracks to queue
         Returns a list of Track objects to add
         """
 
     def callback_need_track_fb(self):
         """
         Called when callback_need_track failled to find tracks to queue
         Returns a list of Track objects to add
         """
-        pass
 
     def shutdown(self):
         """Called on application shutdown"""
 
     def shutdown(self):
         """Called on application shutdown"""
-        pass
 
 
 class AdvancedPlugin(Plugin):
 
 
 class AdvancedPlugin(Plugin):
@@ -163,20 +155,19 @@ class AdvancedPlugin(Plugin):
         Move around items in alist in order to have first not recently
         played (or about to be played) artists.
 
         Move around items in alist in order to have first not recently
         played (or about to be played) artists.
 
-        :param list(str) alist: artist name list (Not an Artist object)
+        :param {Artist} alist: Artist objects list/container
         """
         """
-        queued_artist = {_.artist for _ in self.player.queue}
-        not_queued_artist = set(alist) - queued_artist
+        queued_artist = MetaContainer([Artist(_.artist) for _ in self.player.queue])
+        not_queued_artist = alist - queued_artist
         duration = self.main_conf.getint('sima', 'history_duration')
         hist = []
         duration = self.main_conf.getint('sima', 'history_duration')
         hist = []
-        for art in self.sdb.get_artists_history(alist,
-                                                duration=duration):
+        for art in self.sdb.get_artists_history(alist, duration=duration):
             if art not in hist:
                 if art not in queued_artist:
                     hist.insert(0, art)
                 else:
                     hist.append(art)
             if art not in hist:
                 if art not in queued_artist:
                     hist.insert(0, art)
                 else:
                     hist.append(art)
-        # Find not recently played (not in history)
+        # Find not recently played (not in history) & not in queue
         reorg = [art for art in not_queued_artist if art not in hist]
         reorg.extend(hist)
         return reorg
         reorg = [art for art in not_queued_artist if art not in hist]
         reorg.extend(hist)
         return reorg