> Hi,
>
> In order to provide fun to my children while hiking, I plan to play
> geocaching.
>
> I notice viking has some stuff in tools subdirectory. But it seems to
> be a part of a dedicated project. Any reason for this? Why not simply
> use it as gpsbabel, ie as a dedicated external project? Nevertheless, I
> noticed this project is not in Debian archive. Probably need a help.
Since it was just a couple of public domain shell scripts I thought it wouldn't
harm to chuck it in the repository.
Especially as they're not packaged any where else.
> I also notice an other similar project, called geotoad:
> https://code.google.com/p/geotoad/wiki/README#Command-Line_Syntax
> I think geotoad is the one packaged for my N900 (yes, I also installed
> a geocaching tool for my n900).
>
> Perhaps can we give choice to user which backend tool he wants to use?
Probably not - unless you want to deal with how each external program has
different options.
I say pick one and stick with it.
> Note: I only test the tool packaged in viking. And it is really slow.
Yes, it's really slow - but that's the draw back of having to screen scrape
each individual geocache result to learn any detail about it.
> Not yet tested geotoad.
Feels a little quicker - it's own local caching mechanism is probably better
the the geo*tools, but still takes a while overall.
Would be nice to display the text feedback of progress in Viking.
Geotoad doesn't seem to write the final geocache to stdout only to a named
file, but should be more cross platform than the geo*tools bash scripts.
The other nice thing is at least it's one program.
I'd suggest changing to it and making Geocache part of the default build. (Then
I won't forget to update the file when types change!)
I've attached the little hack to get Geotoad working with Viking, I hope that
can start you off. It works for me.
diff --git a/src/datasource_gc.c b/src/datasource_gc.c
index 14df1e2..7ad4d55 100644
--- a/src/datasource_gc.c
+++ b/src/datasource_gc.c
@@ -33,7 +33,8 @@
#include "preferences.h"
// Could have an array of programs instead...
-#define GC_PROGRAM1 "geo-nearest"
+#define GC_PROGRAM1 "geotoad"
+//#define GC_PROGRAM1 "geo-nearest"
#define GC_PROGRAM2 "geo-html2gpx"
/* params will be geocaching.username, geocaching.password */
@@ -107,24 +108,26 @@ static gpointer datasource_gc_init ( )
static gchar *datasource_gc_check_existence ()
{
gboolean OK1 = FALSE;
- gboolean OK2 = FALSE;
+ //gboolean OK2 = FALSE;
gchar *location1 = g_find_program_in_path(GC_PROGRAM1);
if ( location1 ) {
g_free(location1);
OK1 = TRUE;
}
-
+ /*
gchar *location2 = g_find_program_in_path(GC_PROGRAM2);
if ( location2 ) {
g_free(location2);
OK2 = TRUE;
}
-
- if ( OK1 && OK2 )
+ */
+ //if ( OK1 && OK2 )
+ if ( OK1 )
return NULL;
- return g_strdup_printf(_("Can't find %s or %s in path! Check that you have installed it correctly."), GC_PROGRAM1, GC_PROGRAM2);
+ //return g_strdup_printf(_("Can't find %s or %s in path! Check that you have installed it correctly."), GC_PROGRAM1, GC_PROGRAM2);
+ return g_strdup_printf(_("Can't find %s in path! Check that you have installed it correctly."), GC_PROGRAM1);
}
static void datasource_gc_draw_circle ( datasource_gc_widgets_t *widgets )
@@ -191,7 +194,7 @@ static void datasource_gc_add_setup_widgets ( GtkWidget *dialog, VikViewport *vv
center_label = gtk_label_new (_("Centered around:"));
widgets->center_entry = gtk_entry_new();
miles_radius_label = gtk_label_new ("Miles Radius:");
- widgets->miles_radius_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new( 5, 1, 1000, 1, 20, 0 )), 25, 1 );
+ widgets->miles_radius_spin = gtk_spin_button_new ( GTK_ADJUSTMENT(gtk_adjustment_new( 2, 0, 100, 1, 20, 1 )), 10, 1 );
vik_coord_to_latlon ( vik_viewport_get_center(vvp), &ll );
s_ll = g_strdup_printf("%f,%f", ll.lat, ll.lon );
@@ -235,14 +238,19 @@ static void datasource_gc_get_cmd_string ( datasource_gc_widgets_t *widgets, gch
// 3. Converts webpages into a single waypoint file, ignoring zero location waypoints '-z'
// Probably as they are premium member only geocaches and user is only a basic member
// Final output is piped into GPSbabel - hence removal of *html is done at beginning of the command sequence
- *cmd = g_strdup_printf( "rm -f ~/.geo/caches/*html ; %s -P -n%d -r%.1fM -u %s -p %s %.4f %.4f ; %s -z ~/.geo/caches/*html ",
+ // *cmd = g_strdup_printf( "rm -f ~/.geo/caches/*html ; %s -P -n%d -r%.1fM -u %s -p %s %.4f %.4f ; %s -z ~/.geo/caches/*html ",
+
+ // Geotoad limits per page - not sure how many per page ATM pick 10 as something close...
+ gint number = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(widgets->num_spin) );
+ // ATM I can't see how (if it even can) output to stdout :(
+ *cmd = g_strdup_printf( "%s -L %d -y %.1f -u %s -p %s -q coord \"%.4f %.4f\" -o /tmp/geotoad$$ ; cat /tmp/geotoad$$",
GC_PROGRAM1,
- gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(widgets->num_spin) ),
+ (number < 10) ? 1 : (gint)(number/10),
gtk_spin_button_get_value_as_float ( GTK_SPIN_BUTTON(widgets->miles_radius_spin) ),
safe_user,
safe_pass,
- lat, lon,
- GC_PROGRAM2 );
+ lat, lon );
+ // GC_PROGRAM2 );
*input_file_type = NULL;
//g_free ( safe_string );
g_free ( safe_user );
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/