Commit graph

84 commits

Author SHA1 Message Date
Šarūnas Nejus
4a361bd501
Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
Šarūnas Nejus
afe97cf31e
Do not assign args to query 2025-07-08 11:37:34 +01:00
Šarūnas Nejus
7cada1c9f8
Remove no-op decargs 2025-07-08 11:37:33 +01:00
Sebastian Mohr
68acaa6470 Renamed all action occurrences with Action. 2025-05-13 13:01:46 +02:00
Šarūnas Nejus
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Leet
eea7c19abc Use gender-neutral language 2023-10-23 17:41:38 -04:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
wisp3rwind
a84b3542f9 typing: corrections for dbcore/types.py
tricky...
- the only way I found to express the concept of the "associated type"
  (in Rust lingo) model_type was by making Type generic over its value
  and null types.
- in addition, the class hierarchy of Integer and Float types had to be
  modified, since previously some of them would have conflicting null
  types relative to their super class (this required a change to the
  edit plugin; hopefully no more breakage is caused by these changes)
- don't import the query module, but only the relevant Query's to avoid
  confusing the module query and the class variable query
2023-06-24 11:51:00 +02:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Adrian Sampson
2f5f9ea174
Remove shlex_split utility
This works around a bug that does not exist in Python 3.x, and the
workaround (by calling the underlying shlex.split function with bytes)
was causing crashes on some versions of Python 3. Seemed to work fine on
3.10-dev, though, oddly.
2021-08-19 17:14:16 -04:00
Adrian Sampson
75c41c0546
Remove most six.PY2 checks 2021-08-19 16:45:11 -04:00
Louis Sautier
4d98088cc1
Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
wordofglass
7f12cc0c88 edit, Model.copy: documentation improvements 2017-08-25 15:47:07 +02:00
wordofglass
352d99cccd edit: Do not deepcopy objects, finally fixes the regression from #2659
Deepcopying fails if a database is attached as Model._db since the
sqlite connection objects it contains are non-copyable
2017-08-24 15:03:18 +02:00
wordofglass
33f7e67943 edit: Fix a regression from #2659 when re-tagging albums 2017-08-24 13:40:50 +02:00
wordofglass
989845199b edit: Correctly reset the old object, do not reload it from the tags
Previously, if continuing to edit (i.e. invoking the $EDITOR) multiple
times in one invocation of EditPlugin.edit_objects, the plugin would
reload the old state from the file tags. The initial 'old state' is
usually only loaded from the database, though. As a consequence, if
database and tags were not in sync, the diffs from first and all
subsequent edits could differ unexpectedly.
2017-08-24 13:40:35 +02:00
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