Commit graph

694 commits

Author SHA1 Message Date
Tom Jaspers
6ed0b2e0f3 Expose an Item's filesize as a field
- Update test-case for info to make sure the item's path is pointing to an actual file.

See #1291
2015-02-02 21:52:23 +01:00
Tom Jaspers
43e9044843 Duplicate album-import summary shows old/new filesize
E.g.:
Old: 13 items, MP3, 256kbps, 44:32, 101MB
New: 13 items, MP3, 320kbps, 44:31, 128MB

Fix #1291
2015-01-31 22:11:43 +01:00
Tom Jaspers
927a53d59b Merge pull request #1281 from tomjaspers/configurable-colors
Colors are now user configurable.

Conflicts:
	beets/ui/__init__.py
	beets/ui/commands.py
2015-01-30 13:48:19 +01:00
Tom Jaspers
f483012183 Colorize is now to be called with the abstract color_name instead of the color.
E.g., `colorize('text_success', 'hello world')`

To ensure compatibility with 3rd party plugins, a valid color ('red') can still be passed,
but it will be logged.
2015-01-29 14:33:57 +01:00
Adrian Sampson
790c41a73d write: Do not try to write non-writable fields
Fix #1268.
2015-01-27 15:03:19 -08:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Bruno Cauet
4aba4320e6 Rollback ui.print_() auto-conv of args to string
Since this raises problems the best is probably to maintain the base
behaviour: expect byte strings or unicodes.
2015-01-26 23:47:12 +01:00
Bruno Cauet
4e904c78af Simplify LibModel format management
Delete `ui.format_` and then `ui.print_obj`. Simply ensure that when
there is no format it defaults to '' = default format = config option.
2015-01-26 23:09:56 +01:00
Tom Jaspers
d3fce35481 Colors are user configurable
- Colors are mapped on to a dictionary using abstract names (e.g., text_success)
- Add `colors` option under `ui` to allow users to choose their own color scheme
- Move configuration option `color` from top-level to `ui`
- Show deprecation warning if top-level `color` configuration is used (but respect it)

Fix #1238
2015-01-26 17:24:32 +01:00
Bruno Cauet
065cb59ce7 Restore show_change() logging: MatchInfo, not Item 2015-01-26 09:44:51 +01:00
Bruno Cauet
8165dec985 Delete manual formattings of album & item 2015-01-25 21:32:22 +01:00
Bruno Cauet
62cd6e37aa Update ui.print_obj_(), add ui.format_()
Code now relies on `format()` for items and albums displaying/logging.
`ui.print_()` calls `unicode()` or `str()` on the strings so for most
usages calling `ui.print_(obj)` replaces `ui.print_(obj, lib, None)`.

