Package: orpheus
Version: 1.5-3
Severity: wishlist
Tags: patch

To be able to start and stop orpheus from (for example) a cron-job, we
need a start/stop commandline commando.
Furthermore, it's already possible to add to the list, but it would be
nice to be able to clear the playlist as well.

Attached patch addresses both issues.

Thanks,
Taco.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages orpheus depends on:
ii  libc6                         2.3.5-7    GNU C Library: Shared libraries an
ii  libgcc1                       1:4.0.2-2  GCC support library
ii  libghttp1                     1.0.9-16   original GNOME HTTP client library
ii  libncurses5                   5.5-1      Shared libraries for terminal hand
ii  libogg0                       1.1.2-1    Ogg Bitstream Library
ii  libstdc++6                    4.0.2-2    The GNU Standard C++ Library v3
ii  libvorbis0a                   1.1.0-1    The Vorbis General Audio Compressi
ii  libvorbisfile3                1.1.0-1    The Vorbis General Audio Compressi

Versions of packages orpheus recommends:
ii  mpg321 [mpg123]               0.2.10.3   A Free command-line mp3 player, co
ii  vorbis-tools                  1.0.1-1.5  Several Ogg Vorbis Tools

-- no debconf information
diff -ur orpheus-1.5.debian/src/abstract/userinterface.h orpheus-1.5/src/abstract/userinterface.h
--- orpheus-1.5.debian/src/abstract/userinterface.h	2004-02-14 16:11:25.000000000 +0100
+++ orpheus-1.5/src/abstract/userinterface.h	2005-10-21 08:57:02.000000000 +0200
@@ -19,6 +19,9 @@
 	virtual void doadd(const string &aitem) = 0;
 	virtual void loadplaylist(const string &lname) = 0;
 	virtual void play(int n) = 0;
+	virtual void playcurrent() = 0;
+	virtual void stop() = 0;
+	virtual void clear() = 0
 
 	virtual void commandline(int argc, char **argv) { }
 	virtual void status(const string &s) { }
diff -ur orpheus-1.5.debian/src/main.cc orpheus-1.5/src/main.cc
--- orpheus-1.5.debian/src/main.cc	2004-02-14 18:11:05.000000000 +0100
+++ orpheus-1.5/src/main.cc	2005-10-21 08:58:31.000000000 +0200
@@ -60,6 +60,15 @@
 	    } else if(tok == "play") {
 		ui.play(atoi(cmd.c_str()));
 
+	    } else if(tok == "stop") {
+		ui.stop();
+
+	    } else if(tok == "start") {
+		ui.playcurrent();
+
+	    } else if(tok == "clear") {
+		ui.clear();
+
 	    }
 
 	    f.close();
diff -ur orpheus-1.5.debian/src/uitext.cc orpheus-1.5/src/uitext.cc
--- orpheus-1.5.debian/src/uitext.cc	2004-02-17 02:18:21.000000000 +0100
+++ orpheus-1.5/src/uitext.cc	2005-10-21 09:01:22.000000000 +0200
@@ -161,6 +161,30 @@
     }
 }
 
+void OrpheusTextUI::stop() {
+	cleartrack();
+	update();
+}
+void OrpheusTextUI::clear() {
+	cleartrack();
+	plist.clear();
+	update();
+}
+void OrpheusTextUI::playcurrent() {
+    OrpheusPlayList::iterator nt;
+    if ( !currenttrack ) {
+	nt = plist.begin() + trackm.getpos();
+    } else {
+	nt = find(plist.begin(), plist.end(), currenttrack);
+    }
+    if (nt != plist.end()) {
+    	playtrack(*nt);
+    } else {
+	cleartrack();
+	update();
+    }
+}
+
 void OrpheusTextUI::loadcolors() {
     string fname = (string) getenv("HOME") + "/.orpheus/colors";
 
diff -ur orpheus-1.5.debian/src/uitext.h orpheus-1.5/src/uitext.h
--- orpheus-1.5.debian/src/uitext.h	2004-02-14 15:53:34.000000000 +0100
+++ orpheus-1.5/src/uitext.h	2005-10-21 09:01:38.000000000 +0200
@@ -55,6 +55,9 @@
 	void playtrack(track *t);
 	void cleartrack();
 	void play(int n);
+	void playcurrent();
+	void stop();
+	void clear();
 
 	void configuration();
 	void mixer();

Reply via email to