<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
- and the\r
+ ,\r
+ <link linkend="GuideSidebarsInfo" endterm="Listpanes-ExifFileinfoCopyrightLocationandGPS">List panes</link>\r
+ on the Info Sidebar, and the\r
<programlisting xml:space="preserve">geeqie --remote --lua:</programlisting>\r
command line option.\r
</para>\r
<link linkend="GuideOtherWindowsExif" endterm="titleGuideOtherWindowsExif" />\r
onto any pane.\r
</para>\r
- <para>As an aide, in addition to standard metadata tags, Geeqie provides certain pre-formatted tags. These are:</para>\r
+ <para>As an aide, in addition to standard metadata tags, Geeqie can call lua scripts and also provides certain pre-formatted tags. These tags are:</para>\r
<table id="formatted_exif">\r
<tgroup cols="2" rowsep="1" colsep="1">\r
<tbody>\r
<entry>file.link</entry>\r
<entry>if the file is a symbolic link, shows the path of the source file</entry>\r
</row>\r
+ <row>\r
+ <entry>lua.<lua script></entry>\r
+ <entry>\r
+ Call a lua script\r
+ <footnote id='lua_ref1'>The output is expected to be text.</footnote>\r
+ </entry>\r
+ </row>\r
</tbody>\r
</tgroup>\r
</table>\r
#include "filefilter.h"
#include "filecache.h"
#include "format_raw.h"
+#include "glua.h"
#include "ui_fileops.h"
#include "cache.h"
#include "jpeg_parser.h"
return g_strdup("");
}
+#ifdef HAVE_LUA
+gchar *metadata_lua_info(FileData *fd, const gchar *key, MetadataFormat format)
+{
+ gchar *script_name;
+ gchar *script_name_utf8;
+ gchar *data;
+ gchar *raw_data;
+ gchar *valid_data;
+
+ script_name_utf8 = g_strdup(key + 4);
+ script_name = path_from_utf8(script_name_utf8);
+
+ raw_data = lua_callvalue(fd, script_name, NULL);
+ valid_data = g_utf8_make_valid(raw_data, -1);
+ data = g_utf8_substring(valid_data, 0, 150);
+ g_free(script_name);
+ g_free(script_name_utf8);
+ g_free(raw_data);
+ g_free(valid_data);
+
+ return data;
+}
+#endif
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
void exif_free_preview(guchar *buf);
gchar *metadata_file_info(FileData *fd, const gchar *key, MetadataFormat format);
+gchar *metadata_lua_info(FileData *fd, const gchar *key, MetadataFormat format);
#endif
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
{
return g_list_append(NULL, metadata_file_info(fd, key, format));
}
+#ifdef HAVE_LUA
+ else if (strncmp(key, "lua.", 4) == 0)
+ {
+ return g_list_append(NULL, metadata_lua_info(fd, key, format));
+ }
+#endif
exif = exif_read_fd(fd); /* this is cached, thus inexpensive */
if (!exif) return NULL;