Your message dated Sat, 20 Jun 2026 20:41:24 +0000
with message-id <[email protected]>
and subject line Bug#782767: fixed in id3v2 0.1.12+dfsg-10
has caused the Debian Bug report #782767,
regarding id3v2: APIC/Cover tagging
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
782767: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782767
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: id3v2
Version: 0.1.12-2
Severity: wishlist
Tags: patch

Small patch enabling album cover tagging, adding a -p/--picture switch.
Tested on 0.1.12-2 with debian patches applied.
Mimetype is determined via libmagic (in my case version 5.11-2+deb7u8).
Written to be compiled with 'make WITH_MAGIC=true', since I didn't knew 
if another dependency is in maintainers mind. Also I can't say much 
about portability, I only know there is a windows version of libmagic 
included with GNU File for Windows:
http://gnuwin32.sourceforge.net/packages/file.htm

Thanks
diff --git a/Makefile b/Makefile
index 545ec02..b7923ff 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,12 @@ PREFIX=	/opt/local
 CXXFLAGS+=	-Wall -I${PREFIX}/include/ -DVERSION="\"${VERSION}\"" #-DSORT_RUNTIME
 LDFLAGS+=	-L${PREFIX}/lib/ 
 
+WITH_MAGIC?=false
+ifeq (${WITH_MAGIC},true)
+	LDFLAGS+= -lmagic
+	CXXFLAGS+=	-DWITH_MAGIC
+endif
+
 id3v2:	convert.o list.o id3v2.o genre.o charset.o
 	${CXX} ${LDFLAGS} -pedantic -Wall -g -o $@ $^ -lz -lid3
 
diff --git a/id3v2.cpp b/id3v2.cpp
index 2908337..7c529fb 100644
--- a/id3v2.cpp
+++ b/id3v2.cpp
@@ -16,6 +16,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef WITH_MAGIC
+#include <magic.h>
+#endif
+
 #include "genre.h"
 
 #define MAXNOFRAMES 1000
@@ -46,6 +50,9 @@ void PrintUsage(char *sName)
   std::cout << "  -a,  --artist       \"ARTIST\"    Set the artist information" << std::endl;
   std::cout << "  -A,  --album        \"ALBUM\"     Set the album title information" << std::endl;
   std::cout << "  -t,  --song         \"SONG\"      Set the song title information" << std::endl;
+#ifdef WITH_MAGIC
+  std::cout << "  -p,  --picture   \"IMAGE FILE\"    Set the front cover image" << std::endl;
+#endif
   std::cout << "  -c,  --comment      \"DESCRIPTION\":\"COMMENT\":\"LANGUAGE\"  "<< std::endl
        << "                            Set the comment information (both" << std::endl
        << "                            description and language optional)" << std::endl;    
@@ -209,7 +216,7 @@ int main( int argc, char *argv[])
       { "WXXX",    required_argument, &optFrameID, ID3FID_WWWUSER },
       { 0, 0, 0, 0 }
     };
