mirror of
https://github.com/beetbox/beets.git
synced 2026-01-04 23:12:51 +01:00
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).
This commit is contained in:
parent
71e1547291
commit
d7d609442e
2 changed files with 4 additions and 30 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue