From d7d609442ec60d9fd0ed4892a489ed162a2b2328 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 14 Nov 2015 12:53:45 -0800 Subject: [PATCH] Remove diff_method option Our built-in "diff"-like functionality is pretty good because it's aware of beets' data structures and types. This makes it more legible, in my opinion, than an ordinary textual diff. So for now, I'm making this the only option (in the spirit of making the plugin as straightforward as humanly possible). --- beetsplug/edit.py | 27 ++++----------------------- docs/plugins/edit.rst | 7 ------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/beetsplug/edit.py b/beetsplug/edit.py index 6f7b7a419..9ef37bd17 100644 --- a/beetsplug/edit.py +++ b/beetsplug/edit.py @@ -40,7 +40,6 @@ class EditPlugin(plugins.BeetsPlugin): self.config.add({ 'editor': '', - 'diff_method': '', 'browser': '', 'albumfields': 'album albumartist', 'itemfields': 'track title artist album', @@ -55,14 +54,6 @@ class EditPlugin(plugins.BeetsPlugin): # your htmlviewer. Defaults to open with webrowser module self.browser = self.config['browser'].as_str_seq() - # the diff_method field in your config picks the way to see your - # changes. Options are: - # 'ndiff'(2 files with differences), - # 'unified'(just the different lines and a few lines of context), - # 'html'(view in html-format), - # 'vimdiff'(view in VIM) - self.diff_method = self.config['diff_method'].get(unicode) - # the albumfields field in your config sets the tags that # you want to see/change for albums. # Defaults to album albumartist. @@ -116,13 +107,6 @@ class EditPlugin(plugins.BeetsPlugin): self.brw_args = self.browser[1:] if len(self.browser) > 1 else None self.brw = self.browser[0] if self.browser else None - # 4 ways to view the changes in objects - self.diffresults = { - 'ndiff': self.ndiff, - 'unified': self.unified, - 'html': self.html, - 'vimdiff': self.vimdiff} - # main program flow # Get the objects to edit. query = decargs(args) @@ -296,14 +280,11 @@ class EditPlugin(plugins.BeetsPlugin): ob.update(n[1]) # update the object newSetTitled.append((format(ob),) + n[1:]) changedObjs.append(ob) + # see the changes we made - if self.diff_method: - ostr = self.print_to_yaml(oldSetTitled) - nwstr = self.print_to_yaml(newSetTitled) - self.diffresults[self.diff_method](ostr, nwstr) - else: - for obj in changedObjs: - ui.show_model_changes(obj) + for obj in changedObjs: + ui.show_model_changes(obj) + self.save_write(changedObjs) def save_write(self, changedob): diff --git a/docs/plugins/edit.rst b/docs/plugins/edit.rst index 3b48635c4..144d71b74 100644 --- a/docs/plugins/edit.rst +++ b/docs/plugins/edit.rst @@ -52,7 +52,6 @@ Make a ``edit:`` section in your config.yaml ``(beet config -e)`` edit: editor: nano -w -p - diff_method: html browser: firefox -private-window albumfields: genre album itemfields: track artist @@ -61,12 +60,6 @@ Make a ``edit:`` section in your config.yaml ``(beet config -e)`` * ``editor:`` pick your own texteditor; add arguments if needed. If no``editor:`` then your system opens the file-extension. -* ``diff_method:`` 4 choices. With no ``diff_method:`` you get the beets way of showing differences. - - ``ndiff``: you see original and the changed yamls with the changes. - - ``unified``: you see the changes with a bit of context. Simple and compact. - - ``html``: a html file that you can open in a browser. Looks nice. - - ``vimdiff``: gives you VIM with the diffs.You need VIM for this. - * ``browser:`` If you pick ``diff_method:html`` you can specify a viewer for it (if needed add arguments). If not, let your system open the file-extension.