Commit graph

67 commits

Author SHA1 Message Date
wordofglass
df479d686d Fix the edit plugin displaying bogus data or even crashing on re-imports 2017-08-21 00:32:03 +02:00
Johnny Robeson
fcbfce3984 replace deprecated log.warn() with log.warning() 2016-08-09 00:33:38 -04:00
Johnny Robeson
47bddb394c decode yaml dumped data as utf-8 in edit plugin for PY2
Yaml doesn't return a true unicode string even with `allow_unicode`
passed to `safe_dump_all`.
2016-08-08 23:59:54 -04:00
Johnny Robeson
303627e44f Read and write edit plugin yaml as utf-8 2016-08-07 06:12:48 -04:00
Johnny Robeson
5b3cd44608 add coding: utf-8 magic comment to every .py file 2016-08-07 04:09:17 -04:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
0a5c6ce4c0 open tempfile in edit plugin in text mode 2016-06-14 03:38:21 -04:00
Adrian Sampson
fa2aa82a0d Fix #1927: useful error message for failed edit 2016-04-03 17:42:25 -04:00
Adrian Sampson
3f4f077272 edit: Log the invoked command 2016-04-03 17:38:40 -04:00
Adrian Sampson
eac7d64545 Merge branch 'master' into no_unicode_literals 2016-02-28 15:21:43 -08:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
53d2c8d9db Removed unicode_literals from plugins
* echonest
* edit
* embedart
* embyupdate
2016-02-20 13:35:54 +01:00
Diego Moreda
8d3f9a573c edit: revert album-field changes, use temporary id
* Revert the changes related to allowing the album- and item-level
fields to be edited at the same time, as the increase in complexity
was deemed excesive during review.
* Modify the interactive execution so temporary Item.id's are used,
removing the extra functionality needed for dealing with both id and
path as reference fields.
* Docstrings and comments cleanup.
2016-02-05 12:35:11 +01:00
Diego Moreda
0ba8f83929 edit: allow edit album+item fields in single yaml
* Add support for editing both the item fields and the album fields in
a single YAML file, by appending an Album-like object as the front of
the objects to be edited.
* The FakeAlbum class provides that object, mimicking the original
Album behaviour and including an _apply_changes() method that propagates
the changes read from the yaml onto the Items.
* Modify edit_objects() so the flattening of the objects takes into
account the type of object, using different fields for Albums and for
Items.
* Renamed apply() to apply_() to prevent an IDE warning about reusing a
reserved built-in symbol.
2016-02-03 17:34:39 +01:00
Diego Moreda
b8ec22ca34 edit: use action.RETAG, cleanup
* Make the edit plugin return action.RETAG when invoked during an
interactive import session, making the importer handle the writing of
the tags to the files (if needed) properly.
* Move the logic relative to the "reference field" to
_set_reference_field(), simplifying a bit the functions that depend on
this field.
* Hide the "edit Candidates" choice if no candidates are found.
2016-02-01 18:57:03 +01:00
Diego Moreda
30927a901f Fix flake8 error 2016-01-29 19:54:23 +01:00
Diego Moreda
98abe69520 edit: invoke editor during importer, on Items
* Initial draft for invoking the edit plugin during an importer session.
* Add prompt choices for editing the original file tags ("eDit") and
apply a candidate and then edit ("edit Candidates").
* Modify plugin (_get_fields, apply_data, edit_objects) so "path" can be
used as a reference field instead of "id", as the Items are not still on
the database when the plugin is invoked via the importer.
* Modify ImportTask.manipulate_files() with a temporary flag for writing
the item tags even if ASIS was selected.
2016-01-29 17:09:12 +01:00
Adrian Sampson
635052e2ff Fix #1804: edit plugin moves files 2016-01-08 15:22:28 -08:00
Adrian Sampson
963a66a40c Refactor try_sync to also include moving
This will remove a bunch of duplication we currently have for moving files
*inside the library directory* when their metadata changes.
2016-01-08 14:56:52 -08:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
69ffb83453 Eliminate some copypasta 2015-11-19 16:26:27 -08:00
Adrian Sampson
f995ab38db Fix a test and a bug revealed by a test 2015-11-19 16:11:45 -08:00
Adrian Sampson
437959018c Pass through certain "safe" types to YAML
This avoids some round-tripping problems with types (such as ScaledInt) that
are not represented in strings with 100% fidelity. It also makes the syntax
nicer when editing numbers and booleans: they no longer appear to be
needlessly surrounded by quotes in the YAML.
2015-11-19 16:07:20 -08:00
Adrian Sampson
0e20770cc3 Convert YAML keys and values back to strings
I hadn't quite realized before that the user could also change the *keys* to
be non-strings too! This also prevents against that by just reinterpreting
everything as strings.
2015-11-19 15:38:20 -08:00
Adrian Sampson
0873d31419 Catch unexpected YAML type
We need a sequence of dictionaries back; validate this assumption.
2015-11-19 15:34:49 -08:00
Adrian Sampson
3176b83cd7 Use type-based formatting and parsing
All editable values are now strings and are parsed from strings. This closely
matches the behavior of the `modify` command, for example.
2015-11-19 15:25:49 -08:00
Adrian Sampson
775a48eb28 --extra/-e is now --field/-f 2015-11-17 14:40:52 -08:00
Adrian Sampson
b33d25a0ad --extra option can use any field
Not just the built-in fields.
2015-11-17 14:39:40 -08:00
Adrian Sampson
f68dc4652a Fix a typo 2015-11-17 13:14:15 -08:00
Adrian Sampson
4db91c8bd2 Fix a too-long line 2015-11-16 13:03:50 -08:00
Adrian Sampson
f767f1c2a3 New confirmation prompt
We now ask for a trinary edit/apply/cancel confirmation *after* showing the
updates. This lets you decide whether you're done based on a "preview" of the
changes and keep editing if they don't look right.
2015-11-16 13:01:24 -08:00
Adrian Sampson
d87a747477 Condense edit plugin documentation
Also avoided adding some unused command-line options.
2015-11-16 12:43:59 -08:00
Adrian Sampson
c679e3f307 Merge branch 'editor' of github.com:sampsyo/beets into editor 2015-11-16 12:28:35 -08:00
Adrian Sampson
feabf1a6ef Offer a chance to fix YAML parse errors
An alternative to 749ef85638 by @jmwatte.
2015-11-16 12:27:32 -08:00
jmwatte
bb39cd509d cleaned up edit.rst 2015-11-16 10:37:38 -08:00
Diego Moreda
917628340e edit: save only items with changes
* Modify save_write() so only the items that do have pending changes (ie. dirty
items) are saved to the database.
2015-11-16 14:48:05 +01:00
Adrian Sampson
cfba04bc9d Don't ask for confirmation if nothing changed 2015-11-14 14:58:53 -08:00
Adrian Sampson
80facbab6f More robust forbidden-change detection 2015-11-14 14:57:32 -08:00
Adrian Sampson
1c44969255 Simplify interfaces and add docs 2015-11-14 14:50:24 -08:00
Adrian Sampson
eb1bb132b1 Simplify metadata application 2015-11-14 14:48:10 -08:00
Adrian Sampson
58205e1bef Simplify data filtering 2015-11-14 14:33:04 -08:00
Adrian Sampson
029915814b Abort if nothing changed 2015-11-14 14:28:00 -08:00
Adrian Sampson
5096653483 Simpler serialization
Just use a dictionary instead of a list of tiny one-key dictionaries. Still
need to update the deserialization.
2015-11-14 14:23:57 -08:00
Adrian Sampson
9848b51008 Simplify field selection 2015-11-14 14:19:09 -08:00
Adrian Sampson
105cd73906 Start expunging opts carry-through
A dedicated command function takes care of the options and turns them into
normal variables.
2015-11-14 14:05:40 -08:00
Adrian Sampson
3c01c49a2c Less chatty interface
Removed three prompts:
1. The "really edit?" prompt. If you don't want to edit, you can just not make
   any changes.
2. The "done?" loop. This seems unnecessary; we'll confirm afterward anyway.
3. The YAML checker. This removal could indeed make things inconvenient, since
   your changes get thrown away if you make a YAML mistake. For the moment,
   simplicity is taking priority.
2015-11-14 13:53:25 -08:00
Adrian Sampson
ce31c2df23 Remove some dead code and hoist utility functions 2015-11-14 13:43:58 -08:00
Adrian Sampson
de6813eab5 Remove vestigial editor config option
We now just use $EDITOR.
2015-11-14 13:38:41 -08:00
Adrian Sampson
b33a024549 Simplify write logic 2015-11-14 13:37:17 -08:00
Adrian Sampson
b593d01100 Use qualified names for ui utilities 2015-11-14 13:33:02 -08:00