Commits

Luke Plant committed bcdcbac

Simplified various implementations by using only instances of Player subclasses, not the Player subclass itself

  • Participants
  • Parent commits a9828c0

Comments (0)

Files changed (3)

 
 Currently supported players are:
 """
-    for P in players:
-        n = getattr(P, 'friendly_name', None)
+    for p in players:
+        n = getattr(p, 'friendly_name', None)
         if n is not None:
             help += " " + n + "\n"
 

playerdo/backends/mpris.py

     return [n for i, n in l]
 
 
-class classproperty(property):
-    def __get__(self, cls, owner):
-        return self.fget.__get__(None, owner)()
-
-
 class MprisPlayer(Player):
 
     _friendly_name = "Any MPRIS player"
     player_object_name = "/Player"
 
-    @classproperty
-    @classmethod
-    def friendly_name(cls):
-        retval = cls._friendly_name
+    @property
+    def friendly_name(self):
+        retval = self._friendly_name
         try:
-            l = get_sorted_candidate_buses(cls.player_object_name)
+            l = get_sorted_candidate_buses(self.player_object_name)
             names = []
             for n in l:
                 try:
 
     # Get running players
     running_ps = []
-    for P in players:
-        p = P()
+    for p in players:
         try:
             running = p.is_running()
             if running:
     """
     Checks that all backends have required dependencies, printing any failures
     """
-    for P in players:
-        p = P()
+    for p in players:
         failures = p.check_dependencies()
         if len(failures) > 0:
             sys.stdout.write("Player '%s' has missing dependencies:\n" % p.friendly_name)
         sys.exit(1)
 
 def find_players():
-    return [v for v in globals().values()
+    return [v() for v in globals().values()
             if type(v) is type and issubclass(v, Player)]