Travis Shirk avatar Travis Shirk committed b901799

Moved --backup option to main group so all plugins can use it, like the
itunes-podcast plugin now does.

Comments (0)

Files changed (3)

src/eyed3/main.py

                        help="Supply a configuration file. The default is "
                             "'%s', although even that is optional." %
                             DEFAULT_CONFIG)
+        p.add_argument("--backup", action="store_true", dest="backup",
+                       help="Plugins should honor this option such that "
+                            "a backup is made of any file modified. The backup "
+                            "is made in same directory with a '.orig' "
+                            "extension added.")
         p.add_argument("-Q", "--quiet", action="store_true", dest="quiet",
                        default=False, help="A hint to plugins to output less.")
-
         p.add_argument("--fs-encoding", action="store",
                        dest="fs_encoding", default=eyed3.LOCAL_FS_ENCODING,
                        metavar="ENCODING",

src/eyed3/plugins/classic.py

 
         # Misc options 
         gid4 = arg_parser.add_argument_group("Misc options")
-        gid4.add_argument("--backup", action="store_true", default=False,
-                          dest="backup", help=ARGS_HELP["--backup"])
         gid4.add_argument("--force-update", action="store_true", default=False,
                           dest="force_update", help=ARGS_HELP["--force-update"])
         gid4.add_argument("-v", "--verbose", action="store_true",
         "--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 "
                           "options.",
         "--verbose": "Show all available tag data",

src/eyed3/plugins/itunes.py

 
         if save:
             print("\tAdding...")
-            tag.save()
+            tag.save(backup=self.args.backup)
             self._printStatus(tag)
 
     def _remove(self, tag):
 
         if save:
             print("\tRemoving...")
-            tag.save()
+            tag.save(backup=self.args.backup)
             self._printStatus(tag)
 
     def _printStatus(self, tag):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.