static PyObject *
find_record_by_name(PyObject *self, PyObject *args, PyObject *keywds)
{
	char *name = NULL;
	IptcRecord record;
	IptcTag tag;
	char *kwlist[] = {"name", NULL};
	if (!PyArg_ParseTupleAndKeywords(args, keywds, "s", kwlist, &name))
		return NULL;

	if (iptc_tag_find_by_name(name, &record, &tag) < 0)
	{
		PyErr_SetString(PyExc_ValueError,
				"Record not found");
		return NULL;
	}

	return Py_BuildValue("(ii)", record, tag);
}
Beispiel #2
0
Datei: iptc.c Projekt: Limsik/e17
Enlil_IPTC *
enlil_iptc_new_from_name(const char *name)
{
   IptcRecord record;
   IptcTag tag;
   Enlil_IPTC *iptc;

   if (iptc_tag_find_by_name (name, &record, &tag) < 0)
     {
        LOG_ERR("Invalid tag name : #%s#", name);
        return NULL;
     }

   iptc = calloc(1, sizeof(Enlil_IPTC));
   iptc->record = record;
   iptc->tag = tag;
   iptc->name = eina_stringshare_add(name);
   iptc->title = eina_stringshare_add(iptc_tag_get_title(record, tag));

   return iptc;
}