Luke Plant  committed d6fb9cd


  • Participants
  • Parent commits 541aae9
  • Branches default

Comments (0)

Files changed (3)

File playerdo/backends/

 from playerdo.backends.base import Player
-from playerdo.utils import process_retval
+from playerdo.utils import process_retval, PlayerException
 import os
             return ["The command line program 'shc', compiled from the shc.hs script that comes with shell-fm, needs to be present on your PATH."]
         return []
-    # Can't implement 'play', because once you are stopped, shell-fm/shc needs
-    # you to specify a station if you want it to play.
+    def play(self):
+        if not self.is_stopped():
+            self.unpause()
+        else:
+            raise PlayerException("Cannot play shell-fm when in a stopped state.")
     def pause(self):
         process_retval(["shc", "pause"])

File playerdo/

 from playerdo.backends import *
 from playerdo.backends.base import Player
+from playerdo.utils import PlayerException
 import sys
         sys.stderr.write("Operation '%s' not supported for player '%s'.\n" %
                          (command, player.friendly_name))
+    except PlayerException, e:
+        sys.stderr.write(e.message + "\n")
+        sys.exit(1)
 def find_players():
     return [v for v in globals().values()

File playerdo/

         return c()
     except NotImplementedError:
         return replacement
+class PlayerException(Exception):
+    """
+    An exception that should be handled nicely by the front end
+    """
+    def __init__(self, message):
+        self.message = message