Re: [Fwd: Re: [Rhythmbox-devel] Yet another user interface proposal]



Oops! I forgot the patch.  Here it is
-- 
Andy Hanton <andyhanton@comcast.net>
Only in ../streamripper-1.32: config.cache
Only in ../streamripper-1.32: config.log
Only in ../streamripper-1.32: config.status
Only in ../streamripper-1.32/console: Makefile
diff -u -r streamripper-1.32/console/streamripper.c ../streamripper-1.32/console/streamripper.c
--- streamripper-1.32/console/streamripper.c	Sun Apr 14 23:30:31 2002
+++ ../streamripper-1.32/console/streamripper.c	Wed Feb  5 01:43:57 2003
@@ -46,7 +46,10 @@
 static BOOL			m_got_sig = FALSE;
 static BOOL 			m_dont_print = FALSE;
 RIP_MANAGER_OPTIONS 		m_opt;
+static BOOL			m_xmms_enqueue;
 time_t				m_stop_time = 0;
+static char 			output_dir[MAX_PATH_LEN] = "";
+static char 			last_name[MAX_FILENAME_LEN] = "";
 
 /* main()
  * parse the aguments, tell the rip_mananger to start, we get in rip
@@ -78,7 +81,7 @@
   	 * (i.e. rip_manager_stop) from a signal handler.. or at least not
   	 * in FreeBSD 3.4, i don't know about linux or NT.
 	 */
-	while(!m_got_sig)
+	while(!m_got_sig && !m_alldone)
 	{
 		sleep(1);
 		time(&temp_time);
@@ -175,6 +178,34 @@
 	}
 }
 
+static void do_song_change(char *name)
+{
+	FILE *FILENAME_FILE;
+	char *filename = strdup("/tmp/streamripper_xmms_XXXXXX");
+	char *command = malloc(100);
+	int fd = 0;
+
+	strcpy(last_name, name);
+	fd = mkstemp(filename);
+	if (fd == -1)
+	{
+	  fprintf(stderr, "failed to open temporary file\n");
+	  return;
+	}
+
+	FILENAME_FILE = fdopen(fd, "w");
+	//fopen("/tmp/streamripper_name", "w");
+	fprintf(FILENAME_FILE, "%s/%s.mp3", output_dir, name);
+	printf("\n%s/%s.mp3\n", output_dir, name);
+	fclose(FILENAME_FILE);
+	strcpy(command, "xmms -e -n 0 \"`cat ");
+	strcat(command, filename);
+	strcat(command, "`\"");
+	system(command);
+	unlink(filename);
+	free(filename);
+	free(command);
+}
 /*
  * This will get called whenever anything interesting happens with the 
  * stream. Interesting are progress updates, error's, when the rip
@@ -187,6 +218,7 @@
 {
 	RIP_MANAGER_INFO *info;
 	ERROR_INFO *err;
+
 	switch(message)
 	{
 		case RM_UPDATE:
@@ -198,6 +230,7 @@
 			err = (ERROR_INFO*)data;
 			fprintf(stderr, "\nerror %d [%s]\n", err->error_code, err->error_str);
 			m_alldone = TRUE;
+			exit(-err->error_code);
 			break;
 		case RM_DONE:
 			fprintf(stderr, "bye..\n");
@@ -205,10 +238,17 @@
 			break;
 		case RM_NEW_TRACK:
 			fprintf(stderr, "\n");
+			if (m_xmms_enqueue == TRUE)
+			{
+				do_song_change((char *)data);
+			}
 			break;
 		case RM_STARTED:
 			m_started = TRUE;
 			break;
+		case RM_OUTPUT_DIR:
+			strcpy(output_dir, (char *)data);
+			break;
 	}
 }
 
@@ -325,6 +365,12 @@
 				i++;
 				strncpy(m_opt.useragent, argv[i], MAX_USERAGENT_STR);
 				break;
+			case 'x':
+				i++;
+				m_xmms_enqueue = TRUE;
+				printf("\nxmms mode\n");
+                                m_opt.flags ^= OPT_PUT_ALL_IN_OUTPUT_DIRECTORY;
+				break;
                 }
         }
 }
Only in ../streamripper-1.32/console: streamripper.c~
Only in ../streamripper-1.32: diff
Only in ../streamripper-1.32/lib: Makefile
Only in ../streamripper-1.32/lib: Makefile~
Only in ../streamripper-1.32/lib: cbuffer.o
diff -u -r streamripper-1.32/lib/compat.h ../streamripper-1.32/lib/compat.h
--- streamripper-1.32/lib/compat.h	Sat Apr 13 18:18:04 2002
+++ ../streamripper-1.32/lib/compat.h	Wed Feb  5 00:25:13 2003
@@ -59,7 +59,7 @@
 #define SemIsSignaled(_s_, _b_)	{*_b_ = (WaitForSingleObject(_s_, 0) == WAIT_OBJECT_0);}
 
 
-#elif __UNIX__
+#else
 
 #define THANDLE		pthread_t
 #define BeginThread(_thandle_, callback) pthread_create(&_thandle_, NULL, \
Only in ../streamripper-1.32/lib: compat.h~
diff -u -r streamripper-1.32/lib/filelib.c ../streamripper-1.32/lib/filelib.c
--- streamripper-1.32/lib/filelib.c	Sat Apr 13 03:18:04 2002
+++ ../streamripper-1.32/lib/filelib.c	Sun Jan 26 03:27:25 2003
@@ -27,7 +27,7 @@
 /*********************************************************************************
  * Public functions
  *********************************************************************************/
