Commit graph

1023 commits

Author SHA1 Message Date
Fabrice Laporte
9a32ed5864 add lyrics plugin unit tests file 2014-04-12 12:30:15 +02:00
Thomas Scholtes
c01fc542ed Support for initial_key with EchoNest 2014-04-11 21:03:11 +02:00
Thomas Scholtes
1670cb4565 Flake8 fixes 2014-04-11 16:05:08 +02:00
Thomas Scholtes
6705c123cf Use helper for replaygain tests 2014-04-11 15:14:13 +02:00
Thomas Scholtes
75da27729c Zero also tests deleting rg_track_gain 2014-04-11 15:12:47 +02:00
Thomas Scholtes
287428e805 Use only valid media files as fixtures 2014-04-11 00:06:59 +02:00
Thomas Scholtes
7b954d9999 Remove null normalization for replaygain.
A `None` value for replagain fields is different from a `0.0` value [1].

[1]: https://github.com/sampsyo/beets/issues/157#issuecomment-39521322
2014-04-10 22:02:24 +02:00
geigerzaehler
2be1bdeb1f Merge pull request #660 from geigerzaehler/mediafile-delete-tags
Delete and handle nonexistant tags
2014-04-10 20:35:19 +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
52dc84f43a Set literal not available in py26 2014-04-09 23:28:11 +02:00
Thomas Scholtes
a6839603cd Return None for missing tags.
Instead of returning a special "None value" if a tag does not exist, we return
none directly.
2014-04-09 23:28:11 +02:00
Thomas Scholtes
a114b67974 Remove all tags from empty.wma 2014-04-09 23:28:11 +02:00
Thomas Scholtes
663d91c4b2 Delete tags from media files 2014-04-09 23:28:11 +02:00
Thomas Scholtes
9d9f1b539f More robust tests for converted files 2014-04-09 20:41:58 +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
443b8089d5 remove unnecessary IndexableEnum
This is not really critical since list(Type)[i] works just as well. This fixes
a couple other problems from the enum transition:
- The name of TYPES was not really consistent with its new role as an enum
  type. Renamed this ImageType.
- Fix a rather egregious bug in embedart (undefined reference to Image).
2014-04-08 16:59:50 -07:00
Adrian Sampson
1eb6ccf0ab Merge pull request #642 from ktkonrad/enum34
use the new python enum instead of hand-rolled version
2014-04-08 15:24:04 -07:00
Adrian Sampson
9a21f555be MediaFile.update() no longer writes files
You now call update() followed by save(). This is mainly because the
implementation no longer performs lazy updates, so the need to pair tag
setting and writing together was diminished. Benefits in cleanliness:
- No need to duplicate the id3v2 option.
- Exception handling can be more precise.
- More closely resembles dict.update().
2014-04-07 20:34:48 -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
Thomas Scholtes
43f94ab7e6 Test convert on import 2014-04-08 01:22:02 +02: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
6eb497b21b Remove pathlib dependency 2014-04-07 18:33:12 +02:00
Thomas Scholtes
651bdf0acc Refactor convert plugin
* `encode()` raises an error when the command returns with non-zero exit
  status. We catch that in the higher-level conversion functions and skip to
  the next item without writing tags.