-    iOpt = getopt_long (argc, argv, "12hfLvlRdsDCr:a:A:t:c:g:y:T:",
+    iOpt = getopt_long (argc, argv, "12hfLvlRdsDCr:a:A:t:p:c:g:y:T:",
                         long_options, &option_index);
 
     if (iOpt == -1  && argCounter == 0)
@@ -275,6 +282,13 @@ int main( int argc, char *argv[])
                 frameList[frameCounter].data = optarg;
                 frameCounter++;
                 break;
+#ifdef WITH_MAGIC
+      case 'p':
+                frameList[frameCounter].id   = ID3FID_PICTURE;
+                frameList[frameCounter].data = optarg;
+                frameCounter++;
+                break;
+#endif
       case 'c': 
                 frameList[frameCounter].id   = ID3FID_COMMENT;
                 frameList[frameCounter].data = optarg;
@@ -635,6 +649,44 @@ int main( int argc, char *argv[])
         }
         case ID3FID_PICTURE:
         {
+#ifdef WITH_MAGIC
+          if (pFrame != NULL)
+          {
+            ID3_Frame * todel = myTag.RemoveFrame(pFrame);
+            delete todel;
+          }
+          if (strlen(frameList[ii].data) > 0)
+          {
+            magic_t m = magic_open(MAGIC_SYMLINK | MAGIC_MIME_TYPE);
+            if (m == NULL)
+            {
+              std::cerr << "Couldn't create magic cookie." << std::endl;
+              break;
+            }
+            int res = magic_load(m, NULL);
+            if (res != 0)
+            {
+              std::cerr << "magic_load: Couldn't load magic database." << std::endl;
+              break;
+            }
+            const char *mime = magic_file(m, frameList[ii].data);
+            if (mime == NULL)
+            {
+              std::cerr << "Couldn't determine mime type or file not found." << std::endl;
+              break;
+            }
+			if (strstr(mime, "image/") == NULL) {
+              std::cerr << "File " << frameList[ii].data << " is no image." << std::endl;
+              break;
+			}
+            myFrame->Field(ID3FN_TEXTENC) = ID3TE_ASCII;
+            myFrame->Field(ID3FN_MIMETYPE) = mime;
+            myFrame->Field(ID3FN_PICTURETYPE) = ID3PT_COVERFRONT;
+            myFrame->Field(ID3FN_DATA).FromFile(frameList[ii].data);
+            myTag.AttachFrame(myFrame);
+            magic_close(m);
+          }
+#else
           char
             *sMimeType = ID3_GetString(myFrame, ID3FN_MIMETYPE),
             *sDesc     = ID3_GetString(myFrame, ID3FN_DESCRIPTION),
@@ -648,6 +700,7 @@ int main( int argc, char *argv[])
           delete [] sMimeType;
           delete [] sDesc;
           delete [] sFormat;
+#endif
           break;
         }
         case ID3FID_GENERALOBJECT:

--- End Message ---
--- Begin Message ---
Source: id3v2
Source-Version: 0.1.12+dfsg-10
Done: Martin A. Godisch <[email protected]>

