From: epg <> Date: Wed, 1 Nov 2006 11:06:58 +0000 (+0000) Subject: Don't hard-code front cover type; let the caller choose that. X-Git-Url: https://diplodocus.org/git/flac-archive/commitdiff_plain/2667d5282a3183df185615e711ef037056031f14?hp=b90277dd4685c341c9ba7f7b0136571cb31ce201 Don't hard-code front cover type; let the caller choose that. --- diff --git a/taglib.cc b/taglib.cc index 8d25531..8150ed8 100644 --- a/taglib.cc +++ b/taglib.cc @@ -11,7 +11,8 @@ extern "C" { static PyObject *taglib_error; static PyObject * -taglib_apic(const char *fn, const char *image, int len, const char *type) +taglib_apic(const char *fn, const char *image, int len, + int type, const char *mime_type) { TagLib::ByteVector *bv; TagLib::ID3v2::AttachedPictureFrame *p; @@ -30,8 +31,8 @@ taglib_apic(const char *fn, const char *image, int len, const char *type) /* Um, look at all these void-returning functions. I'm sure they * can fail, i just have no way to detect it... */ - p->setMimeType(type); - p->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover); + p->setType((TagLib::ID3v2::AttachedPictureFrame::Type)type); + p->setMimeType(mime_type); p->setPicture(*bv); /* GAH! Opening the file is entangled with allocating the object; @@ -68,14 +69,15 @@ taglib_apic(const char *fn, const char *image, int len, const char *type) static PyObject * add_apic_frame_to_mp3(PyObject *self, PyObject *args) { - const char *fn, *image, *type; - int len; + const char *fn, *image, *mime_type; + int len, type; - if (!PyArg_ParseTuple(args, "ss#s", &fn, &image, &len, &type)) { + if (!PyArg_ParseTuple(args, "ss#is", &fn, &image, &len, + &type, &mime_type)) { return 0; } - return taglib_apic(fn, image, len, type); + return taglib_apic(fn, image, len, type, mime_type); } static