* Simplified the handling of the `keep_new` flag.
2014-04-07 18:24:59 +02:00
Thomas Scholtes
9d87a7fc02 Make convert --keep-new work again
Iincludes some more tests for the convert plugin. The test use the extended
TestHelper class and the new pathlib (see #621).
2014-04-07 18:07:43 +02:00
Yevgeny Bezman
2a6e5c7273 Merge branch 'replaygain-backends'
Conflicts:
	tox.ini
2014-04-06 08:45:35 +03:00
Adrian Sampson
c09bac603f dbcore: types translate null values on assignment
In preparation for #660, where we will allow MediaFile to expose None values
when tags are missing (and consume None to remove tags). This makes it
possible to hide nullness in the rest of beets by translating None to a
suitable zero-ish value on field assignment.

Types can of course opt out of this to preserve a distinct null value. We do
this now for the album_id field, which needs to be null to indicate
singletons.

Type.normalize() also enables more sophisticated translations (e.g., an
integer field could round off float values assigned into it) in the future.
2014-04-05 16:27:07 -07:00
Thomas Scholtes
0a08696add Test convert error during import
When the conversion of an audio file fails during import the original should be
imported. See #659
2014-04-05 21:09:12 +02:00
Thomas Scholtes
41708865f5 Add helper for high-level tests 2014-04-05 21:09:12 +02:00
Thomas Scholtes
6286bc0b0f Include site-packages on travis and skip tests otherwise 2014-04-04 22:43:08 +02:00
Thomas Scholtes
5b277eedf8 Add replaygain test for command backend 2014-04-04 22:42:17 +02:00
Yevgeny Bezman
b47e6dd4d4 replaygain: added a test for skipping already calculated items 2014-04-04 22:01:59 +03:00
Thomas Scholtes
5d666fa4e7 Reset config and plugins after tests 2014-04-04 19:52:39 +02:00
Thomas Scholtes
81f53fb0d2 Add basic cli tests for replaygain 2014-04-04 19:44:16 +02:00
Thomas Scholtes
4970c1de5a Add tests for item.write() custom path 2014-04-04 15:19:32 +02:00
Thomas Scholtes
e62d36aa69 Remove lazy update from MediaFile 2014-04-04 13:40:10 +02:00
Thomas Scholtes
eb4c323bcb Plugins can now extend MediaField 2014-04-04 00:48:29 +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
7f9e301428 fix tests for cached weights loading 2014-04-03 13:17:38 -07:00
Thomas Scholtes
2011156f8b Add test case for single file import 2014-04-03 22:13:31 +02:00
Kyle Konrad
7f3092ce5a four space indentation and assertGreater for __gt__ coverage 2014-04-03 12:04:51 -07:00
Thomas Scholtes
c4f0928bf5 Read custom fields into database 2014-04-03 14:01:56 +02:00
Thomas Scholtes
b262edd972 Migrate ITEM_KEYS_META 2014-04-03 14:01:56 +02:00
Thomas Scholtes
43ae730a6a Use readable_fields() to replace ITEM_KEYS_META 2014-04-03 14:01:56 +02:00
Thomas Scholtes
863b9fb4af MediaFile can be extended with custom fields 2014-04-03 14:01:55 +02:00
Thomas Scholtes
a2a8b244d7 Add LazySave tests for MediaFile 2014-04-03 14:01:55 +02:00
Thomas Scholtes
bedad53c27 Test that we can migrate ITEM_KEYS_WRITABLE
The test show that we can replace the hard-coded `ITEM_KEYS_WRITABLE` constant
with the computed value derived from `MediaField.fields()` and ITEM_KEYS. This
will be done in the next commit.
2014-04-03 14:01:55 +02:00
Thomas Scholtes
bcb72becf8 Add MediaFile.update() method to supersede save() 2014-04-03 14:01:55 +02:00
Thomas Scholtes
b026d60c31 Add MediaFile.fields() method 2014-04-03 14:01:55 +02:00
Kyle Konrad
142374925f add util test file with tests for enumerations. fix super() bug 2014-04-02 15:31:28 -07:00
Thomas Scholtes
100b3d4d65 Make mediafile tests independent of image order
For MP3s mutagen stores image tags in a hash with the `APIC:...` key. The order
of the images is therefore not well defined. A similar issue occurs with WMAs.
2014-04-02 22:15:00 +02:00
Bruno Tournay
cd70e92b7f Modify command: ability to delete/reset an attribute (beet modify field!) 2014-04-01 22:38:33 +02:00
Filipe Fortes
ea90321226 Update tests given new alias behavior 2014-03-26 13:01:42 -07:00
geigerzaehler
3ac2c7a1d7 Merge pull request #603 from geigerzaehler/write-exception-handling
Exception handling for item writes
2014-03-24 17:55:48 +01:00
Thomas Scholtes
574903e986 Add FileOperationError and handling in item.write() 2014-03-24 14:22:27 +01:00
Thomas Scholtes
d21406dcb0 Use nose to capture logs during test
Set the loglevel of beets to `DEBUG` but capture all logging statements with
nose. The logs are only printed when a test fails. This gives us more
information when tests fail while being completely silent on success.
2014-03-23 21:12:08 +01:00
Adrian Sampson
ddddbbb919 some more thorough documentation for #614 2014-03-21 17:51:50 -07:00
Adrian Sampson
3b403937d6 Merge pull request #614 from asutherland/survive-bad-dates
Return 0 dates instead of throwing on bad dates.
2014-03-21 17:43:30 -07:00
Thomas Scholtes
b131922b90 Add failing importfeed tests for albums with slashes
Isolates bug in #610
2014-03-19 17:26:11 +01:00
Andrew Sutherland
e290f8dfad Use _safe_cast to avoid dying on illegal dates. 2014-03-18 01:38:04 -04:00
Adrian Sampson
03fa8d809b tests: properly install & restore some fixtures
Brought up while investigating #612.
2014-03-15 12:30:06 -07:00
Agatha
7f19194403 Updated test_importer for Various Artists
All py.test tests should pass now
2014-03-15 14:23:27 -04:00
Thomas Scholtes
41045ec33d Remove tests for editing list of tags by reference
See discussion in #605

Commit 3000: Wooho
2014-03-12 13:35:49 +01:00
Thomas Scholtes
4c41a02c72 Changelog for 002d3600 2014-03-11 00:11:03 +01:00
Thomas Scholtes
0012ba5bd9 Prevent tests from cluttering the working directory 2014-03-11 00:03:20 +01:00
Adrian Sampson
7ddb8676c4 Merge pull request #597 from johtso/fetchart-requests-plus-useragent
Switch fetchart to requests and send user-agent
2014-03-09 11:43:51 -07:00
Thomas Scholtes
4abc849a51 Genre list support for WMA 2014-03-09 14:27:49 +01:00
Thomas Scholtes
610e4f14eb Merge branch 'image-tags'
Conflicts:
	beets/mediafile.py
2014-03-09 14:13:12 +01:00
Thomas Scholtes
0335059293 Add tiff image fixture 2014-03-09 14:09:31 +01:00
Thomas Scholtes
9fe212feea Add support for different coverart mime types 2014-03-09 13:09:26 +01:00
Thomas Scholtes
28bab0a9a3 Test invalid image format for MP4 2014-03-09 13:01:14 +01:00
Thomas Scholtes
d2b627cc1c Make sure the png_data method is available 2014-03-09 12:50:24 +01:00
Thomas Scholtes
57d7a51b5c Rename TagImage to Image 2014-03-09 12:47:38 +01:00
Thomas Scholtes
c435fd7446 Implement ImageListField for MP4 2014-03-09 12:46:51 +01:00
Johannes
3367dad0a4 Make fetchart use requests and send useragent
Closes #585
2014-03-09 09:26:30 +00:00
Thomas Scholtes
63def728dc Implement ImageListField for WMA 2014-03-09 01:48:56 +01:00
Thomas Scholtes
806d3cc6e9 Implement ImageListField for Vorbis comments 2014-03-09 00:56:44 +01:00
Thomas Scholtes
a99dea1d9b Add tests for legacy coverart tag in ogg
Added a `coverart.ogg` fixture file that contains raw image data encoded as
base64 in the COVERART tag. We test that the `art` property on mediafiles
correctly reads these tags and transforms them into METADATA_BLOCK_PICTURE tags
on write.
2014-03-09 00:38:05 +01:00
Thomas Scholtes
a11bae9386 Implement ImageListField for FLAC 2014-03-09 00:11:46 +01:00
Thomas Scholtes
4e6643a41b Remove picture from full flac fixture 2014-03-09 00:08:30 +01:00
Thomas Scholtes
ae18ea52cf Add flac fixture with images 2014-03-09 00:07:29 +01:00
Thomas Scholtes
c5c87ac46c Implement extended image lists for mediafiles.
Makes the test of 80eded77b1 work.
2014-03-08 17:27:01 +01:00
Thomas Scholtes
a9257ae57b Add image mediafile fixture 2014-03-08 17:03:43 +01:00
Thomas Scholtes
c9fc36b02e Fix mediafile image tests 2014-03-08 17:03:16 +01:00
Thomas Scholtes
80eded77b1 Add API tests for images in tags 2014-03-08 16:12:24 +01:00
Adrian Sampson
fc8325753c skip completion test if script not found 2014-03-07 14:46:09 -08:00
Thomas Scholtes
0832b9b346 Move mediafile cast logic to storage style
StorageStyle.get should return a python builtin type.
This amends 5716cd1024
2014-03-07 16:32:21 +01:00
geigerzaehler
c654df9422 Merge pull request #564 from geigerzaehler/mediafile-date
Remove date packing and invert date dependency
2014-03-07 12:11:21 +01:00
geigerzaehler
69cb44003e Merge pull request #579 from johtso/fix-safe-case-asfunicodeattribute
Fix _safe_cast of ASFUnicodeAttribute
2014-03-06 11:20:16 +01:00
Thomas Scholtes
a47f3f0a2e Add suite function to config command test module
This makes `python setup.py test` work again and fixes #576
2014-03-06 11:13:24 +01:00
Johannes
5716cd1024 Fix _safe_cast of ASFUnicodeAttribute
Fixes #578
2014-03-06 00:21:33 +00:00
Thomas Scholtes
165c28e967 Raise configuration error if BEETSDIR is file 2014-03-04 17:29:14 +01:00
Thomas Scholtes
e916609eee Save import history only when path associated
Fixes #570
2014-03-04 17:12:42 +01:00
Thomas Scholtes
f33c0bceff Remove date packing and invert date dependency
Before, each year, month, and day field used packing to store its values in the
same tag but at different positions. We then instantiated a
`CompositeDateField` to combine the different values. This lead to code
duplication in the storage styles for these fields. It also inverted the data
dependency. It's more natural to think of year, month, and day as part of a
date then as of a date as composed of these.

Now, only `DateField` class stores data in the files tag. This makes sense: One
tag, one field that accesses it. To obtain access to the year, month, and day
parts, the DateField is equipped with factories that create `DateItemField`
instances associated to a `DateField`. These descriptor allow us to get and set
parts of a date field.
2014-03-03 00:02:42 +01: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
44c843793b Add completion of plugin commands 2014-03-02 16:18:16 +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
4ca3c8764e Test mediafile with unicode strings 2014-02-28 14:04:41 +01:00
Adrian Sampson
5ccd9674a6 Merge branch 'mediafile_multiple_values' of https://github.com/geigerzaehler/beets into geigerzaehler-mediafile_multiple_values
Conflicts:
	beets/mediafile.py
2014-02-27 19:12:53 -08:00
Thomas Scholtes
2b0929b71b Complete queries 2014-02-27 22:13:09 +01:00
Thomas Scholtes
8450d51bab bash-completion package can be set by environment 2014-02-27 17:57:02 +01:00
Thomas Scholtes
996a1d6c90 Use bash-completion package 2014-02-27 17:52:23 +01:00
Thomas Scholtes
211d3ac1cb Do not evaluate in subshell 2014-02-27 15:28:16 +01:00
Thomas Scholtes
81a28198aa Test completion with clean bash instance 2014-02-27 15:09:02 +01:00
Thomas Scholtes
c73ada92c8 Ensure we go back to default path implementation
If an error is raised within the mock path context and catched upstream the
rest of the tests will run with the mocked path and fail horribly.
2014-02-23 16:38:41 +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
b383ce3450 comment out some skipped tests
The *only reason* I'm doing this is so that the unittest output looks
prettier. I am pretty sure I have actual OCD. 😳
2014-02-22 14:59:22 -08:00
Adrian Sampson
645279e022 remove old _showdiff
Totally replaced now, including tests! Woohoo.
2014-02-22 14:52:33 -08:00
Thomas Scholtes
e8e0682aae Add completion support for bash 3.2
Bash 3.2 does not have associative arrays, so we hack around that by using
generic varibale names like `opts__$cmd`. We also don't support the "?" alias
anymore.
2014-02-22 17:59:23 +01:00
Adrian Sampson
0ead6ee8cc don't relativize command-line paths (#513)
Paths given on the command line (e.g., with the --library option) need to be
relative to the working directory, not the config file.
2014-02-21 21:04:03 -05:00
Adrian Sampson
129575178c docstring/style fixups for #513 2014-02-21 20:52:21 -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
Thomas Scholtes
f1f6adcb0d Implement new configuration behaviour 2014-02-18 16:48:35 +01:00
Thomas Scholtes
d900b594be Specify configuration behaviour with tests
Beets stores all its data in the `BEETSDIR` directory. The default is
determined by the system:

* `%APPDATA%\beets` on Windows. If the `APPDATA` environment variable is
  not set it falls back to `~\AppData\Roaming\beets`.
* `$XDG_CONFIG_DIR/beets` on UNIX. If the `XDG_CONFIG_DIR` environment
  variable is not set it falls back to `~/.config/beets`
* `~/Library/Application Support/beets` on OSX

The default can be overwritten using the `BEETSDIR` environment variable.

The user configuration is read from `$BEETSDIR/config.yaml`. Additional
configuration files that overwrite options from the user configuration may
be specified using the `--config` command line options.

All relative paths in any configuration are resolved relative to `BEETSDIR`.
2014-02-18 16:48:35 +01:00
Adrian Sampson
c196f20dfc fix numeric queries over empty string (fix #547) 2014-02-17 22:51:53 -05:00
Adrian Sampson
a8ee13f16e add some failing tests for date queries 2014-02-14 23:02:51 -08:00
Adrian Sampson
be31ac683a Model._parse() class method 2014-02-13 21:29:17 -08:00
Adrian Sampson
4bb2622b9b fix testability of main entry point 2014-02-13 13:56:26 -08:00
Adrian Sampson
23fb5da1dc Revert "Replace path separators from config"
This reverts commit c82b31e750.

Conflicts:
	docs/changelog.rst
2014-02-13 13:22:45 -08:00
Thomas Scholtes
a825f8465f Remove feature for separate review 2014-02-13 15:31:08 +01:00
Thomas Scholtes
9f59592a88 Basic test cases should come first 2014-02-13 14:24:49 +01:00
Thomas Scholtes
45921cac9e StorageStyle specifies which format it can handle 2014-02-13 14:15:36 +01:00
Thomas Scholtes
1f01997141 Only write mediafiles when tags have changed 2014-02-11 15:20:44 +01:00
Thomas Scholtes
52c0e93f07 JPG image data returns correctly 2014-02-11 14:54:33 +01:00
Thomas Scholtes
49bce6276e Fix test run with setuptools 2014-02-11 13:24:47 +01:00
Thomas Scholtes
dcbf7ecc36 Fix album retrieval 2014-02-10 17:26:26 +01:00
Thomas Scholtes
a363d9672f Load plugins from cli config 2014-02-10 17:26:26 +01:00
Thomas Scholtes
5f79c54cb3 Rewrite config test to be more transparent 2014-02-10 17:26:26 +01:00
Thomas Scholtes
a43af01b6b Add storage style for MP4 images 2014-02-10 16:28:48 +01:00
Thomas Scholtes
3f988d4699 Add StorageStyle for mp3 images 2014-02-10 16:10:40 +01:00
Thomas Scholtes
581241006d Add mediafile art test 2014-02-10 15:24:57 +01:00
Thomas Scholtes
5e61db4b88 Genre list tests for more formats 2014-02-10 15:07:10 +01:00
Thomas Scholtes
1f8710f993 Genre lists for MP4 files 2014-02-10 14:34:29 +01:00
Adrian Sampson
8556de8d3a dbcore: flexattr deletion (fix #530) 2014-02-08 12:31:50 -08:00
Adrian Sampson
e609319b3d fix ihate tests 2014-02-08 12:20:25 -08:00
Adrian Sampson
fe5c175cc3 style fixes for ihate (#486) 2014-02-08 12:00:23 -08:00
BrainDamage
6836e9c725 updated iHate plugin to replace hardcoded regex system in favour of more flexible queries
changed config layout of iHate plugin to a simpler system
updated unit test for ihate plugin accordingly
updated docs for ihate plugin accordingly
2014-02-07 21:37:33 +01:00
Thomas Scholtes
c82b31e750 Replace path separators from config 2014-02-06 14:22:40 +01:00
Stig Inge Lea Bjørnsen
58924375d3 Merge pull request #521 from silb/datequery_plugin
Add a plugin for querying date fields against date intervals or instants...
2014-02-04 13:03:39 -08:00
Thomas Scholtes
6901cc96db Fix white space 2014-02-04 20:10:55 +01:00
Thomas Scholtes
b490ed7d4b Remove superfluous code 2014-02-04 20:10:55 +01:00
Thomas Scholtes
813510a50d Implement Genre list 2014-02-04 20:10:55 +01:00
Thomas Scholtes
fcf438c759 Remove duplicate tests 2014-02-04 20:10:55 +01:00
Thomas Scholtes
0411f818af Fix packaging 2014-02-04 20:10:54 +01:00
Thomas Scholtes
8e1c5e88da Include key in error message when tags do not match 2014-02-04 20:10:54 +01:00
Thomas Scholtes
9055754476 Refactor MP3TextStorageStyle 2014-02-04 20:10:54 +01:00
Thomas Scholtes
052f38e891 Use tempdir for mediafile tests 2014-02-04 20:10:54 +01:00
Thomas Scholtes
3beac05e53 Test empty mediafiles 2014-02-04 20:10:54 +01:00
Thomas Scholtes
131da9eae3 Add UFID storage style 2014-02-04 20:10:53 +01:00
Thomas Scholtes
0dd8d81e4d Tests include all file formats 2014-02-04 20:10:53 +01:00
Thomas Scholtes
f52085e994 Refactor StorageStyle packing 2014-02-04 20:10:53 +01:00
Thomas Scholtes
65e4a0f505 Add unpack method for storage style 2014-02-04 20:10:53 +01:00
Thomas Scholtes
508be8e2c6 Add MP3 StorageStyle class 2014-02-04 20:10:53 +01:00
Thomas Scholtes
da13cb1825 Refactor get/set into StorageStyle 2014-02-04 20:10:53 +01:00
Thomas Scholtes
a9ccf84b72 Extract assertTags method 2014-02-04 20:10:53 +01:00
Thomas Scholtes
484616482d Rewrite mediafile tests 2014-02-04 20:10:53 +01:00
Thomas Scholtes
2c8b435cd0 Add empty test audio files 2014-02-04 20:10:53 +01:00
Stig Inge Lea Bjørnsen
a27d83a4bf Refactor the date query from being a plugin to being part of Beets core.
Fields of the type DateType will now automatically be queried by DateQuery.
2014-02-03 18:21:23 +01:00
Thomas Scholtes
c133302e20 Fix configuration priorities (see #513) 2014-02-03 01:16:35 +01:00
Thomas Scholtes
75c3b82d88 Test and fix web /item/query/<query> 2014-02-02 19:12:10 +01:00
Thomas Scholtes
f706e58409 Web API handles multiple ids 2014-02-02 19:04:04 +01:00
Stig Inge Lea Bjørnsen
be3bcbafe6 Add a plugin for querying date fields against date intervals or instants.
The interval syntax is similar to that of NumericQuery.

Example: beet ls 'added:T2008..2010'
2014-02-02 17:17:11 +01:00
Thomas Scholtes
3361d32a76 Add AutotagStub 2014-02-01 22:55:35 +01:00
Thomas Scholtes
50e384d48a Test choosing candidates during import 2014-02-01 22:55:35 +01:00
Thomas Scholtes
ba49675252 More tests and test documentation for Importer 2014-02-01 20:05:36 +01:00
Thomas Scholtes
9e105bd09b Add tests for TerminalImportSession 2014-02-01 19:19:48 +01:00
Thomas Scholtes
fb46571bf7 Set importer choices with add_choice
We can hook into this method in the next commit
2014-02-01 19:04:24 +01:00
Thomas Scholtes
24ffd0982e Add group albums stage and configuration 2014-02-01 15:02:00 +01:00
Thomas Scholtes
565a284c03 Add pull() generator to Pipeline 2014-02-01 13:43:05 +01:00
Thomas Scholtes
a3c1b15198 Fix #514: add distance between string and None 2014-01-30 15:23:58 +01:00
Thomas Scholtes
d75f6667e1 Add --config cli option 2014-01-29 23:38: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
Thomas Scholtes
432d6f4437 Removed akward tests 2014-01-28 20:51:00 +01:00
Thomas Scholtes
81b8d44814 Migrate outside file tests 2014-01-28 20:49:02 +01:00
Thomas Scholtes
9a3963b58e Remove duplicate test
This is already tested by `ImportExistingTest.test_asis_updated_moves_file`
2014-01-28 20:28:38 +01:00
Thomas Scholtes
ae208f5f53 Use ImportSession sublass for tests 2014-01-28 20:13:02 +01:00
Thomas Scholtes
bb6adbfa11 add compilation tests 2014-01-28 20:08:42 +01:00
Thomas Scholtes
f8b899091b Migrate ApplyExistingItemsTest 2014-01-28 20:08:42 +01:00
Thomas Scholtes
aaefd023eb Extract choose tracks function 2014-01-28 20:08:42 +01:00
Thomas Scholtes
96e2d128c0 Revert old test cases 2014-01-28 20:08:42 +01:00
Thomas Scholtes
2a4c6d5bca Fixed typo makes tests pass 2014-01-28 20:08:42 +01:00
Thomas Scholtes
69a40593a0 Remove duplicate tests 2014-01-28 20:08:42 +01:00
Thomas Scholtes
910dc6a647 Add ImportCompliationTest 2014-01-28 20:08:42 +01:00
Thomas Scholtes
39f1b8c3d8 Refactor MusicBrainz stubs into helper class 2014-01-28 20:08:42 +01:00
Thomas Scholtes
9f4e227f96 More ImportTest refactoring 2014-01-28 20:08:41 +01:00
Thomas Scholtes
5535eddfaa Refactor Import Test 2014-01-28 20:08:41 +01:00
Thomas Scholtes
9b12d488e2 New Import test case 2014-01-28 20:07:20 +01:00
Thomas Scholtes
d302081cca ...and some refactoring again 2014-01-28 20:07:20 +01:00
Thomas Scholtes
bfaa56e5bd Stupid typo 2014-01-28 20:07:20 +01:00
Thomas Scholtes
42f54e36bd These tests are already in ImportNonAutotaggedTest 2014-01-28 20:07:20 +01:00
Thomas Scholtes
0cdb896003 Move prune and file tasks 2014-01-28 20:07:20 +01:00
Thomas Scholtes
33edb9a878 So this is how python works! ;) 2014-01-28 20:07:20 +01:00
Thomas Scholtes
c6654c5acf Make test strings more verbose 2014-01-28 20:07:19 +01:00
Thomas Scholtes
03f1879980 Extract library file assertions 2014-01-28 20:07:19 +01:00
Thomas Scholtes
49693f715c Use _setup_library() helper 2014-01-28 20:07:19 +01:00
Thomas Scholtes
e63ac27d1c Extract _run_import and expose config in tests 2014-01-28 20:07:19 +01:00
Thomas Scholtes
d65595c70b Extract ImportHelper for tests 2014-01-28 20:07:19 +01:00
Thomas Scholtes
f900f1e0c8 Refactor import test 2014-01-28 20:07:19 +01:00
Thomas Scholtes
117a331091 Should infer *album artist* for albums from tag 2014-01-28 15:42:50 +01:00
Adrian Sampson
f29fbe47da DBCore types: no functional-style Type constructor
This was getting more and more awkward. Also added a `parse` method (in
progress).
2014-01-26 21:12:48 -08:00
Adrian Sampson
83f981762c fix #508: crash when parsing empty query part
This is a regression created by my endeavor to have parse_query_part never
return None. Now the regular expression should really always match.
2014-01-26 10:51:58 -08:00
Adrian Sampson
f1a4ba815d fix #503: format untyped fields with bytes values 2014-01-23 15:06:24 -08:00
Thomas Scholtes
00e0664a94 Merge branch 'embedded_items_generators' 2014-01-22 12:04:41 +01:00
Adrian Sampson
7361e6b114 adjust tests to type-based formatting 2014-01-21 21:16:32 -08:00
Adrian Sampson
7aa4d1e5ba begin type-based formatting 2014-01-21 21:02:40 -08:00
Adrian Sampson
342d5e1f8b whitespace cleanup 2014-01-21 20:14:36 -08:00
Adrian Sampson
7d0dbf705a fix tests for dbcore module reorg 2014-01-21 20:04:29 -08:00
Adrian Sampson
56bb642fe8 undo dumb file renaming mistake 2014-01-21 19:40:00 -08:00
Adrian Sampson
74d0dc8352 further paramaterize parse_query_part 2014-01-21 19:09:34 -08:00
Thomas Scholtes
aa07eb9551 Load development beetsplug in tests
See also a4b6976755
2014-01-21 22:45:51 +01:00
Thomas Scholtes
83e86241b8 Add JSON-API tests 2014-01-21 22:39:48 +01:00
Adrian Sampson
28d4b9320c Merge pull request #499 from geigerzaehler/master
Make pluginpath configuration useable
2014-01-20 18:55:20 -08:00
Adrian Sampson
1cdb30fd56 remove superfluous py_type field from Type 2014-01-20 18:06:42 -08:00
Adrian Sampson
00829c1a6c use PathQueries declaratively
Now PathQuery is just another type-based query, just like NumericQuery.
2014-01-20 18:01:29 -08:00
Adrian Sampson
4026c4b707 add query field to types
This is starting to get at the heart of the matter: now each type gets to
declare which Query subclass it wants to use, starting with NumericQuery.
2014-01-20 17:47:02 -08:00
Adrian Sampson
9ee4adc5e1 move remaining generic Query types to dbcore.query
NumericQuery is still broken. This, of course, is the whole reason for the
change.
2014-01-20 16:40:50 -08:00
Adrian Sampson
61b6f04036 tests: silence logging output 2014-01-20 15:58:33 -08:00
Thomas Scholtes
a4b6976755 Make plugin path configuration useable 2014-01-20 17:39:46 +01:00
Thomas Scholtes
3b39e0f193 Test plugin commands from plugin paths 2014-01-20 17:39:46 +01:00
Thomas Scholtes
34f113bbcf Running ./setup.py test works again 2014-01-20 14:33:40 +01:00
Adrian Sampson
a0ffde7114 a bit more dbcore testing 2014-01-18 16:49:22 -08:00
Adrian Sampson
dcee7b6219 dbcore: terminology
Replace "library" and "lib" references in dbcore with "database" and "db" for
short.
2014-01-18 16:36:04 -08:00
Adrian Sampson
236de2be86 give test_db a better name: test_library 2014-01-18 16:28:17 -08:00
Adrian Sampson
72a1b9bafb add tests for dbcore
Based on the old migration tests for Library.
2014-01-18 16:27:43 -08:00
Adrian Sampson
faa66dba0d dbcore: subsume schema setup, add Type class
Type will also include fields for parsing, emitting, and querying a given
type.
2014-01-13 17:11:50 -08:00
Adrian Sampson
a9ef11c311 begin database refactor: move Model to new module 2014-01-13 14:37:04 -08:00
Adrian Sampson
cc5e3d489c item templates can use album flexattrs (fix #461) 2013-12-25 15:49:51 -08:00
Adrian Sampson
925a6178ba expunge pathmod parameter
I started using this a long time ago as a misguided attempt to make
path-related functions more testable. Harnessing is better.
2013-12-25 00:35:01 -08:00
Adrian Sampson
d6ff4308f9 fix tests for new path formatting
Slowly expunging the terrible idea that was `pathmod`...
2013-12-25 00:28:26 -08:00
Adrian Sampson
a9b4169ee2 zero out month & day when missing from match 2013-12-18 16:20:40 -08:00
Mathijs de Bruin
2bab3135b3 Fix for #411: iHate fails with singletons. 2013-11-07 13:57:25 +01:00
Adrian Sampson
24227d6ef4 mediafile: optionally save ID3v2.3 tags 2013-10-06 19:53:34 -07:00
Adrian Sampson
787918fdc3 changelog, tests, slight reorg for #187 2013-09-30 11:13:13 -07:00
Adrian Sampson
98bfbad089 test_query: use base test classes 2013-09-23 15:09:39 -07:00
Adrian Sampson
5007d1571f merge disk and memory query tests 2013-09-23 15:05:47 -07:00
Adrian Sampson
4d0db3fcb4 tests: obviate on-disk test library 2013-09-23 10:57:17 -07:00
Adrian Sampson
9993993cab add base class to DB tests 2013-09-22 17:15:47 -07:00
Adrian Sampson
25b77b1518 per_disc_numbering: fix tracktotal (close #163) 2013-09-21 19:12:18 -07:00
Adrian Sampson
dd8c667ce9 remove magic strings from Library.__init___
We now pull the table names from the models.
2013-09-17 09:13:56 -07:00
Adrian Sampson
c5032f925e move Destination method to Item class 2013-09-17 09:09:10 -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
a5422eeaf7 use track length over recording length
Closes #341. Also, 666 tests! Woohoo!

--HG--
extra : amend_source : f00626f20e2475edcf220772223080ef62f46d84
2013-09-16 17:35:22 -07:00
Adrian Sampson
bbac4ba109 numeric query tests 2013-09-16 17:19:40 -07:00
Adrian Sampson
6857267cc7 opus: remove image from test file
The encoder that produced this file for some reason included an empty image as
the cover art and was confusing the tests.

I left the null check in place to deal with this situation in the future. I
think returning None is better than returning the empty string (which is of
course not a valid image).
2013-09-12 10:16:47 -07:00
Adrian Sampson
8dc1e223e9 opus: sample rate is always 48kHz 2013-09-12 10:05:22 -07:00
Rowan Lewis
be8325dfe5 Opus now passes basic tests. 2013-09-12 08:00:28 +10:00
Rowan Lewis
6f0261e5ff Added opus support, maybe. 2013-09-12 07:17:32 +10: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
0176b9742f tests: unknown fields silently match nothing
Previously, an unknown field would be ignored. Now, they're treated as
flexattrs that just haven't been set yet (and thus always hold None).
2013-08-21 09:46:30 -07:00
Adrian Sampson
9e61e49457 fix NumericQuery constructor 2013-08-21 09:42:16 -07:00
Adrian Sampson
9609e41cf8 store albums after moving art 2013-08-21 09:25:47 -07:00
Adrian Sampson
8bcbe1dea2 fix outdated SQL query 2013-08-20 16:22:24 -07:00
Adrian Sampson
8bdf2d0efe fix dirtying when unchanged, artpath wrapping
Also some naming mistakes.
2013-08-20 16:05:45 -07:00
Adrian Sampson
4d20d3b296 album.store() now also affects tracks 2013-08-20 15:32:27 -07:00
Adrian Sampson
ec10f8c223 remove count() calls
I removed this method in an earlier commit.
2013-08-20 14:28:28 -07:00
Adrian Sampson
c1b66105dd fix regex (and other) queries in path field 2013-08-04 13:12:25 -07:00
Adrian Sampson
b1ea90a724 don't duplicate penalty names in max_rec section
This is for maintanability: in the future, when we add new distance penalty
components, now we won't have to list them twice in the default config.
2013-06-10 15:59:41 -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
Adrian Sampson
c85e43ee2a finish removing setUp from DistanceTest
I had to do this for the tests that use the config, so I thought I might as
well finish the job.
2013-06-10 15:24:25 -07:00
Adrian Sampson
f6faf72328 move Distance class to hooks module 2013-06-10 15:21:32 -07:00
Tai Lee
898254ed6a Merge branch 'master' into distance-refactor
Conflicts:
	docs/changelog.rst
2013-06-06 11:09:36 +10:00
Tai Lee
ea1becfea1 Add Distance.__iter__() and Distance.__len__(), for convenience. 2013-06-06 09:51:17 +10:00
Adrian Sampson
4e016f1913 fix MediaFile exception test 2013-06-03 13:39:52 -07:00
Tai Lee
e92b8bb8fb Fix add_priority() calculation.
We were incorrectly adding 1 to the length of options to avoid a divide
by zero, when we should instead default the length to 1. Otherwise we
skew the penalty towards zero.
2013-06-03 14:49:39 +10:00
Tai Lee
ac4e86981f Add Distance.raw_distance, to compliment max_distance. 2013-06-03 00:07:20 +10:00
Tai Lee
51f40d26dc Rename Distance.penalties to Distance._penalties. It should be private. 2013-06-03 00:04:45 +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
Adrian Sampson
cff06431cc add tests for ALAC (#295) 2013-06-01 17:44:21 -07:00
Adrian Sampson
611dc44c46 fix tests for ID parsing (#291)
The previous tests accessed the network. This refactoring lets us test the ID
parsing in isolation.
2013-05-29 14:51:16 -07: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
89e76b8e5a simplify current_metadata return value
We now just return the underlying dicts instead of an increasingly long tuple.
2013-05-28 20:51:30 -07:00
Tai Lee
a5151bb32e Look at many more metadata fields when calculating distance.
Produce slightly more varied similarity score to prioritise extremely
similar releases.
2013-05-29 10:18:55 +10:00
Johannes Baiter
ad66b8796a Fix tests for albums from manual ID 2013-05-28 13:50:20 +02:00
Tai Lee
1a4dfa0c07 Fix tests. 2013-05-25 01:58:08 +10:00
Tai Lee
dc7e98fd22 extra_items and extra_tracks on AlbumInfo are now lists, sorted by track index and title. 2013-05-25 00:44:23 +10:00
Adrian Sampson
475228a5e8 fix #281: album art filename respects replace 2013-05-19 10:34:46 -07:00
Adrian Sampson
c56ef31da0 remove art_filename Library field
This is the first of a handful of refactorings that take advantage of the new
confit system to simplify parameter passing boilerplate.
2013-05-19 10:18:41 -07:00
Adrian Sampson
4d62a83210 simplify materialization in LazyConfig 2013-05-17 19:10:44 -07:00
Adrian Sampson
42624eb745 use lazy config loader in confit
This lets you, for example, import beets in a library or the REPL and use it
immediately without calling "beets.config.read()" first.
2013-05-17 19:05:16 -07: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
Adrian Sampson
4904106a72 config option for time format string 2013-05-11 13:10:31 -07:00
Adrian Sampson
24c90b565a move time formatting to format_for_path
This is where field value transformations belong.
2013-05-11 13:06:24 -07:00
Adrian Sampson
dd00fe0cff fix stray character and tweak whitespace 2013-05-11 12:54:53 -07:00
Lucas Duailibe
c7c2b266cd correcting identation 2013-05-11 10:58:19 -03:00
Lucas Duailibe
0a631bcda2 Using time.time() to store the import time 2013-05-11 10:53:43 -03:00
Lucas Duailibe
d907dd6b40 Preliminary support for "date added" fields
This isn't yet finished, it needs some input on how to organize the data, and actually where to implement the use of this data, but it already works in setting the date
2013-05-11 10:53:43 -03:00
Adrian Sampson
8781433f59 add tests for matching floating-point ranges 2013-05-09 15:49:38 -07:00
Adrian Sampson
ea0928c845 generalize YearQuery to NumericQuery 2013-05-09 15:47:25 -07:00
Michael Schuerig
ae807bccfc Merge branch 'master' of git://github.com/sampsyo/beets 2013-05-01 14:07:05 +02:00
Adrian Sampson
374e043c3c API/test enhancements for #257
Also, `cautious` defaults to False for backwards-compatibility.
2013-04-27 16:47:42 -07:00
Fabrice Laporte
ac14b7f2fb Fix unit tests by constructing a FetchArtPlugin in the
fixture and using 'art.jpg' as default image filename so that 
'cautious' option does not interfere with the tests.
2013-04-27 12:27:04 +02:00
Michael Schuerig
c102b3be90 Add error message and test for invalid years. 2013-04-25 00:45:05 +02:00
Michael Schuerig
fe41bba380 Add a query class for years with support for ranges. 2013-04-25 00:36:21 +02:00
Adrian Sampson
ca840acd5f Merge pull request #245 from sochotnicky/master
Update mutagen dependency to 0.21
2013-04-07 11:21:24 -07:00
Adrian Sampson
963b0d11d6 fix VFS tests
The configuration was not loaded for these tests because they didn't inherit
the common test harness. These failures were hidden on my system because of
some kind of dependency on another test.
2013-04-06 16:35:17 -07:00
Stanislav Ochotnicky
1666f883e3 Fix python namespaces for test runs
We need to make sure we don't use namespaced versions that are already installed
on the system but rather use local version from current sources
2013-04-07 01:32:47 +02:00
Adrian Sampson
fe8092139b fix construction of conditional path queries
I broke this in the last flurry of refactors but, as is usually the case, I
have no idea why it ever worked before.
2013-03-14 11:05:35 -07:00
Adrian Sampson
f005ec2de0 refactor: everything is like a plugin query (#214)
The initial idea for this refactor was motivated by the need to make
PluginQuery.match() have the same method signature as the match() methods on
other queries. That is, it needed to take an *item*, not the pattern and
value. (The pattern is supplied when the query is constructed.) So it made
sense to move the value-to-pattern code to a class method.

But then I realized that all the other FieldQuery subclasses needed to do
essentially the same thing. So I eliminated PluginQuery altogether and
refactored FieldQuery to subsume its functionality. I then changed all the
other FieldQuery subclasses to conform to the same pattern.

This has the side effect of allowing different kinds of queries (even
non-field queries) down the road.
2013-03-13 22:57:20 -07:00
Philippe Mongeau
685972bbc5 update query tests
fix escape colons in the query term
2013-03-10 20:26:45 -04:00
Adrian Sampson
d71737114a format None values as the empty string
Fix due to @pscn. Includes test. Closes #108.
2013-02-28 10:00:26 -08:00
Sam Doshi
8394619b99 add unit tests for aliases (#102) 2013-02-27 09:17:42 +00:00
Adrian Sampson
4a35be5724 fix crash when RG fields set to null
In general, we convert None values to type-based nulls in packed fields just
as we do for normal fields.
2013-02-24 16:10:18 -08:00
Adrian Sampson
c2a746562a fix Sound Check decode (GC-521)
Fixes the case when the gain number is negative.
2013-02-20 22:54:57 -08:00
Adrian Sampson
a7f0ad70ae test: move DummyIO initialization to harness
This makes it much harder to accidentally leave this I/O isolator installed.
2013-02-18 18:29:10 -08:00
Adrian Sampson
6c931faf1a tests: remove ad-hoc temporary directories
Now that we have a temporary directory in the shared harness, we can dispense
with the error-prone process of creating them for each test.
2013-02-18 18:23:32 -08:00
Adrian Sampson
8b4dca99e3 towards filesystem sandboxing of tests
The generic test harness now uses a temporary directory for beets' various
files as well as $HOME. As one packager pointed out, there were various test
failures when $HOME did not exist. This is no longer the case.
2013-02-18 17:52:37 -08:00
Adrian Sampson
e0bb3b5cd0 original_{year,month,day,date} fields (GC-441) 2013-02-08 13:28:51 -08:00
Adrian Sampson
b9cb3980c2 path_sep_replace config option
I also took this opportunity to move and rename util.santize_for_path to
library.format_for_path, which was long overdue.
2013-02-08 10:51:33 -08:00
Adrian Sampson
151177ab95 recommendation is now a "real" enumeration 2013-02-07 17:26:58 -08:00
steini
10758c487f Configurable list of patterns which will be ignored when pruning empty directories.
* util.prune_dirs modified to accept glob patterns as clutter to determine emptiness.
* config option, 'clutter' (a list of filenames/glob patterns)
* ImportTask.prune passes this option's value to prune_dirs.
2013-02-04 23:41:38 +00:00
Tai Lee
d9d2ddac23 Detect false positive markers in root/parent directories.
For example, catalogue numbers like "[REACT217]". This shouldn't bypass the
nested multi-disc detection and automatically include all subdirs.

Do nested multi-disc detection first, so that `collapse_pat` is only set for
flattened albums, and we can skip the ancestry check on subsequent folders.
2013-02-04 17:04:12 +11:00
Adrian Sampson
6ff1ba0474 break up multidisc collapsing tests
Now we can see which aspect fails in bite-sized pieces.
2013-02-03 12:06:10 -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
50a89e790c both release and release group disambig (#87)
This joins the two strings with a comma if both are present.
2013-02-02 12:42:53 -08: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
Tai Lee
06976bb49d De-duplicate loop functionality. One logic loop and one display loop. 2013-02-02 09:11:12 +11:00
Peter Schnebel
663574c7ff Adapted test to pull request #87 2013-02-01 18:10:11 +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
58d9a775cc remove singleton enforcement from plugins
The plugin system itself now enforces single instances.
2013-01-31 12:13:19 -08:00
Adrian Sampson
ebdbd69d8e fix test compatibility with mutagen 1.21
The new Mutagen release got a fix for the bitrate calculation in Musepack. The
tests now reflect that.
2013-01-31 10:16:22 -08:00
Adrian Sampson
486dd210ae trying out a multi-line track display (#78) 2013-01-30 19:23:53 -08:00
Adrian Sampson
ea2e263834 Merge pull request #78 from mrmachine/align-changes
Align LHS and RHS changes. Put track/duration differences on RHS.
2013-01-30 19:11:13 -08:00
Tai Lee
a6ee1f9e80 Fix tests. 2013-01-31 13:02:27 +11:00
Adrian Sampson
c14d9e4115 fix some tags in test WMA file 2013-01-29 21:51:40 -08:00
Adrian Sampson
10dfa780d1 fix crash when WMA is missing cover art (#75) 2013-01-29 21:46:58 -08:00
Adrian Sampson
e25b2ec740 add WMA test file (#75) 2013-01-29 21:44:02 -08:00
Adrian Sampson
38dee5af0f silence Unidecode warning due to byte string info
--HG--
extra : source : 6a023b1f3ace0ae3177afb382d0eebcb445bec05
2013-01-29 11:30:31 -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
fbcd1d1c18 merge fixes from master 2012-12-19 12:22:23 -08:00
Adrian Sampson
2023344019 Windows: fix relative paths in normpath()
The changes introduced in rc1 caused paths to be syspath-ified before they were
passed to os.path.abspath. The magic prefix caused them to be interpreted as
absolute paths even if they were relative. The fix is, in this *isolated*
case, to use Unicode but prefix-free paths in calls to the os.path.* functions.
Those functions need to act on Unicode objects but seem to be purely syntactic
-- nothing is tripped up by using long filenames without the magic prefix.
2012-12-19 12:19:23 -08:00
Adrian Sampson
2c45251db9 clean configuration for testing
This way, unit tests will never see a user's global beets configuration.
2012-12-18 20:27:36 -08:00
Adrian Sampson
55cac36d35 sync with latest confit
This includes Confit's shift to using OrderedDict, which needs some debugging.
2012-12-18 20:03:52 -08:00
Adrian Sampson
85600df2be remove outdated test 2012-12-15 13:22:18 -08:00
Adrian Sampson
cbd538de7b combine TempConfigTestCase and ExtraAsserts 2012-12-15 13:21:09 -08:00
Adrian Sampson
39cd1f6c63 switch from context manager to base class
Replaced temp_config context manager with TempConfigTestCase base class. This
lets us clean up even when a test fails.
2012-12-15 13:15:10 -08:00
Adrian Sampson
3e5ef375c8 confit-ify remaining tests except for ConfigTest 2012-12-14 15:23:47 -08:00
Adrian Sampson
ed3a3d1937 confit-ify a bunch more tests 2012-12-14 14:21:06 -08:00
Adrian Sampson
6f19f466fc tests: temporarily modify global configuration 2012-12-14 13:39:14 -08:00
Adrian Sampson
e84a41b550 start fixing up tests for confit overhaul 2012-12-14 13:18:06 -08:00
Adrian Sampson
e17cd6beba merge lots of work on the stable branch 2012-12-12 19:14:30 -08:00
Adrian Sampson
c499be05ea fix some tests under PyPy
In PyPy's pure-Python implementation of the sqlite3 module, sqlite3.Row has no
__len__ method. This works around calling len(row).
2012-11-27 21:47:15 -08:00
Adrian Sampson
f06c7dfbef modernize basic MediaFile tests
These tests were written when I knew almost nothing about Python and even less
about unittest. The class-generating magic never worked with nose for a crazy
reason I won't get into here. This has a bit more copypasta but the workings
are more obvious and we no longer generate enormous numbers of independent
tests. There should be a more representative number of dots in the test runner
output now.
2012-11-27 21:42:36 -08:00
Adrian Sampson
0a21d72a79 tolerate non-UTF8 locale in test 2012-11-27 20:38:47 -08:00