-error_code	filelib_init(BOOL do_count, BOOL keep_incomplete);
+error_code	filelib_init(BOOL do_count, BOOL keep_incomplete, BOOL put_all_in_output_directory);
 error_code	filelib_start(char *filename);
 error_code	filelib_end(char *filename, BOOL over_write_existing, /*out*/ char *fullpath);
 error_code	filelib_write(char *buf, u_long size);
@@ -53,6 +53,7 @@
 static char 	m_incomplete_directory[MAX_PATH];
 static char 	m_filename_format[] = "%s%s.mp3";
 static BOOL	m_keep_incomplete = TRUE;
+static BOOL	m_put_all_in_output_directory = FALSE;
 
 
 
@@ -69,11 +70,12 @@
 
 }
 
-error_code filelib_init(BOOL do_count, BOOL keep_incomplete)
+error_code filelib_init(BOOL do_count, BOOL keep_incomplete, BOOL put_all_in_output_directory)
 {
 	m_file = INVALID_FHANDLE;
 	m_count = do_count ? 1 : -1;
 	m_keep_incomplete = keep_incomplete;
+	m_put_all_in_output_directory = put_all_in_output_directory;
 	memset(&m_output_directory, 0, MAX_PATH);
 
 	return SR_SUCCESS;
@@ -129,7 +131,14 @@
 	char newfile[MAX_FILENAME];
 	close_file();
 
-	sprintf(newfile, m_filename_format, m_incomplete_directory, filename);
+	if (m_put_all_in_output_directory)
+	{
+		sprintf(newfile, m_filename_format, m_output_directory, filename);
+	}
+	else
+	{
+		sprintf(newfile, m_filename_format, m_incomplete_directory, filename);
+	}
 
 	if (m_keep_incomplete)
 	{
@@ -162,6 +171,7 @@
 #else
 	// Needs to be better tested
 	m_file = OpenFile(newfile);
+	ftruncate(m_file, 0);
 	if (m_file == INVALID_FHANDLE)
 	{
 		return SR_ERROR_CANT_CREATE_FILE;
@@ -183,6 +193,15 @@
 
 	close_file();
 
+	if (m_put_all_in_output_directory)
+	{
+		memset(newfile, 0, MAX_FILENAME);
+		sprintf(newfile, m_filename_format, m_output_directory, filename);
+		if (fullpath)
+			strcpy(fullpath, newfile); 
+
+		return SR_SUCCESS;
+	}
 
 	// Make new paths for the old path and new
 	memset(newfile, 0, MAX_FILENAME);
@@ -265,7 +284,7 @@
     	 * We're just calling this to zero out 
 	 * the vars, it's not really nessasary.
 	 */
-	filelib_init(FALSE, TRUE);
+	filelib_init(FALSE, TRUE, FALSE);
 }
 
 error_code filelib_remove(char *filename)
Only in ../streamripper-1.32/lib: filelib.c~
diff -u -r streamripper-1.32/lib/filelib.h ../streamripper-1.32/lib/filelib.h
--- streamripper-1.32/lib/filelib.h	Sun Dec  9 22:50:09 2001
+++ ../streamripper-1.32/lib/filelib.h	Sun Dec  1 00:53:47 2002
@@ -12,7 +12,7 @@
 #define MAX_FILENAME	256+MAX_PATH
 
 
-extern error_code	filelib_init(BOOL do_count, BOOL keep_incomplete);
+extern error_code	filelib_init(BOOL do_count, BOOL keep_incomplete, BOOL put_all_in_output_directory);
 extern error_code	filelib_start(char *filename);
 extern error_code	filelib_end(char *filename, BOOL over_write_existing, /*out*/ char *fullpath);
 extern error_code	filelib_write(char *buf, u_long size);
Only in ../streamripper-1.32/lib: filelib.h~
Only in ../streamripper-1.32/lib: filelib.o
Only in ../streamripper-1.32/lib: findsep.o
Only in ../streamripper-1.32/lib: http.o
Only in ../streamripper-1.32/lib: inet.o
diff -u -r streamripper-1.32/lib/live365info.c ../streamripper-1.32/lib/live365info.c
--- streamripper-1.32/lib/live365info.c	Thu Dec  6 23:20:07 2001
+++ ../streamripper-1.32/lib/live365info.c	Wed Feb  5 00:37:53 2003
@@ -33,6 +33,7 @@
 #include "threadlib.h"
 #include "live365info.h"
 
+#include "debug.h"
 
 /*********************************************************************************
  * Public functions
@@ -405,7 +406,7 @@
 	char *p, *t;
 
 
-#if DEBUG
+#if 0 //DEBUG
 	{
 		FILE *fp = fopen("c:/temp/dump.html", "wb");
 		fprintf(fp, "%s", html);
Only in ../streamripper-1.32/lib: live365info.c~
Only in ../streamripper-1.32/lib: mpeg.o
Only in ../streamripper-1.32/lib: play?session=lcostic:0
Only in ../streamripper-1.32/lib: play?session=lcostic:0.1
Only in ../streamripper-1.32/lib: relaylib.o
diff -u -r streamripper-1.32/lib/rip_manager.c ../streamripper-1.32/lib/rip_manager.c
--- streamripper-1.32/lib/rip_manager.c	Sat Apr 13 03:18:04 2002
+++ ../streamripper-1.32/lib/rip_manager.c	Wed Feb  5 01:16:22 2003
@@ -706,7 +706,8 @@
 		return SR_ERROR_INVALID_PARAM;
 
 	filelib_init(GET_COUNT_FILES(options->flags),
-				 GET_KEEP_INCOMPLETE(options->flags));
+				 GET_KEEP_INCOMPLETE(options->flags),
+				 GET_PUT_ALL_IN_OUTPUT_DIRECTORY(options->flags));
 	socklib_init();
 
 	init_error_strings();
Only in ../streamripper-1.32/lib: rip_manager.c~
diff -u -r streamripper-1.32/lib/rip_manager.h ../streamripper-1.32/lib/rip_manager.h
--- streamripper-1.32/lib/rip_manager.h	Fri Mar 29 01:12:37 2002
+++ ../streamripper-1.32/lib/rip_manager.h	Sun Dec  1 00:51:40 2002
@@ -52,6 +52,7 @@
 #define OPT_DATE_STAMP			0x00000100		// add a date stamp to the output directory
 #define OPT_CHECK_MAX_BYTES		0x00000200		// use the maxMB_rip_size value to know how much to rip
 #define OPT_KEEP_INCOMPLETE		0x00000400		// overwrite files in the incomplete directory, add counter instead
+#define OPT_PUT_ALL_IN_OUTPUT_DIRECTORY		0x00000800		// put all files directly into the destination instead of into incomplete
 
 //
 // Helper macros for checking options
@@ -70,6 +71,8 @@
 #define GET_DATE_STAMP(flags)				(OPT_FLAG_ISSET(flags, OPT_DATE_STAMP))
 #define GET_CHECK_MAX_BYTES(flags)			(OPT_FLAG_ISSET(flags, OPT_CHECK_MAX_BYTES))
 #define GET_KEEP_INCOMPLETE(flags)			(OPT_FLAG_ISSET(flags, OPT_KEEP_INCOMPLETE))
+#define GET_PUT_ALL_IN_OUTPUT_DIRECTORY(flags)			(OPT_FLAG_ISSET(flags, OPT_PUT_ALL_IN_OUTPUT_DIRECTORY))
+
 
 #define SET_AUTO_RECONNECT(flags)			(OPT_FLAG_SET(flags, OPT_AUTO_RECONNECT))
 #define SET_SEPERATE_DIRS(flags)			(OPT_FLAG_SET(flags, OPT_SEPERATE_DIRS))
@@ -81,6 +84,7 @@
 #define SET_DATE_STAMP(flags)				(OPT_FLAG_SET(flags, OPT_DATE_STAMP))
 #define SET_CHECK_MAX_BYTES(flags)			(OPT_FLAG_SET(flags, OPT_CHECK_MAX_BYTES))
 #define SET_KEEP_INCOMPLETE(flags)			(OPT_FLAG_SET(flags, OPT_KEEP_INCOMPLETE))
+#define SET_PUT_ALL_IN_OUTPUT_DIRECTORY(flags)			(OPT_FLAG_SET(flags, OPT_PUT_ALL_IN_OUTPUT_DIRECTORY))
 
 
 typedef struct RIP_MANAGER_OPTIONSst
Only in ../streamripper-1.32/lib: rip_manager.h~
Only in ../streamripper-1.32/lib: rip_manager.o
Only in ../streamripper-1.32/lib: riplive365.c~
Only in ../streamripper-1.32/lib: ripshout.o
Only in ../streamripper-1.32/lib: ripstream.o
Only in ../streamripper-1.32/lib: socklib.o
Only in ../streamripper-1.32/lib: threadlib.o
Only in ../streamripper-1.32/lib: util.o
Only in ../streamripper-1.32/mpglib: Makefile
Only in ../streamripper-1.32/mpglib: VbrTag.o
Only in ../streamripper-1.32/mpglib: common.o
Only in ../streamripper-1.32/mpglib: dct64.o
Only in ../streamripper-1.32/mpglib: decode.o
Only in ../streamripper-1.32/mpglib: interface.o
Only in ../streamripper-1.32/mpglib: layer3.o
Only in ../streamripper-1.32/mpglib: tabinit.o
Only in ../streamripper-1.32: streamripper
Only in ../streamripper-1.32: test


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]