<para>\r
Geeqie is called by the command:\r
<programlisting>\r
- geeqie [options] [path_to_file_or_collection] <footnote id='ref1'>The name of a collection, with or without either path or extension (.gqv) may be used. If a path is not used and there is a name conflict with a file or folder, that will take precedence.</footnote>\r
+ geeqie [options] [path_to_file_or_collection]\r
+ <footnote id='ref1'>The name of a collection, with or without either path or extension (.gqv) may be used. If a path is not used and there is a name conflict with a file or folder, that will take precedence.</footnote>\r
</programlisting>\r
</para>\r
<para>These are the command line options available to Geeqie:</para>\r
</footnote>\r
</entry>\r
</row>\r
+ <row>\r
+ <entry />\r
+ <entry>--lua:<file>,<lua script></entry>\r
+ <entry>run lua script on file</entry>\r
+ </row>\r
<row>\r
<entry>-crsr:<folder></entry>\r
<entry>--cache-render-shared-recurse:<folder></entry>\r
<para>\r
Lua scripts allow the functionality of Geeqie to be extended. Lua scripts may only be used in conjunction with the\r
<link linkend="OverlayScreenDisplay">Overlay Screen Display</link>\r
- .\r
+ and the\r
+ <programlisting xml:space="preserve">geeqie --remote --lua:</programlisting>\r
+ command line option.\r
</para>\r
<para />\r
<para>Some knowledge of the Lua programming language is required.</para>\r
<entry>Image:get_size()</entry>\r
<entry>The file size in bytes</entry>\r
</row>\r
+ <row>\r
+ <entry>Image:get_marks()</entry>\r
+ <entry>An integer representing the marks set for the file</entry>\r
+ </row>\r
<row>\r
<entry>Image:get_exif()</entry>\r
<entry>A data structure containing the entire exif data</entry>\r
</section>\r
<section id="Warning">\r
<title>Warning</title>\r
- <warning><para>Lua is a powerful programming language. Errors in script files, besides having undesirable side-effects, may cause Geeqie to crash.</para></warning>\r
+ <warning>\r
+ <para>Lua is a powerful programming language. Errors in script files, besides having undesirable side-effects, may cause Geeqie to crash.</para>\r
+ </warning>\r
</section>\r
-</section>
+</section>\r
return 1;
}
+static int lua_image_get_marks(lua_State *L)
+{
+ FileData *fd;
+
+ fd = lua_check_image(L, 1);
+ lua_pushnumber(L, fd->marks);
+ return 1;
+}
+
static ExifData *lua_check_exif(lua_State *L, int index)
{
ExifData **exif;
{"get_date", lua_image_get_date},
{"get_size", lua_image_get_size},
{"get_exif", lua_image_get_exif},
+ {"get_marks", lua_image_get_marks},
{NULL, NULL}
};
luaL_register(L, "Image", image_methods);
#include <signal.h>
#include <errno.h>
+#include "glua.h"
#define SERVER_MAX_CLIENTS 8
}
}
+static void gr_lua(const gchar *text, GIOChannel *channel, gpointer data)
+{
+ gchar *result = NULL;
+ gchar **lua_command;
+
+ lua_command = g_strsplit(text, ",", 2);
+
+ if (lua_command[0] && lua_command[1])
+ {
+ FileData *fd = file_data_new_group(lua_command[0]);
+ result = g_strdup(lua_callvalue(fd, lua_command[1], NULL));
+ if (result)
+ {
+ g_io_channel_write_chars(channel, result, -1, NULL, NULL);
+ }
+ else
+ {
+ g_io_channel_write_chars(channel, N_("lua error: no data"), -1, NULL, NULL);
+ }
+ }
+ else
+ {
+ g_io_channel_write_chars(channel, N_("lua error: no data"), -1, NULL, NULL);
+ }
+
+ g_io_channel_write_chars(channel, "\n", -1, NULL, NULL);
+
+ g_strfreev(lua_command);
+ g_free(result);
+}
+
typedef struct _RemoteCommandEntry RemoteCommandEntry;
struct _RemoteCommandEntry {
gchar *opt_s;
{ "-crr:", "--cache-render-recurse:", gr_cache_render_recurse, TRUE, FALSE, N_("<folder> "), N_("render thumbnails recursively") },
{ "-crs:", "--cache-render-shared:", gr_cache_render_standard, TRUE, FALSE, N_("<folder> "), N_(" render thumbnails (see Help)") },
{ "-crsr:", "--cache-render-shared-recurse:", gr_cache_render_standard_recurse, TRUE, FALSE, N_("<folder>"), N_(" render thumbnails recursively (see Help)") },
+ { NULL, "--lua:", gr_lua, TRUE, FALSE, N_("<FILE>,<lua script>"), N_("run lua script on FILE") },
{ NULL, NULL, NULL, FALSE, FALSE, NULL, NULL }
};