Where there is a special format `ui.print_(format(obj, fmt))` is fine,
but when `fmt` can be None then one has to call
`ui.print_(ui.format_(obj, fmt))` -- which is what `ui.print_obj` now
does.
2015-01-25 21:07:03 +01:00
Bruno Cauet
f263935a51 Prevent shlex.split from returning strange encodings 2015-01-20 16:57:20 +01:00
Bruno Cauet
8dd7bf0f0b unicode_literals in beets.ui and beets.autotag
Well, that was easy!
2015-01-19 17:18:50 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Adrian Sampson
6f2d9845b5 Add an assertion for summarize_items (#1232) 2015-01-17 14:20:53 -08:00
Bruno Cauet
8418fb6083 Use a standard logger for the import log
The import log now relies on a standard logger, named 'beets.importer'
and configured upon initialization of the import session.
2015-01-12 21:47:44 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
f6dc2cd81c Merge pull request #1198 from brunal/logging
Lazy {}-style logging everywhere
2015-01-05 17:34:30 -08:00
Bruno Cauet
30f158a95e Move "from beets import logging" statements
Move the import next to other beets-related imports
2015-01-05 10:05:21 +01:00
Adrian Sampson
e13e7ed727 config -e: Parse arguments in $EDITOR (fix #1200) 2015-01-04 17:46:08 -08:00
Adrian Sampson
1f3fc60bad Add missing space (fix #1199) 2015-01-04 17:35:16 -08:00
Bruno Cauet
f5c5666729 Attain pep8-cleanliness
No more E12 or E501
2015-01-04 17:29:31 +01:00
Bruno Cauet
7df8bef8b7 Update logging imports: logging → beets.logging 2015-01-04 17:02:27 +01:00
Bruno Cauet
e75f9a703d Convert beets core to lazy logging 2015-01-04 17:02:27 +01:00
Adrian Sampson
a892128996 Changelog and rewording for import --pretend
(#1162)
2014-12-23 09:10:28 -05:00
Malte Ried
440fe9a2ea Reduced the count of accesses of the pretend config option. Now it's only one place where it is read.
Changed the output to use the log system rather than print_.
2014-12-21 21:37:44 +01:00
Malte Ried
2db346388a Added option --pretend to only print the filenames of files to import without importing them 2014-12-21 15:56:56 +01:00
Thomas Scholtes
a5f097a883 Allow invalid configuration files to be edited
Fixes #1123.
2014-12-01 13:02:21 +01:00
Adrian Sampson
14b150090e Fix #1124: avoid crash when deleting fields 2014-11-30 11:42:40 -08:00
Adrian Sampson
2343387a68 beet stats output clarification (#1052)
Explicitly say that size calculation is approximate.
2014-11-01 12:46:14 -07:00
Adrian Sampson
44ff3f782a Remove prefix diff highlighting
This was well-intentioned but ended up being more confusing than it was worth.
It's always confused me when one digit gets un-highlighted in one of these
displays. The straw that broke the camel's back was when I got a "#1 -> #16"
change where the numeral "1" was un-highlighted. To fix this right would be
way more trouble than it's worth; I'm glad to be rid of this detail.

Conflicts:
	docs/changelog.rst
2014-10-04 16:47:00 -07:00
Adrian Sampson
2795a01e28 Default sort configuration is global (#953)
It would be nice to cache the Sort object so we didn't have to re-parse this
every time...
2014-09-16 14:34:21 -07:00
Adrian Sampson
72436644a6 Merge pull request #909 from arogl/master
Clean up of logging messages as described here
2014-09-14 13:14:35 -07:00
Thomas Scholtes
1613a199fa Combine try_write() and store() as try_sync()
This makes sure we store the updated file `mtime`. By providing the
same interface on `Album` and `item` we can also reduce some code
duplication in the `modify` command.
2014-09-14 14:44:32 +02:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
d3386df056 Merge remote-tracking branch 'origin/master'
Conflicts:
	beets/importer.py
	beets/ui/commands.py
	beetsplug/lyrics.py
2014-09-09 12:05:38 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
816e4fb152 clean up after rebase 2014-09-09 11:53:44 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
2100dab379 displayable_path clean up error 2014-09-09 11:31:45 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
65de93941d flake8 cleanup
Cleanup after cleanup
2014-09-09 11:28:43 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
66aee8094f Clean up of logging messages as described here
All logging now prefers the ' (single quote) over the " (double quote)

https://github.com/sampsyo/beets/wiki/Hacking
2014-09-09 11:28:43 +10:00
Adrian Sampson
b227aabfee Merge pull request #917 from geigerzaehler/stats
Improvements for stats command
2014-08-25 08:44:55 -07:00
Thomas Scholtes
6d67365df6 PEP8 fix 2014-08-25 17:17:02 +02:00
Thomas Scholtes
9f4b3b811d Refactor modfiy command and tests
Parsing of the modify command line is handled by `modfiy_parse_args()`.
Test use the command line.
2014-08-25 15:46:57 +02:00
Thomas Scholtes
2d2c84b505 Stats only count albums in the database
Items might have the `album` field set without belonging to an album in
the beets database. We only count the albums that are represented in
the database.
2014-08-25 11:34:40 +02:00
Thomas Scholtes
9e2b6d0253 Show album artist stats
See #855
2014-08-25 11:33:10 +02:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
5f5ee40172 displayable_path clean up error 2014-08-23 12:17:24 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
89c5448ef5 flake8 cleanup
Cleanup after cleanup
2014-08-23 11:26:44 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
bd3f1ca5c0 Merge branch 'master' of https://github.com/sampsyo/beets 2014-08-23 11:00:23 +10:00
e5e4eaeacd39c5cfba4d7c852c48277ae50331e6
a8daba2a75 Clean up of logging messages as described here
All logging now prefers the ' (single quote) over the " (double quote)

https://github.com/sampsyo/beets/wiki/Hacking
2014-08-23 09:26:34 +10:00
Adrian Sampson
eb579cf14b Merge pull request #823 from PierreRust/sortquery
Sorting support in beets query mecanism (dbcore)
2014-08-22 14:59:44 -07:00
Harry Khanna
4944686090 Change flag from --always to --force for symmetry with other beets commands 2014-08-19 14:07:17 -04:00
Harry Khanna
2ffd3e287f Add --always flag for write subcommand
Forces a write of tags to file even if the file's tags match the database.
This is useful to force plugins that respond to write (e.g., Scrub and Zero) to run on those tags.
This may also make the TODO comment in zero.py less important since creates a way to manually run the zero plugin on a file imported as-is.
2014-08-19 13:43:16 -04:00
Adrian Sampson
a45415fd77 Duplicate summaries work with singletons (#900) 2014-08-18 22:07:50 -07:00
Adrian Sampson
0ec285f96c Formatting and style refinements for #900 2014-08-18 21:37:13 -07:00
Howard Jones
4aa783f09d Final reshuffle to put summarize_items in beets.ui
Also improved duration display.
2014-08-18 12:21:45 +01:00
Howard Jones
3ec7426a35 Pass found duplicates between task and session 2014-08-18 10:35:01 +01:00
Howard Jones
a15cf2b001 Moved summarize_items to utils. Cleaned up output
Output now uses K for bitrate.
summarize function now in util
2014-08-18 08:57:59 +01:00
Howard Jones
4bf07aa8a6 Changed to not require collections
collections library is only available in Py 2.7+
2014-08-17 19:11:01 +01:00
Howard Jones
af347d957e Basic summary information for duplicates
Added a one-line summary of each album (in lib, and import target) so
you can easily tell if (for example) you are about to overwrite your
FLAC copy with a low-bitrate mp3 from somewhere else.
2014-08-17 18:53:02 +01:00
Thomas Scholtes
dc53f7907a Fix completion script 2014-07-08 17:52:46 +02:00
Thomas Scholtes
d2e848f75c Refactor help command and cli parsers
* Control flow and implementation of help command is now
  similar to the other commands.
* Simplifies and flattens some code and removes unused method.
* Makes SubcommandOptionParser agnostic of Subcommand.parser.
2014-07-08 17:10:39 +02:00
Pierre Rust
ebd2da14dc Fix error on default sort configuration
Fix crash when using several criteria for default sort in the
configuration file.
2014-06-15 22:32:25 +02:00
Pierre Rust
86c34f8740 Moves default sort specification from code to conf
Default sort order can be set in configuration file with the
`sort_album` and `sort_item` keys.
2014-06-15 22:32:25 +02:00
Heinz Wiesinger
d36b54cd56 Make beet write not show item names for items without changes. 2014-06-09 13:27:10 +02:00
Adrian Sampson
30c5f4ddf4 Changelog for #810 (fix #320) 2014-06-08 17:27:06 +01:00
Bruno Cauet
f40517b09e Show file path when deleting items
Using `beets remove -d <target>" now shows the file path when asking for
confirmation.

The format string is '$path - $title'.

Fix issue #320.
2014-06-08 17:22:15 +02:00
Adrian Sampson
e9355f336b Rename remove_duplicates and do_remove_duplicates 2014-04-26 20:21:20 -07:00
Thomas Scholtes
8fc9f3463f Add more paths to search for bash completion 2014-04-17 13:39:06 +02:00
Thomas Scholtes
151b451c33 Add more paths to search for bash completion 2014-04-16 23:53:45 +02:00
Adrian Sampson
033cf9ec21 spell check 2014-04-15 21:17:23 -07:00
Adrian Sampson
4e227d66a3 tiny indentation fix 2014-04-14 12:34:01 -07:00
Adrian Sampson
fcb55145e6 standardize placement of command setup
This groups together all of the optparse setup calls separately from the
functions. This comes at the expense of showing the command-line options above
the code that interprets them.

Making me wish for a more declarative CLI setup style...
2014-04-14 12:11:49 -07:00
Adrian Sampson
03bea61ac0 commands.py is flake8-clean 2014-04-14 10:53:32 -07:00
Adrian Sampson
fc143ecd54 changelog & style tweaks for #686 2014-04-14 10:43:09 -07:00
Mook
12a5215afa beet modify: Add simple argument parsing tests. 2014-04-13 21:24:45 -07:00
Mook
52d0c19fb7 beet modify: Treat arguments with : before = as queries, not modifications
This can be useful if the value being queried contains an equal sign.
2014-04-13 19:41:22 -07:00
Thomas Scholtes
1df6303222 Notify user when moving files 2014-04-13 13:18:41 +02:00
Adrian Sampson
4c9daa12cc Merge pull request #676 from geigerzaehler/item-try-write
Add item.try_write() to log errors
2014-04-10 11:33:06 -07:00
Thomas Scholtes
5d753b4f38 Remove ALBUM_* constants. Closes #650 2014-04-10 17:44:39 +02:00
Thomas Scholtes
f6f974ec87 Remove ITEM_* constants
We might consider renaming `Item._fields` to `Item.fields` since other parts of
beets use it as a replacement for `ITEM_KEYS`.

See also #650.
2014-04-10 17:11:21 +02:00
Thomas Scholtes
c3ea1ded30 Add item.try_write() to log errors
Many commands and plugins use `item.write()` to update tags. Since the success
of the call is not critical to the functionality of most consumers we want to
catch any exceptions, log an error and continue with our task. The new method
encapsulates this logic.

This fixes #675.
2014-04-10 15:26:05 +02:00
Adrian Sampson
323be89d4d fold OrderedEnum into autotag module
This puts the OrderedEnum generic class next to where it is actually used. It
also refers to the recipe it is taken from on docs.python.org. I also took the
opportunity to give this a capitalized name (since it's a proper type).
2014-04-08 17:10:50 -07:00
Adrian Sampson
b3f31cbc0a rename Item.media_fields to _media_fields
Following the convention of the other field sets and such. This helps avoid
any confusion with user-specified fields (although it's unlikely people will
want to name a flexible field "media_fields" :).
2014-04-07 20:21:20 -07:00
Adrian Sampson
c6451cfc50 write: fix undefined reference to MediaFile 2014-04-07 19:44:21 -07:00
Adrian Sampson
28556a0c37 catch ReadError when calling item.read() 2014-04-07 19:42:54 -07:00
Thomas Scholtes
55e5381bbd Merge branch 'extendable-mediafile'
Conflicts:
	beets/library.py
	docs/dev/plugins.rst
2014-04-07 23:49:29 +02:00
Thomas Scholtes
4b1a1e3d65 Remove ITEM_KEYS_WRITABLE 2014-04-04 00:03:40 +02:00
Thomas Scholtes
3c7dd13b72 Add Item.media_fields
This new property controls which fields to read from a media file.
2014-04-03 23:35:33 +02:00
Adrian Sampson
ac99622ec7 Merge branch 'single-files'
Conflicts:
	docs/changelog.rst
2014-04-03 13:20:53 -07:00
Adrian Sampson
b683f239f0 some style tweaks for #638 2014-04-02 21:18:41 -07:00
Adrian Sampson
c9141a6adf import single files and one-track albums
An alternate proposal for what's being discussed in #640.
2014-04-02 17:14:48 -07:00
Bruno Tournay
cd70e92b7f Modify command: ability to delete/reset an attribute (beet modify field!) 2014-04-01 22:38:33 +02:00
Adrian Sampson
05ebd6d28e FileOperationError: also include the file path
This makes the errors fully self-descriptive, which simplifies logging them as
errors (you just have to `log.error(exc)` to get a reasonable message). We
also now handle these at the top level in case someone forgets to add a
handler. But in this case, we also send the full traceback to the debug log.
2014-03-25 22:41:28 -07:00
Thomas Scholtes
574903e986 Add FileOperationError and handling in item.write() 2014-03-24 14:22:27 +01:00
Thomas Scholtes
85b16e4e3d Remove unused code 2014-03-22 13:25:25 +01:00
Thomas Scholtes
a399f294e8 Handle exceptions in item.write and use plugin abort 2014-03-22 13:25:25 +01:00
Thomas Scholtes
a744e8ea59 Fix missing import 2014-03-22 13:25:25 +01:00
Thomas Scholtes
ddf5233daa Add _item_write method and remove duplicate code 2014-03-22 13:25:25 +01:00
Thomas Scholtes
13cbcad581 Unify exception handling of item.write() in UI
Don’t abort the program when there is something wrong with the filesystem.
2014-03-22 13:25:25 +01:00
Thomas Scholtes
002d360039 Show only changed and writable values with the write command 2014-03-10 23:57:19 +01:00
Adrian Sampson
c325e1645f hide the completion command from help (#553) 2014-03-07 15:07:28 -08:00
Adrian Sampson
606444049e tiny style cleanups in built-in commands 2014-03-07 14:48:47 -08:00
Thomas Scholtes
8a5a2fcebf Merge branch 'completion'
Conflicts:
	beets/ui/commands.py
	docs/reference/cli.rst
2014-03-02 23:06:05 +01:00
Thomas Scholtes
210592a06b Use _package path instead of resource_string 2014-03-02 21:11:57 +01:00
Thomas Scholtes
c51e541ae2 Move completion_script into commands module 2014-03-02 19:59:35 +01:00
Thomas Scholtes
44c843793b Add completion of plugin commands 2014-03-02 16:18:16 +01:00
Adrian Sampson
86bf8b65ba beet config (#552): show non-existent user path
This makes sure to print out the user's configuration path location even if no
user config file exists. (This makes "BEETSCONFIG=xxx beet config -p" behave
as expected, for instance.) It's a little hacky. Does the approach make sense
to you, @geigerzaehler?
2014-02-28 14:31:38 -08:00
Adrian Sampson
3b2d51e018 backport YAML dumping from Confit (#552)
We actually added more full-blown YAML dumping to the Confit library a while
back but it looks like it never made it into beets. It offers a few benefits
over the hand-rolled flattening that the `config` command was previously
using, including printing ordered dicts in the right order. But it also
appears to have broken logic when attempting to hide defaults. I'll fix this
right quick.
2014-02-28 09:49:29 -08:00
Thomas Scholtes
5c7104adb0 Print warning last 2014-02-28 17:15:04 +01:00
Thomas Scholtes
c345df9155 Merge branch 'config_command'
Conflicts:
	beets/ui/commands.py
	docs/reference/config.rst
	test/_common.py
2014-02-28 16:50:06 +01:00
Thomas Scholtes
74cb897f79 Add warning if completion package not found 2014-02-27 18:16:02 +01:00
Thomas Scholtes
fa6f7622e0 Move completion into beets.ui package and use pkg_resources 2014-02-23 22:16:59 +01:00
Adrian Sampson
1253cb695d move show_model_changes to ui package
This makes it more naturally reusable for plugins.
2014-02-22 15:06:16 -08:00
Adrian Sampson
645279e022 remove old _showdiff
Totally replaced now, including tests! Woohoo.
2014-02-22 14:52:33 -08:00
Adrian Sampson
ace34a8654 _show_model_changes: silence by default
This lets the first line of output be suppressed (as it was previously in
update and write) when no changes at all need to be printed.
2014-02-22 14:32:34 -08:00
Adrian Sampson
1413a842f7 update: restore "deleted" indication 2014-02-22 00:51:05 -05:00
Adrian Sampson
e42fcd973c use _show_model_change in update 2014-02-22 00:41:28 -05:00
Adrian Sampson
f6c19adc55 use _show_model_changes for write command 2014-02-22 00:24:43 -05:00
Adrian Sampson
8303c71b38 robust difference display for modify
This new alternative to _showdiff takes care of formatting and is better at
highlighting differences for non-string fields. This takes care of the issue
where "True -> False" would have everything but the "e" highlighted.
2014-02-22 00:14:18 -05:00
Thomas Scholtes
14ece207c9 Add completion command
The command prints a shell script that provides completion for the `beet`
command. To test it run `eval "$(beet completion)"` in your shell.

I also included some crude testing for this. The `test/test_completion.sh`
script runs tests in a shell and exit with a non-zero status code if the tests
fail. It assumes that the completion script is already loaded in the executing
shell.

As of now the completion only works for bash 4.1 and newer.
2014-02-20 01:15:03 +01:00
Thomas Scholtes
c8e32f6bef Add config command 2014-02-18 20:56:08 +01:00
Adrian Sampson
a2075d31e5 modify: use formatted values in _showdiff()
Perhaps we should use this for other commands also. One outstanding issue is
strange highlighting (e.g., "True -> False" helpfully shows that the "e" did
not change).
2014-02-13 21:33:58 -08:00
Adrian Sampson
be31ac683a Model._parse() class method 2014-02-13 21:29:17 -08:00
Adrian Sampson
b1d70eee39 modify: remove special parsing logic
This could be nicer, but at least we now use standard type-based parsing.
2014-02-13 21:22:23 -08:00
Adrian Sampson
cb783d11c3 style and changelog for #525 2014-02-04 23:19:34 -08:00
Bruno Tournay
1f46ff4604 In beet modify: don't ask for confirmation if there is nothing to do 2014-02-03 22:17:57 +01:00
Thomas Scholtes
6a872ae560 Add --group-albums cli option 2014-02-01 15:36:11 +01:00
Thomas Scholtes
736835ce72 Rename as aLbums option (#518) 2014-02-01 12:56:17 +01:00
Adrian Sampson
5a35d93b22 tiny option-choosing fixes for #518
* 'L' check needs to be lower-case
* letter for 'More candidates' is M, not C
2014-01-31 16:57:07 -08:00
Thomas Scholtes
af522e2416 Use L as shortcut 2014-01-28 23:37:05 +01:00
Thomas Scholtes
d12a4b20da Import multiple albums from single directory
If a directory contains multiple albums we can select the ALBUMS action to group
the tracks by album artist and album name and import those seperately.
2014-01-28 23:22:00 +01:00
Adrian Sampson
8ca997bd36 avoid repeating diff check, use changed set (#511)
This way, _showdiff returns the information that _different used to provide
(since _showdiff needs to calculate it anyway). Using a `changed` set also
makes it easier to avoid unnecessary work.
2014-01-28 09:46:53 -08:00
Bruno Tournay
68bb0ca5ee Removed duplicated code: modified showdiff() so it uses also different() 2014-01-28 14:21:45 +01:00
Bruno Tournay
e7c8b16480 Removed dont_write_if_unchanged config option: now files tags are never updated unless db tags are changed (with beet modify) 2014-01-28 14:00:51 +01:00
Bruno Tournay
0889052831 Added option for not writing tags to file, when tags in db are not modified when running beet modify 2014-01-27 22:05:55 +01:00
Thomas Scholtes
1f53b658bb Use default beets logger 2014-01-20 19:25:55 +01:00
Adrian Sampson
a9faa9bf74 restore correct formatting of paths
- don't sanitize paths (this is already done separately)
- album.path (or album['path']) is now an alias for album.item_dir(), which
  restores the formatting of $path in templates
2013-12-25 00:00:12 -08:00
Adrian Sampson
314438b8fa slightly simpler "write" command (#328, #448) 2013-11-25 15:26:11 -08:00
Heinz Wiesinger
d1a7408ecf Add raw version of a write command. 2013-11-06 21:39:12 +01:00
Adrian Sampson
733c633674 clean up some string formatting 2013-10-06 10:07:28 -07:00
Adrian Sampson
6d07b7e4b5 use _dirty.discard, not _dirty.remove
In the case where the field has not actually changed, don't throw a KeyError;
just proceed silently.
2013-10-06 10:03:24 -07:00
Adrian Sampson
25b77b1518 per_disc_numbering: fix tracktotal (close #163) 2013-09-21 19:12:18 -07:00
Adrian Sampson
22d5e564c6 move move method to model objects 2013-09-16 22:12:26 -07:00
Adrian Sampson
76b1ee434e move remove method to model objects
--HG--
extra : amend_source : 31d3ccbdde816b82bb5ec943ecb870e0df699dd0
2013-09-16 21:30:55 -07:00
Adrian Sampson
267f5a9be1 link to new FAQ location 2013-09-16 20:17:03 -07:00
Adrian Sampson
c7fe017752 remove Library.{move,store} methods
These methods are now provided by LibModel, which makes dealing with items and
albums symmetric.
2013-08-21 15:34:45 -07:00
Adrian Sampson
deef7f9d20 a few more necessary album.store()s 2013-08-21 11:23:09 -07:00
Adrian Sampson
6677cea036 fix uses of item.dirty and item.record 2013-08-21 10:57:52 -07:00
Adrian Sampson
276ce14dd2 flexattrs work for Albums
A second base class, LibModel, maintains a reference to the Library and should
take care of database-related tasks like load and store. This is the beginning
of the end of the terrible incongruity between Item and Album objects (only
the latter had a library reference). More refactoring to come.

One large side effect: Album objects no longer automatically store
modifications. You have to call album.store(). Several places in the code
assume otherwise; they need cleaning up.

ResultIterator is now polymorphic (it takes a type parameter, which must be a
subclass of LibModel).
2013-08-16 18:36:30 -07:00
Adrian Sampson
1a0d9c507d drop flexattr namespaces
Namespaces were a worthy idea, but they added a lot of complexity to both the
library code itself and every client of the flexattrs interfaces. Getting rid
of them, and having one flat namespace of both traditional fields and
flexattrs, has one huge benefit: we can "promote" flexattrs to real attributes
(and vice versa) without code changes in every client.

This frees us to have a somewhat less efficient implementation of flexattrs
because we have a smooth upgrade path for making attributes more efficient via
promotion.
2013-08-16 11:18:05 -07:00
Adrian Sampson
3b9b39e5c9 merge with master 2013-08-15 18:14:33 -07:00
Adrian Sampson
d32e13a63e show data URL for track matches
That should be the last one.
2013-06-12 16:42:15 -07:00
Adrian Sampson
829626d757 show penalties/disambig in track listing
This is the second step in bringing parity between the album and item
displays. Fortunately, we get to reuse most of the code.
2013-06-12 16:39:43 -07:00
Adrian Sampson
94aebd6bca show penalties and disambig for tracks
This makes the UI for track match display match that for album display.
2013-06-12 16:31:42 -07:00
Adrian Sampson
7983c94ef8 add keys() method to Distance 2013-06-10 15:40:51 -07:00
Adrian Sampson
c818663539 replace Distance.sorted() with .items()
This is an effort to make the distance object feel slightly more dict-like.
The name changed and order of tuples is reversed: we now yield (key, value)
instead of (value, key), which I think is a little more intuitive.
2013-06-10 15:31:25 -07:00
Tai Lee
5ce996df0d Revert "Don't bypass candidate selection in timid mode. Always show all candidates."
This reverts commit b02974f68f.
2013-06-06 10:18:01 +10:00
Tai Lee
ea1becfea1 Add Distance.__iter__() and Distance.__len__(), for convenience. 2013-06-06 09:51:17 +10:00
Tai Lee
b02974f68f Don't bypass candidate selection in timid mode. Always show all candidates.
Saves paranoid and interested users from having to either force all max
recommendations to none or constantly go back to candidate selection
from a recommendation to see if there is another slightly less similar
but more preferred (by the user) candidate.
2013-06-03 01:20:32 +10:00
Tai Lee
461c3c047c Colour benign track index changes in light gray, consistent with non-penalty supplementary information. 2013-06-03 00:46:40 +10:00
Tai Lee
ad52ede736 Code style. Use "_" when expanding variables we don't need. 2013-06-03 00:36:01 +10:00
Tai Lee
809ea8c7f9 Exclude zero value penalties from Distance.sorted. 2013-06-03 00:20:19 +10:00
Tai Lee
f6492e68ee Doc string update. 2013-06-02 23:16:28 +10:00
Tai Lee
e6ac8e1646 Use a Distance object instead of floats for distance calculations.
The new Distance object knows how to perform various types of distance
calculations (expression, equality, number, priority, string).

It will keep track of each individual penalty that has been applied so
that we can utilise that information in the UI and when making decisions
about the recommendation level.

We now display the top 3 penalties (sorted by weight) on the release
list (and "..." if there are more than 3), and we display all penalties
on the album info line and track change line.

The implementation of the `max_rec` setting has been simplified by
removing duplicate validation and instead looking at the penalties that
have been applied to a distance. As a result, we can now configure a
maximum recommendation for any penalty that might be applied.

We have a few new checks when calculating album distance:

`match: preferred: countries` and `match: preferred: media` can each be
set to a list of countries and media in order of your preference. These
are empty by default. A value that matches the first item will have no
penalty, and a value that doesn't match any item will have an unweighted
penalty of 1.0.

If `match: preferred: original_year` is set to "yes", beets will apply
an unweighted penalty of 1.0 for each year of difference between the
release year and the original year.

We now configure individual weights for `mediums` (disctotal), `label`,
`catalognum`, `country` and `albumdisambig` instead of a single generic
`minor` weight. This gives more control, but more importantly separates
and names the applied penalties so that the UI can convey exactly which
fields have contributed to the overall distance penalty.

Likewise, `missing tracks` and `unmatched tracks` are penalised and
displayed in the UI separately, instead of a combined `partial` penalty.

Display non-MusicBrainz source in the disambiguation string, and
"source" in the list of penalties if a release is penalised for being
a non-MusicBrainz.
2013-06-02 18:25:10 +10:00
Tai Lee
0a448a2380 Display album disambiguation information in order of common importance. Media, year, country, label, albumdisambig. 2013-05-30 23:28:33 +10:00
Adrian Sampson
303cd9ba00 Merge pull request #291 from jbaiter/discogs_albumid
Support for manually entered IDs in plugins
2013-05-29 14:43:59 -07:00
Adrian Sampson
a0cb31956d distinguish Album and Item template fields
An earlier change (due to @pedros) added the ability for plugins to define
template fields that work with Albums as well as Items. This enables some
cool new use cases but required that every template field definition check the
type of its arguments. Instead, this iteration on the idea distinguishes
between fields meant for Items and those meant for Albums.

In addition to simplifying the implementation of these functions, this also
enables the creation of album fields with identical names to item fields.
(For example, a user contacted me recently about adding a $bitrate field for
albums, which would be the average bitrate of the items. They can do this now
using a plugin.)

I also changed the docs to stop using the decorator approach to registering
template fields. We're moving toward removing those.
2013-05-28 22:30:23 -07:00
Adrian Sampson
6334f4d1a5 refinements to artpath modification patch
That's 371cc72f2d09 in hg. This makes the patch slightly more general by
reusing our type conversion infrastructure. It also uses "bytes" as a synonym
for "str" that I find a little bit clearer.
2013-05-28 21:41:03 -07:00
Johannes Baiter
a82e3f9f52 Delegate album_for_id to plugins if no MusicBrainz match is found 2013-05-28 12:57:02 +02:00
Lucas Duailibe
87dedaafad Fixes a bug when trying to modify the artpath with special characters
Basically, it uses the helpers that handle conversion bytestring <-> unicode with the item's path, but weren't being used with artpath. For now, it just fixes the behavior for `modify`
2013-05-27 02:06:27 -03:00
Tai Lee
29546fda5f Add missing import. 2013-05-27 01:34:22 +10:00
Tai Lee
e040ad5b21 Display hidden penalties (artist, ID) in red instead of light grey on track list.
It's a impacting the similarity, so it should probably be a warning
colour for consistency.
2013-05-25 02:13:37 +10:00
Tai Lee
891efaeee1 Fix a bug where track number could be half red and half yellow. 2013-05-25 01:28:29 +10:00
Tai Lee
c99280ea95 Improved display of missing and unmatched tracks.
Display similar title lines for missing and unmatched tracks, to
separate them from matched tracks. When media numbers or titles are
shown, it looks like missing tracks are grouped under the last media.

With missing and unmatched tracks grouped under a heading now, we don't
need to display "missing track" or "unmatched track" on every line,
making it easier to read the track titles.

Change the prefix from " * " (same as matched tracks) to " ! " for
missing and " ? " for unmatched tracks.

Consistently format track index for both missing and unmatched tracks.
Previously we were omitting the # for missing tracks (compared to
matched tracks), and we were just showing the index (no # or media
number) for unmatched tracks.

Also display track length, if available.
2013-05-25 01:26:06 +10:00
Tai Lee
b46e905a9c Display disc/media number and title (if available) in track list.
This necessitated a slight tweaking of the line printing code so that
the " * " prefix is not hard coded for all lines. The prefix is now
included in the `lhs` part of lines that actually need it, and this
allows us to alter or omit the prefix for individual lines.
2013-05-25 01:17:23 +10:00
Tai Lee
0c608a2e19 Display partial match text before source text. It's a warning with penalty, so probably more important than the data source. 2013-05-25 01:04:13 +10:00
Tai Lee
ceec9afb60 Use turquoise instead of yellow for data source. It's not a warning or penalty, and is easier to distinguish from the partial match string. 2013-05-25 01:03:01 +10:00
Tai Lee
7f068a8c03 Add AlbumInfo.data_url property, populate it for Discogs matches and display it when it is non-empty.
Makes it easier for people to find the best Discogs (or other) match
and import it to Music Brainz using a grease monkey or similar script.
2013-05-24 22:50:14 +10:00
Tai Lee
34faebfbdb Display "artist" and/or "ID" on RHS of track list in light gray when a penalty has been applied. 2013-05-24 14:42:00 +10:00
Tai Lee
1f7a782c01 Display source in release listing (yellow), if other than MusicBrainz. 2013-05-24 13:26:06 +10:00
Tai Lee
fd20e419d6 Display constant data first (similarity) followed by optional data (partial match, disambiguation). Use consistent and colorized parenthesis for optional data. 2013-05-23 17:58:04 +10:00
Tai Lee
e12093e46c Display each part of info line in parenthesis. Source and disambiguation info are conditional. 2013-05-23 17:58:04 +10:00
Tai Lee
2420c3de66 Colorize parenthesis around partial match message. 2013-05-23 17:58:04 +10:00
Tai Lee
7672fafc7e Colorize benign track index changes (to/from per disc numbering) in yellow. 2013-05-23 17:58:04 +10:00
Tai Lee
a2942895cc Display album ambiguation on info line (after similarity and source). Colorise disambiguation light grey for subtle distinction from album text. 2013-05-23 17:58:03 +10:00
Tai Lee
d1548c1178 Indent album title and artist when there are no changes for consistency with when there are (and easier to read?) 2013-05-23 17:58:03 +10:00
Tai Lee
2d04285ebc Don't colorise the "()" around partial match text. For consistency (and a little easier to read?) 2013-05-23 17:58:03 +10:00
Tai Lee
2fda231004 Abstract method to determine if track number has changed.
This is a little more accurate than the previous method (check if track
is in index or medium_index) by looking at the `per_disc_numbering`
setting and comparing the index or medium index accordingly.

It's also a little more accurate in the display output by diffing the
combined `disc-track` to `medium-medium_index` (if using per disc
numbering) and intelligently colorizing the either the whole track
number or just the suffix.
2013-05-23 17:58:03 +10:00
Adrian Sampson
27071a6e38 discogs: tweak colorization & installation docs
I thought having "MusicBrainz" colored green was a little distracting since
it's the common case (and universal without the discogs plugin), so this just
makes it neutral-color in that case.
2013-05-21 17:59:17 -07:00
Tai Lee
75a4171d20 Merge branch 'master' of github.com:sampsyo/beets into imenem-discogs-search
Conflicts:
	docs/changelog.rst
	docs/plugins/index.rst
2013-05-21 23:27:53 +10:00
Tai Lee
3eb6f8e5eb Add discogs plugin, which extends the autotagger to include results from the discogs database.
This is a refactor of the plugin developed by `imenem`.

- Pass `artist`, `album` and `va_likely` to `candidates()` so that
  plugins don't have to work this out from `items` all over again.
- Pass `artist` and `title` to `item_candidates()`.
- Silence spurious `urllib3` info log lines.
- Use a proper "beets" user agent with `discogs_client`.
- Remove `abstract_search` plugin. It seems unnecessary. How many
  music databases are there? How many will beets support? How much
  common code might there be between them? We can add some abstraction
  if or when more databases are supported.
- Derive more AlbumInfo and TrackInfo properties from discogs Release
  objects, especially album ID so that beets doesn't just use the first
  release and think all subsequent releases are duplicates.
- Add basic documentation, doc strings and code comments.
- Sanitise search query. Remove non-word characters and medium info that
  might filter out good search results.
- Use artist `join` strings from discogs Release object when an album
  or track has multiple artists.
- Don't rely on discogs track position, which is unreliable. But tracks
  are in order, so we can recalculate medium and medium_index as long as
  we can extract a consistent medium across tracks from the position.
- Add "various" as a known signal to indicate various artists.
- Prevent `chroma` plugin from returning a a huge track distance for any
  track that is missing an ID (e.g. all discog tracks).
- `TrackInfo.index` should be the release index (calculated by beets),
  not the medium index (derived from discogs track position).
- Add `AlbumInfo.data_source`. It's "Unknown" by default which is shown
  in red when displaying a suggested or selected match. The built in
  auto tagger sets it to "MusicBrainz" which is shown in green. Anything
  else (e.g. "Discogs") is shown in yellow.
- Remove double spaces from album titles (bad data from Discogs).
2013-05-21 21:16:52 +10:00
Adrian Sampson
916ceb4b15 changelog and tweaks for #275
I've removed the -p option. The command now always shows plugin-provided
template fields if any are available. We also avoid printing out blank lines
for plugins that don't provide fields.
2013-05-17 11:55:17 -07:00
Pedro Silva
4f5faeccac Append plugin template fields to 'beet fields' output with -p, --plugins 2013-05-15 13:41:54 +01:00
Adrian Sampson
c1815a5d72 FIELDS lists use real types instead of SQL strings
This should enable some useful simplifications down the road.
2013-05-11 16:41:04 -07:00
Adrian Sampson
6f77169ad2 itime (#264): name change
I changed the "itime" field to "added" and the %format function to %time.
2013-05-11 13:24:23 -07:00
Lucas Duailibe
4d5773c195 Support for date/time fields 2013-05-11 10:53:43 -03:00
Adrian Sampson
ba288ce604 move type conversion to commands module (#265)
This change also uses the existing str2bool utility function.
2013-05-08 22:56:27 -07:00
Adrian Sampson
bc5e045592 Merge pull request #265 from duailibe/modify
"Modify" for non-string values
2013-05-08 22:38:25 -07:00
Adrian Sampson
8d0449c23d rewrap and changelog note for #267 2013-05-08 22:31:53 -07:00
Jayme
9ed6c671fa Print number of tracks on disc to simplify the decision of switching to singleton mode 2013-05-06 18:55:06 +02:00
Lucas Duailibe
c7f4b8a095 "Modify" for non-string values
Added the possibility to modify float, integer e bool values (using explicitly true/false)
2013-05-05 20:22:38 -03:00
Lucas Duailibe
51ed0939d6 fixing things 2013-03-25 15:20:38 -03:00
Lucas Duailibe
56c53acbab human-friendly error messages (#125) 2013-03-25 11:24:42 -03:00
Adrian Sampson
d41fb7f0ea merge with master
We should work off the latest changes because of the recent changes to the
Query class hierarchy.
2013-03-16 12:50:55 -07:00
Lucas Duailibe
f6c3e4652c fix unicode error 2013-03-10 18:12:16 -03:00
Adrian Sampson
3e05d6614c get and set flexattrs with hyphen keys
Here's another little experiment: to make flexattrs a little easier to use for
end users, you can now get and set them by using 'namespace-key' as the
argument to __getattr__ or __setattr__.

For example, try:
$ beet mod foo-bar=baz
$ beet ls -f '${foo-bar}'
baz
baz
baz
...
2013-03-09 13:16:24 -08:00
Adrian Sampson
f268aae17f add --flat option to import command (GC-202) 2013-02-26 20:59:52 -08:00
Adrian Sampson
706c4fb7f6 import.detail config option (GC-263) 2013-02-26 20:36:29 -08:00
Adrian Sampson
0c487f479a remove AutotagError dead code
Another silly mistake identified by the RIT testing team.
2013-02-16 16:39:21 -08:00
Adrian Sampson
0366dc8184 fix "import -l logpath" CLI option (GC-518) 2013-02-16 14:58:53 -08:00
Adrian Sampson
151177ab95 recommendation is now a "real" enumeration 2013-02-07 17:26:58 -08:00
Adrian Sampson
67845f3fb5 use unicode for import log
We pass all the paths involved through displayable_path now.
2013-02-03 18:47:31 -08:00
Adrian Sampson
99ed9e03de rename ImportTask.path to paths (#89) 2013-02-03 11:22:27 -08:00
Tai Lee
23cd5453d9 Improved multi-disc album detection.
- Remove "part", "volume", "vol." multi-disc markers. These are often
  part of album titles, and not necessarily indicative of a multi-disc
  album. Only look for "CD X" and "disc X" (case insensitive), ignoring
  white space and other non-word characters.

- Don't only expect each disc to be in a subdirectory of a common parent
  directory, with all siblings belonging to the same release. Also match
  any consecutive siblings (even when the parent contains other albums)
  that are named with the same prefix and multi-disc marker.

- The `albums_in_dir(path)` function now always yields a list of paths
  along with each list of items. `ItemTask.path` is now always a list of
  paths.

- The `displayable_path(path)` function now accepts a list of paths, and
  will join them with "; " by default. This can be changed with the
  `separator` argument.

- The `sorted_walk()` function now does a case insensitive sort on
  directories, but still returns case sensitive results. This allows
  better multi-disc album detection.

- The `art_for_album()` function now takes a list of paths as its second
  argument, instead of a single path.
2013-02-03 23:51:31 +11:00
Adrian Sampson
5f5d3f13c5 Merge pull request #87 from pscn/master
Use release disambiguation not release-group disambiguation and more
2013-02-02 12:33:03 -08:00
Adrian Sampson
44d195a119 suffix-based colorization for numeric value diffs 2013-02-02 12:24:05 -08:00
Adrian Sampson
d050211c2c length_diff_thresh moved to config
This was previously hard-coded as 2.0 seconds, which was way too low.
2013-02-02 12:07:58 -08:00
Adrian Sampson
afd35ee17a don't colorize filenames in track diff display 2013-02-02 12:02:58 -08:00
Adrian Sampson
f54d9bc096 refactoring and commenting for legibility (#82) 2013-02-02 11:43:19 -08:00
Adrian Sampson
13c71757f2 cross-platform and error-tolerant width check (#82) 2013-02-02 11:19:23 -08:00
Tai Lee
06976bb49d De-duplicate loop functionality. One logic loop and one display loop. 2013-02-02 09:11:12 +11:00
Peter Schnebel
9fa3aa7428 Prefix media with number of media if >1 (e.g. 2xCD, 3xVinyl...)
Show MBs disambiguation if set.
2013-02-01 15:48:15 +01:00
Tai Lee
8afe1c71b1 Improved change alignment. Align "->" when possible, otherwise split across two lines. 2013-02-01 17:29:30 +11:00
Adrian Sampson
8ae40e9945 changelog and style fix for #81 2013-01-31 16:25:02 -08:00
Adrian Sampson
20dd71fcfd Merge pull request #81 from pscn/master
Show media in candidates disambiguation
2013-01-31 16:04:17 -08:00
Tai Lee
bf1edcdb71 Check none_rec_action setting instead of quiet_fallback during interactive import. 2013-01-31 23:51:51 +11:00
Adrian Sampson
1ef35f8b07 merge none_rec_action logic with quiet logic (#77)
This refactoring helps alleviate some of my own copypasta where we handle quiet
mode and its fallback. It has the added benefit of making none_rec_action work
for singletons as well as albums.
2013-01-30 21:03:05 -08:00
Adrian Sampson
521a4d1ebd Merge pull request #77 from mrmachine/none-rec-action
For matches with no recommendation, import as-is or skip automatically.
2013-01-30 20:38:12 -08:00
Adrian Sampson
ee641e9b13 default_action config option, et cetera (#76)
- Partial matches are always downgraded to a "medium" match.
- The config option, now called "default_action", lets you choose what to do
  with "medium" matches.
- Expanded the "low" recommendation level to include cases with just one
  match.
2013-01-30 20:32:37 -08:00
Adrian Sampson
00dfa33249 Merge pull request #76 from mrmachine/safer-defaults
Safer defaults
2013-01-30 19:41:24 -08:00
Adrian Sampson
486dd210ae trying out a multi-line track display (#78) 2013-01-30 19:23:53 -08:00
Peter Schnebel
a5fdf2ed4b show media in candidates disambiguation 2013-01-30 16:44:57 +01:00
Tai Lee
e7988de60b Align LHS and RHS changes. Put track/duration differences on RHS. 2013-01-29 14:40:03 +11:00
Tai Lee
25951e4d74 For matches with no recommendation, import as-is or skip automatically.
Add `import: none_rec_action` setting with a default of "ask" (current
behaviour). If set to "asis" or "skip", matches with no recommendation will be
imported as-is or skipped automatically.
2013-01-29 12:35:27 +11:00
Tai Lee
e923f673cb Safer defaults on confirmation prompts.
Remove default option and require selection on confirmation prompts for:

- Partial matches, if `import: confirm_partial` setting is "yes".
- Matches that are below the medium recommendation threshold, but above the
  gap threshold.
- Matches that have no recommendation.
- Matches other than the best and auto-suggested match.
2013-01-29 12:29:19 +11:00
Adrian Sampson
9e6b1db02d configurable match thresholds (GC-290) 2013-01-11 14:46:15 -08:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
0fdda2fe0b implicit colorization conditional
This simplifies many points in the code where the "color" option had to be
checked by centralizing these checks.
2012-12-30 17:18:14 -08:00
Adrian Sampson
392f9861e0 allow the import log path to be None 2012-12-23 18:06:55 -08:00
Adrian Sampson
3c511b9e27 rename Confit's add_args to set_args 2012-12-20 17:14:04 -08:00
Adrian Sampson
4a5594bec6 begin adding convenient plugin defaults
We need plugins to set their config values at run time instead of module import
time. That is, defaults should be put in the __init__ method. This is easy
enough, but to make it even more convenient, I added a BeetsPlugin.config
field, which is a Confit view into a subsection of the configuration named
after the plugin.
2012-12-18 20:42:42 -08:00
Adrian Sampson
e17cd6beba merge lots of work on the stable branch 2012-12-12 19:14:30 -08:00
Adrian Sampson
859268f707 decode Unicode arguments to import -L (GC-457) 2012-11-06 14:29:58 -08:00
Adrian Sampson
7158c01ff8 clean up outdated FIXMEs 2012-10-27 18:47:04 -07:00
Adrian Sampson
1de53446f8 fix outdated config references 2012-10-27 18:39:28 -07:00
Adrian Sampson
a50397f2a4 fix a few old config references in importer 2012-10-26 20:54:37 -07:00
Adrian Sampson
ac8109bb5f fix calls to _pick_format 2012-10-26 20:19:33 -07:00
Adrian Sampson
1ee304e105 remove config argument in command function sigs 2012-10-26 20:13:23 -07:00
Adrian Sampson
20d1485c90 remove some lingering ImportConfig references 2012-10-26 20:10:52 -07:00
Adrian Sampson
815fc83cb4 merge fixes and additions from master 2012-10-26 19:54:26 -07:00
Jakob Schnitzer
d6f20e91bd Speedup 'beet ls' if no format is specified 2012-10-21 13:54:24 +02:00
Adrian Sampson
91ad913399 #62: simplify list (and random) code
With the new centralized print_obj function, we can greatly simplify the code
for the list command. This necessitated a couple of additional tweaks:

- For performance reasons, print_obj can now take a compiled template. (There's
  still an issue with using the default/configured template, but we can cross
  that bridge later).
- When listing albums, $path now expands to the album's item dir. So the format
  string '$path' now exactly corresponds to passing the -p switch.

As an added bonus, we can now also reduce copypasta in the random plugin (which
behaves almost exactly the same as list).
2012-10-20 21:10:39 -07:00
Adrian Sampson
2770b7d6fc #62: move format/print utilities to beets.ui
Now that these functions are generally useful, this is the right home for them.
Plugins should also use print_obj.
2012-10-20 20:55:14 -07:00
Adrian Sampson
93a7251b57 #62: use list_format_* in non-list commands
The list_format_album and list_format_item options now *actually* affect the
display in commands other than "beet list". This replaces the -f/--format flags
-- if any users want to control this on the command line, we can reconsider this
decision.

Note that this involved passing around a "config" object, which we previously
haven't done. This seems a little bit messy, but configuration is about to
change entirely to be more like this style -- so this isn't a huge liability.
2012-10-20 20:50:03 -07:00
Adrian Sampson
3952fbec62 docs & changelog for pervasive format config (#62)
This version of the (renamed) _print_obj function uses introspection to
determine whether we're printing an Album or an Item. It's like function
overloading for Python! 😁
2012-10-20 20:29:49 -07:00
Adrian Sampson
c0a04dc788 Merge pull request #62 from mk-fg/unified_presentation_format
Unified presentation format in ui commands
2012-10-20 20:07:15 -07:00
Mike Kazantsev
037f290776 ui: add --format option to all commands that can use it 2012-10-20 23:06:58 +06:00
Mike Kazantsev
f8cf3817fc ui: use configured format when printing album/item from all commands 2012-10-20 22:58:05 +06:00
Mike Kazantsev
8b07ea157d Fix inconsistent three-space indentation 2012-10-20 21:45:14 +06:00
Jakob Schnitzer
cf32eb9532 Add --exact argument to stats 2012-10-05 20:56:09 +02:00
Adrian Sampson
009bd389e7 the ImportSession class
ImportSession will replace ImportConfig. It will have a *sane* number of fields
that are specific to the particular invocation of the importer -- e.g., lib and
paths. It also has a little bit of logic attached. Finally, it provides a method
for hooking the callbacks into the UI that is more elegant than assigning
callback functions -- OO inheritance to the rescue!
2012-09-09 23:06:57 -07:00
Adrian Sampson
75d43270e8 begin moving importer/autotagger to confit 2012-09-09 22:30:48 -07:00
Adrian Sampson
9d2511546b eradicate config_val from most built-in commands 2012-08-31 18:37:31 -07:00
Adrian Sampson
8bc563fafc confit: fix unicode and numeric validation 2012-08-30 23:00:01 -07:00
Adrian Sampson
fe2a68722f add Confit and start config changeover
This adds a snapshot of the current Confit source (not a crime because Confit is
currently unreleased). It also changes around the bootstrapping mechanisms
enough to let "beet ls" run with the new Confit-based configuration. There's
much more to do.
2012-08-30 17:04:44 -07:00
Adrian Sampson
b20367dd41 import: allow relative paths on Windows 2012-07-17 12:00:27 -07:00
Adrian Sampson
ce166004cb use AlbumMatch/TrackMatch objects everywhere
This allows matches to indicate both missing and unmatched tracks in their
candidates and solves some of the spaghetti tuples that were passed around
during autotagging.
2012-07-01 16:33:48 -07:00
Adrian Sampson
38b404240d merge 2012-06-29 15:27:05 -07:00
Adrian Sampson
b3e5dcd7c0 respect per_disc_numbering in missing tracks 2012-06-29 15:26:47 -07:00
Adrian Sampson
042f97f08f use TrackInfo.index in difference display
Again, enumerate() has been obviated by this addition.
2012-06-29 15:22:23 -07:00
Adrian Sampson
11d4fb1abb move album art fetching to a plugin (fetchart) 2012-06-24 00:34:50 -07:00
Adrian Sampson
7e6e5e5dca nicer error message when stdin is EOF'd 2012-06-21 17:37:45 -07:00
Adrian Sampson
bfa3c5c806 length differences now shown as "X vs. Y"
Previously, they would be shown as "X -> Y", which made multiple users think
that beets was doing something to change the length of the track.
2012-05-30 16:44:20 -07:00
Adrian Sampson
2ede4b3ec7 show per-disc numbers in change preview (GC-335) 2012-05-19 11:30:00 -07:00
Adrian Sampson
427e2017d6 don't display difference when medium index matches
Regarding GC-335, the difference display was confusing when the track indices
were correct but used a per-disc numbering scheme.
2012-05-19 11:06:47 -07:00
Adrian Sampson
2b000c47a2 per_disc_numbering config option (GC-335) 2012-05-17 12:44:48 -07:00
Adrian Sampson
9979c5a826 separate config options for item and album formats
Extends GC-362 (GH-38) to use two different config options: one for albums and
one for items.
2012-05-16 17:01:14 -07:00
Fabrice Laporte
42c51294d6 Merge pull request #38 from KraYmer/master
Issue 362: Make the default template string for the list command configurable
2012-05-16 15:59:22 -07:00
kraymer
81fc626ba7 Issue 362:Make the default template string for the list command configurable. 2012-05-17 00:48:55 +02:00
Adrian Sampson
429af42e14 use print_function __future__ import
All code should now use Python 3-style "print"s.
2012-05-13 21:08:27 -07:00
Adrian Sampson
f6b37d2c8c remove with_statement __future__ imports
This is the first of several commits that will modernize the beets codebase for
Python 2.6 conventions. (Compatibility with Python 2.5 is hereby abandoned.)
2012-05-13 20:39:07 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
6ce08c4ce6 merge 2012-05-08 11:59:41 -07:00
Adrian Sampson
f0ae35bc4a Python 2.6 on TravisCI 2012-05-08 11:59:10 -07:00
Adrian Sampson
a28f930c52 transaction objects to control DB access
In an attempt to finally address the longstanding SQLite locking issues, I'm
introducing a way to explicitly, lexically scope transactions. The Transaction
class is a context manager that always fully fetches after SELECTs and
automatically commits on exit. No direct access to the library is allowed, so
all changes will eventually be committed and all queries will be completed. This
will also provide a debugging mechanism to show where concurrent transactions
are beginning and ending.

To support composition (transaction reentrancy), an internal, per-Library stack
of transactions is maintained. Commits only happen when the outermost
transaction exits. This means that, while it's possible to introduce atomicity
bugs by invoking Library methods outside of a transaction, you can conveniently
call them *without* a currently-active transaction to get a single atomic
action.

Note that this "transaction stack" concepts assumes a single Library object per
thread. Because we need to duplicate Library objects for concurrent access due
to sqlite3 limitation already, this is fine for now. Later, the interface should
provide one transaction stack per thread for shared Library objects.
2012-05-06 23:24:05 -07:00
Adrian Sampson
a2c12dc78f -c CLI option overrides import_move config option 2012-05-03 17:19:28 -07:00
Adrian Sampson
1ee07e116e flexible -f templates for album listings (and rdm) 2012-04-30 22:59:17 -07:00
Adrian Sampson
ef45461cf9 evaluate_template is now a method on Item 2012-04-30 21:40:02 -07:00
Adrian Sampson
792c5b5e5d cleanup and docs for -f option flexibility 2012-04-30 21:26:49 -07:00
Steve Dougherty
c93e7e443e Run functions and substitute fields in list format strings. 2012-04-29 11:11:57 -04:00
Adrian Sampson
a64dea25b2 docs for @djrtl's changes (#30) 2012-04-15 14:24:52 -07:00
Matteo Mecucci
594dca3529 Added the shortcut -I for --no-incremental. 2012-04-15 19:10:52 +02:00
Matteo Mecucci
2a76a60794 Added --no-incremental option to beet import. 2012-04-15 17:05:30 +02:00
Matteo Mecucci
1ebe1cf728 Added fields command to output a list of available fields for queries and format strings. 2012-04-15 16:57:44 +02:00
Adrian Sampson
6b696c842f cleanup and docs for import_move (GH-26, GC-266)
- Copying and moving are mutually exclusive. Moving overrides copying so the
  user only has to add one line ("import_move: true") to disable copying and
  enable moving in its place.
- Deleting is only possible when copying.
- Deprecating the "delete" option (moving is almost always better).
- Removed command-line switch for moving. It's somewhat "unsafe", so this
  removes some potential for accidental irreversible changes.
- Changelog & thanks.
- Update docs to refer to import_move instead of import_delete as the
  correct solution for ending up with only one copy of the file.
2012-04-10 13:41:24 -07:00
Adrian Sampson
d256aeb436 Merge pull request #26 from iElectric/master
import_move: move files (instead of copying & deleting)
2012-04-10 13:02:30 -07:00
Adrian Sampson
9c05f0ab7b link to FAQ on no match (GH-27) 2012-04-10 12:33:16 -07:00
Domen Kožar
1af4f86c17 support move action when importing 2012-04-05 01:14:17 +02:00
Adrian Sampson
037f751e23 display track count for failed album matches 2012-03-27 10:24:27 -07:00
Adrian Sampson
34ec25e642 appropriate logging for duplicate resolution 2012-03-20 13:13:52 -07:00