]> diplodocus.org Git - flac-archive/commitdiff
Don't hard-code front cover type; let the caller choose that.
authorepg <>
Wed, 1 Nov 2006 11:06:58 +0000 (11:06 +0000)
committerepg <>
Wed, 1 Nov 2006 11:06:58 +0000 (11:06 +0000)
taglib.cc

index 8d25531..8150ed8 100644 (file)
--- 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