[Dsctl-devel] SF.net SVN: dsctl: [128] src
Status: Alpha
Brought to you by:
roger-linux
|
From: <rog...@us...> - 2007-07-21 03:04:51
|
Revision: 128
http://dsctl.svn.sourceforge.net/dsctl/?rev=128&view=rev
Author: roger-linux
Date: 2007-07-20 20:04:49 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
commands.c: get_reception_status() I've got writing to metadata file fixed to where it *only* writes if one of the fields changed. Once this one field changes, the entire metadata file is overwritten. Seems to work pretty good. I just need to clean it up a bit along with tweaking it to work with Trunk Group ID. *Note: When teh scanner hits a Trunked Freq, if I can remember correctly, the scanner reports trunk group info and not reception status. If I'm wrong <shrugs> then I don't have to tweak and it *just* works. ;-)
Here's an example:
("-i" denotes the currently running ices pid -- "ps -ax |grep ices", "-h" for more info.)
dsctl -i 30653 -n status
Signed-off-by: Roger <ro...@es...>
Acked-by: Roger <ro...@es...>
Modified Paths:
--------------
src/commands.c
src/commands.h
src/human_commands.c
src/main.c
src/main.h
Modified: src/commands.c
===================================================================
--- src/commands.c 2007-07-20 10:11:00 UTC (rev 127)
+++ src/commands.c 2007-07-21 03:04:49 UTC (rev 128)
@@ -188,6 +188,7 @@
memset(answer, 0, 500);
memset(field, 0, 100);
+
do_command(fd, "GLG", answer);
/*printf ("%s\n(%i)\n", answer, strlen (answer)); */
parse_fields(answer, field);
@@ -195,8 +196,19 @@
if (daemon_mode == 0 || osd == 0)
printf("\nReception Status:\n");
+ /* Compare just one field to the external metadata variable and if
+ * if this field is different, then over metadata file with new data */
+ if (strcmp(metadata_title, field[7]) != 0)
+ {
+ if (debug > 0)
+ printf("DEBUG get_reception_status: Data differs. \
+ Writing metadata file\n\n\n");
+ write_metadata(field[6], field[7]);
+ strcpy(metadata_title, field[7]);
+ }
+
/* Send this data to ~/.dsctl/metadata */
- write_metadata(field[6], field[7]);
+ //write_metadata(field[6], field[7]);
/* We have 10 parsed fields to print for this command */
for (i = 0; i <= 9; i++)
Modified: src/commands.h
===================================================================
--- src/commands.h 2007-07-20 10:11:00 UTC (rev 127)
+++ src/commands.h 2007-07-21 03:04:49 UTC (rev 128)
@@ -36,6 +36,9 @@
extern int debug;
extern int osd;
+extern char metadata_artist[1024];
+extern char metadata_title[1024];
+
/***********************************************************************
* Function Declarations
***********************************************************************/
Modified: src/human_commands.c
===================================================================
--- src/human_commands.c 2007-07-20 10:11:00 UTC (rev 127)
+++ src/human_commands.c 2007-07-21 03:04:49 UTC (rev 128)
@@ -180,7 +180,6 @@
{
/* We have three types of displays */
/* FIXME: Display gets corrupt if stuck in prg_mode! */
-
while (daemon_mode != 0)
{
if (osd == 0)
Modified: src/main.c
===================================================================
--- src/main.c 2007-07-20 10:11:00 UTC (rev 127)
+++ src/main.c 2007-07-21 03:04:49 UTC (rev 128)
@@ -49,6 +49,13 @@
int osd = OSD; /* indicate the user wants ncurses osd */
int ices_pid = 0;
+ /* Initialize metadata file variables */
+ char metadata_artist[1024];
+ char metadata_title[1024];
+
+// memset(metadata_artist, 0, 1024);
+// memset(metadata_title, 0, 1024);
+
/***********************************************************************
* the main function. ain't it grand?
***********************************************************************/
@@ -72,6 +79,9 @@
memset(configline, 0, 81);
memset(errorstr, 0, 100);
+ memset(metadata_artist, 0, 1024);
+ memset(metadata_title, 0, 1024);
+
cmd_loc = 1;
cmd_arg_loc = 2;
Modified: src/main.h
===================================================================
--- src/main.h 2007-07-20 10:11:00 UTC (rev 127)
+++ src/main.h 2007-07-21 03:04:49 UTC (rev 128)
@@ -24,6 +24,9 @@
#ifndef _MAIN_H_
#define _MAIN_H_
+extern char metadata_artist[1024];
+extern char metadata_title[1024];
+
/***********************************************************************
* command codes
***********************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|