Commits

Travis Shirk  committed bf964ef

Added --remove-frame option

  • Participants
  • Parent commits 97abda0
  • Branches stable

Comments (0)

Files changed (1)

File src/eyed3/plugins/classic.py

                           default=False, help=ARGS_HELP["--remove-v2"])
         gid3.add_argument("--remove-all", action="store_true", default=False,
                           dest="remove_all", help=ARGS_HELP["--remove-all"])
+        gid3.add_argument("--remove-frame", action="append", default=[],
+                          dest="remove_fids", metavar="FID",
+                          help=ARGS_HELP["--remove-frame"])
 
         _encodings = ["latin1", "utf8", "utf16", "utf16-be"]
         gid3.add_argument("--encoding", dest="text_encoding", default=None,
             if self.args.verbose:
                 printMsg("-" * 79)
                 printMsg("%d ID3 Frames:" % len(self.audio_file.tag.frame_set))
-                for frm in self.audio_file.tag.frame_set:
-                    printMsg(frm)
+                for fid in self.audio_file.tag.frame_set:
+                    printMsg("%s: %s" % (fid,
+                                         self.audio_file.tag.frame_set[fid]))
 
         else:
             raise TypeError("Unknown tag type: " + str(type(tag)))
                               (owner_id, id))
                 retval = True
 
+        # --remove-frame
+        for fid in self.args.remove_fids:
+            if fid in tag.frame_set:
+                del tag.frame_set[fid]
+                retval = True
+
         return retval
 
 
         "--remove-v2": "Remove ID3 v2.x tag.",
         "--remove-all": "Remove ID3 v1.x and v2.x tags.",
 
+        "--remove-frame": "Remove all frames with the given ID. This option "
+                          "may be specified multiple times.",
+
         "--backup": "Make a backup of any file modified. The backup is made in "
                     "same directory with a '.orig' extension added.",
         "--force-update": "Rewrite the tag despite there being no edit "