Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3763/src
Modified Files:
clientserver.c clientserver.h prefs.c
Log Message:
* src/prefs.c
src/clientserver.[ch]: Add command line argument to print
out the gtkpod sha1 hash of a file ("--hash"). Thanks to
Todd Zullinger.
Index: clientserver.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/clientserver.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- clientserver.c 22 Nov 2006 15:48:19 -0000 1.13
+++ clientserver.c 24 Nov 2006 06:48:25 -0000 1.14
@@ -310,4 +310,15 @@
}
+/* print out the "sha1" hash of a filename <file> */
+gboolean print_sha1_hash (gchar *file)
+{
+ if (file && *file)
+ {
+ gchar *hash = sha1_hash_on_filename (file, TRUE);
+ if (hash) fprintf (stdout, "%s\n", hash);
+ g_free (hash);
+ }
+ return TRUE;
+}
Index: clientserver.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/clientserver.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- clientserver.h 17 Jun 2005 13:30:02 -0000 1.6
+++ clientserver.h 24 Nov 2006 06:48:25 -0000 1.7
@@ -43,6 +43,7 @@
void server_setup (void);
void server_shutdown (void);
gboolean client_playcount (gchar *file);
+gboolean print_sha1_hash (gchar *file);
#ifndef HAVE_FLOCK
#include <unistd.h>
#include <fcntl.h>
Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -d -r1.271 -r1.272
--- prefs.c 14 Oct 2006 10:11:19 -0000 1.271
+++ prefs.c 24 Nov 2006 06:48:25 -0000 1.272
@@ -129,6 +129,7 @@
GP_PLAYCOUNT,
GP_MOUNT,
GP_AUTO,
+ GP_PRINT_HASH,
};
/* Set default prefrences */
@@ -306,7 +307,8 @@
{
locale_fprintf(fp, _("gtkpod version %s usage:\n"), VERSION);
locale_fprintf(fp, _(" -h, --help: display this message\n"));
- locale_fprintf(fp, _(" -p <filename>:increment playcount for file by
one\n"));
+ locale_fprintf(fp, _(" -p <file>: increment playcount for file by
one\n"));
+ locale_fprintf(fp, _(" --hash <file>:print gtkpod hash for file\n"));
locale_fprintf(fp, _(" -m path: define the mountpoint of your
iPod\n"));
locale_fprintf(fp, _(" --mountpoint: same as '-m'.\n"));
locale_fprintf(fp, _(" -a: import database automatically after
start.\n"));
@@ -323,7 +325,8 @@
{
{ "h", no_argument, NULL, GP_HELP },
{ "help", no_argument, NULL, GP_HELP },
- { "p", required_argument, NULL, GP_PLAYCOUNT },
+ { "p", required_argument, NULL, GP_PLAYCOUNT },
+ { "hash", required_argument, NULL, GP_PRINT_HASH },
{ "m", required_argument, NULL, GP_MOUNT },
{ "mountpoint", required_argument, NULL, GP_MOUNT },
{ "a", no_argument, NULL, GP_AUTO },
@@ -344,6 +347,10 @@
client_playcount(optarg);
exit(0);
break;
+ case GP_PRINT_HASH:
+ print_sha1_hash (optarg);
+ exit(0);
+ break;
case GP_MOUNT:
prefs_set_string("initial_mountpoint", optarg);
break;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2