* Ulf Betlehem <[EMAIL PROTECTED]> [2004-08-30 10:12]:
> | > I call cplay from a shell script which at runtime assembles a
> | > playlist.  Therefore a "-q" option for quitting automatically after
> | > playing the last file would be helpful.
> | 
> | Sounds like a reasonable idea to me.  I'm CCing Ulf, the upsteam
> | author of cplay.  What do you think, Ulf?
> | 
> | A patch to do this is attached.
> 
>         Looks good.

This patch is not in cplay-1.50pre4 so I'm just re-sending it so you
won't forget.

-- 
Martin Michlmayr
http://www.cyrius.com/
diff -urN cplay-1.49.orig/cplay cplay-1.49/cplay
--- cplay-1.49.orig/cplay       2003-12-05 08:20:56.000000000 +0000
+++ cplay-1.49/cplay    2004-09-14 14:45:16.000000000 +0100
@@ -1406,6 +1406,7 @@
         self.restore_default_status = self.win_status.restore_default_status
         self.counter = self.win_root.win_counter.counter
         self.progress = self.win_root.win_progress.progress
+        self.quit_after_playlist = 0
         self.player = PLAYERS[0]
         self.timeout = Timeout()
         self.play_tid = None
@@ -1431,7 +1432,10 @@
                     self.player.stopped = 1  # end of playlist hack
                     if not self.win_playlist.stop:
                         entry = self.win_playlist.change_active_entry(1)
-                        entry and self.play(entry)
+                        if entry:
+                            self.play(entry)
+                        elif self.quit_after_playlist:
+                            self.quit()
             R = [sys.stdin, self.player.stdout_r, self.player.stderr_r]
             self.control.fd and R.append(self.control.fd)
             try: r, w, e = select.select(R, [], [], timeout)
@@ -1592,9 +1596,9 @@
 # ------------------------------------------
 def main():
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "nrRv")
+        opts, args = getopt.getopt(sys.argv[1:], "nrRvq")
     except:
-        usage = _("Usage: %s [-nrRv] [ file | dir | playlist ] ...\n")
+        usage = _("Usage: %s [-nrRvq] [ file | dir | playlist ] ...\n")
         sys.stderr.write(usage % sys.argv[0])
         sys.exit(1)
 
@@ -1613,6 +1617,7 @@
             if opt == "-r": app.win_playlist.command_toggle_repeat()
             if opt == "-R": app.win_playlist.command_toggle_random()
             if opt == "-v": app.mixer("toggle")
+            if opt == "-q": app.quit_after_playlist = 1
         if args or playlist:
             for i in args or playlist:
                 app.win_playlist.add(os.path.abspath(i))
diff -urN cplay-1.49.orig/cplay.1 cplay-1.49/cplay.1
--- cplay-1.49.orig/cplay.1     2003-12-05 08:14:30.000000000 +0000
+++ cplay-1.49/cplay.1  2004-09-14 14:48:07.000000000 +0100
@@ -45,6 +45,10 @@
 Toggles playlist \fIrandom\fP mode
 .IP \fB\-v
 Toggles PCM and MASTER (default) volume control
+.IP \fB\-q
+Quit after all songs in the playlist passed to
+.B cplay
+have been played.
 
 .SH SEE ALSO
 .PP

Reply via email to