We believe that the bug you reported is fixed in the latest version of
id3v2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin A. Godisch <[email protected]> (supplier of updated id3v2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 20 Jun 2026 21:17:11 +0200
Source: id3v2
Architecture: source
Version: 0.1.12+dfsg-10
Distribution: unstable
Urgency: low
Maintainer: Martin A. Godisch <[email protected]>
Changed-By: Martin A. Godisch <[email protected]>
Closes: 271311 390781 446427 681847 690543 782767 784064 848425 849558 849559
Changes:
 id3v2 (0.1.12+dfsg-10) unstable; urgency=low
 .
   * debian/patches/09_exit-code-on-error.patch: exit with a non-zero status
     when a file operand cannot be processed; a failing stat() now continues
     with the remaining operands instead of aborting the run. The list (-l/-R),
     strip (-d/-s/-D), remove-frame (-r) and convert (-C) paths likewise report
     failure through the exit status instead of always returning 0.
     Closes: #784064.
   * debian/patches/10_escape-colons-in-split-frames.patch: allow a literal
     colon to be embedded in the comment, lyrics, user-text and terms-of-use
     options by escaping it as "\:", and document the colon-separated syntax in
     the manual page. Closes: #390781, #681847. Thanks to John Jetmore for the
     patch.
   * debian/patches/11_skip-non-mpeg-files.patch: refuse to write a tag to
     files whose header matches a known non-audio container (MP4, Ogg, RIFF,
     FLAC, Matroska, ASF), which prepending an ID3v2 tag would corrupt.
     Closes: #446427.
   * debian/patches/12_manpage-document-standard-and-encoding.patch: document
     in the manual page that id3lib writes ID3 v2.3.0 (not v2.4) and how text
     fields are encoded. Closes: #849558.
   * debian/patches/13_manpage-reference-mid3v2.patch: mention mid3v2(1) as an
     actively maintained alternative in the manual page. Closes: #849559.
   * debian/rules: enable Large File Support (abi=+lfs) so that stat() succeeds
     on files with 64-bit inode numbers (e.g. on CIFS mounts) on 32-bit
     architectures. Closes: #690543.
   * debian/patches/14_txxx-keep-distinct-descriptions.patch: keep TXXX frames
     with distinct descriptions instead of replacing the first one regardless
     of description. Closes: #271311.
   * debian/patches/15_picture-cover-tagging.patch: add a -p/--picture option
     to set the front cover image (APIC), detecting the JPEG/PNG/GIF MIME type
     from the file contents without depending on libmagic. The new image is
     validated before any existing cover is removed and a failed -p aborts the
     file without rewriting it, so an unreadable or unsupported image can no
     longer destroy the picture already stored in the file. Closes: #782767.
     Thanks to Laurence Richert for the patch.
   * debian/patches/16_listing-newlines.patch: terminate the POPM and ENCR/GRID
     lines in the tag listing with a newline so the following frame no longer
     runs into the same line. Closes: #848425.
   * debian/tests/control: add regression tests covering the exit status on a
     missing operand, distinct TXXX descriptions, escaped colons, the non-MPEG
     refusal and cover-art round-tripping.
   * debian/control: set Rules-Requires-Root: no (the build needs no root).
Checksums-Sha1:
 74cfa1a053df96467a15cf020df97f3126c6d3e2 1906 id3v2_0.1.12+dfsg-10.dsc
 9652f12b91c0af7d0e3b9394d1a357de38b55354 29032 
id3v2_0.1.12+dfsg-10.debian.tar.xz
 2c39b638ef42743a3fdefcb1c999e936e1eea669 6073 
id3v2_0.1.12+dfsg-10_amd64.buildinfo
Checksums-Sha256:
 cafe03fcdc15e6f4dbae40e404c67be4011d686b7d59fe7d2059ce2f8aea78bc 1906 
id3v2_0.1.12+dfsg-10.dsc
 9cb3ddb0814256468a3a6c1dfd6a5e390787af9dffc00d14675919755fc62132 29032 
id3v2_0.1.12+dfsg-10.debian.tar.xz
 9bc3b15ca9446e8bf604c98ec46c8266e92a9e072dc0321265842d69e4dba43d 6073 
id3v2_0.1.12+dfsg-10_amd64.buildinfo
Files:
 78d330d2612ee6a4e5c5017aa1afe36d 1906 sound optional id3v2_0.1.12+dfsg-10.dsc
 c40ef5a2a8626ec33fb5e90028bc7b8c 29032 sound optional 
id3v2_0.1.12+dfsg-10.debian.tar.xz
 401ce2bcf191fc87b02a0dabb2154916 6073 sound optional 
id3v2_0.1.12+dfsg-10_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEEGEIyO0/Pm5CZX6F/o1C5kfBaSFcFAmo26BgTHGdvZGlzY2hA
ZGViaWFuLm9yZwAKCRCjULmR8FpIV1LvD/40TA3ZCawTzk2IK0ZmVp6OL7LAs1iB
u8f9jXN0xyee4ZjqzFJL/cJ117BYJHKYNFeJaC3uJjaqOQbCFnScA4oi/KB0hbVS
dehCef6HrF609swFeMsgJT8pZyllDGvRTaES+v+WIzBQx3Zb1LhjJvqNX1S66qqR
temxPDgqEfNPR6Qu2QxUWyXO12KwyvBSPUoHrsDjJEbuou/sJprZQZzv76HGCDEJ
Hq+HhpalnJ3UYWdAeSNt7MUQAxZFeQKQjT58BLi2//J7QSgGbcLixrvPqmb3LZG5
/6QWhvJ+6M5yZBFoCcLb+EAXJZsd31u2OdK/d6IlUWcneNGsFbx4EK1AF4WyBVkX
0S8gmB//qNnKL9QltQPSZn5ZT2dET2tDE3KGGqzlMX9jU0VYlewJZT9JZro/TA0a
QDtt50oM0SLr3+mjDUkyUcqxfm6eE8/zLxrqHRA6H9i4qWC2qRb+4dU1bh11Axc3
M8anItNOgDMqG71ua8msFC7Lt6zdsPAxv5wQ3u5kPUqfALm6U4n1GGrS+ijiFKSd
EeWmQg5FNgsmwTcEzSJoP7Rfuk+xbQzPS+CS02pPNzmI2l49IKIpTr8n04GuAw2J
2VqFGgXWGoCSNj8Ct9Zvp6XcSXJaN3vNG1UhWlSIp8app1aI8Esqb9m24wzYoEBE
ihIOj0IRFxQPRQ==
=JRb+
-----END PGP SIGNATURE-----

Attachment: pgpiCotuyecuS.pgp
Description: PGP signature


--- End Message ---

Reply via email to