Commit graph

1597 commits

Author SHA1 Message Date
Bruno Cauet
7df8bef8b7 Update logging imports: logging → beets.logging 2015-01-04 17:02:27 +01:00
Malte Ried
1c4dda4bd3 Merge branch 'master' into import-filefilter 2015-01-04 16:12:36 +01:00
Fabrice Laporte
80038e2a3f test_bucket: update test_year_single_year
2015 was used as an example of date outside of [1970-current year] intervall which is not true anymore
2015-01-03 23:03:29 +01:00
Malte Ried
c560a3d042 Recent changes broke the flake8 rules... 2014-12-31 17:20:47 +01:00
Malte Ried
61a20b3163 Modified the tests to match the new --pretend output. 2014-12-31 17:15:52 +01:00
Malte Ried
ab996a0de0 Merge branch 'master' into import-filefilter
Conflicts:
	test/test_importer.py
2014-12-31 17:04:16 +01:00
Malte Ried
7f4a06d12c Instead of emitting the import_task_created event using a pipeline stage, it is fired every time an import task was created. 2014-12-31 16:57:09 +01:00
Adrian Sampson
405726ba13 Merge pull request #1189 from mried/import-pretend-verbose
A more detailed output of the `--pretend` option
2014-12-31 08:41:22 -04:00
Malte Ried
0e74c5dbaa Rearranged regex config options to reduce hierarchies 2014-12-31 11:56:50 +01:00
Malte Ried
bee0a5b9fe Album tracks are prepended by two spaces to indent them a bit. 2014-12-31 11:38:03 +01:00
Malte Ried
cc82e1cb43 Made the detailed output the default behaviour. 2014-12-31 11:30:46 +01:00
Fabrice Laporte
38b890cdd6 lyrics: add test checking scraping of mocked page 2014-12-31 06:16:06 +01:00
Fabrice Laporte
c34e718ab6 lyrics: introduce empty div in mocked lyrics page 2014-12-31 06:15:41 +01:00
Fabrice Laporte
d4d5c085fa lyrics : remove empty divs before scraping
it may result in \n being inserted that we will strip in
_scrape_strip_cruft
2014-12-30 23:37:23 +01:00
Malte Ried
8addf3ef39 Simplified the configuration of the regular expressions for th ihate plugin
Added the docs
2014-12-30 14:11:45 +01:00
Malte Ried
11008494c3 Tests failed on windows 2014-12-30 12:45:29 +01:00
Malte Ried
023c13d292 Updated the test code to ignore the "Sending event" log messages. 2014-12-29 13:22:28 +01:00
Malte Ried
acec078fa3 The new event changed the log so an old import test failed... 2014-12-29 13:15:54 +01:00
Malte Ried
5123a41258 Added a flag --detailed to get a more detailed output of the --pretend option. 2014-12-29 12:54:16 +01:00
Thomas Scholtes
b33d5b577a Catch exception when program check has non-zero return code
See #1175.
2014-12-29 12:07:57 +01:00
Malte Ried
16abc858e3 Removed some testing code which was checked in accidentally 2014-12-29 12:03:52 +01:00
Malte Ried
7674399a45 Added the import_task_created event
Improved the IHatePlugin to filter files based on file names
2014-12-29 12:03:51 +01:00
Marc Addeo
8f41818434 Fix formatting to pass flake8 tests 2014-12-28 20:58:59 -05:00
Marc Addeo
a70820d8a1 Fix a bug in ftintitle with the order of album artist
There was a bug in the find_feat_part function that would cause it to
fail if the album artist was the second part of the featured string.

For example, if the Artist field was Alice & Bob, and the Album Artist
field was Bob it would return None due to the order.

This fixes that and adds test cases to ensure it doesn't return.
2014-12-28 20:23:17 -05:00
Marc Addeo
4d4113e3a4 Refactor ftintitle to extract the code to find the featured artist
This removes the code that extracts the featured artist from the
original artist field from the ft_in_title function and puts it into its
own.

It also adds a custom ArtistNotFoundException that find_feat_part will
throw if the album artist is not in the artist field.

This allows us to easily test the results of finding a featured artist
in the artist sting, and thus adds tests for the usual test cases that
the split_on_feat gets tested for.
2014-12-28 20:15:09 -05:00
Stig Inge Lea Bjørnsen
a2188d475b ImportAdded support for in-place and link imports
Fix for the `ImportAdded` plugin crashing during in-place imports (#1107).

Add support for the new link imports introduced in Beets 1.3.9.

Note that link-imports that preserve file modification times will follow
the links and preserve the mtimes on the link targets. The mtimes on the
links aren't modified.
2014-12-25 21:39:28 +01:00
Adrian Sampson
74466fff89 Merge pull request #1162 from mried/import-pretend
Added option --pretend to only print the filenames
2014-12-23 09:08:09 -05:00
Malte Ried
5f67f3ae51 The last commit broke the tests. Repaired... 2014-12-21 21:52:09 +01: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
Adrian Sampson
b15102608c Fix convert tests
Use some shell trickery to get the pipelined command to work.
2014-12-21 09:50:57 -05:00
Thomas Scholtes
ec65408c3e Escape path queries for SQLite
Fixes #1146
2014-12-21 12:26:04 +01:00
Fabrice Laporte
e2506f3d03 change prints to ease sources copy/paste 2014-12-19 00:20:50 +01:00
Fabrice Laporte
c12dd5163d add lyrics.com and lyrics.wikia.com to google srcs 2014-12-19 00:00:10 +01:00
Fabrice Laporte
01f484712e change lyrics.com song 2014-12-18 23:59:37 +01:00
Fabrice Laporte
a41106652e fix lyrics.net song url 2014-12-18 23:58:58 +01:00
Fabrice Laporte
69d3065e56 fix black magic woman lyrics keywords
“sticks” is last word of sentence so can be spelled “sticks.”, “magic”
is less ambiguous.
2014-12-18 23:57:46 +01:00
Fabrice Laporte
b89c8e78e3 remove test_util.py 2014-12-17 22:16:23 +01:00
Fabrice Laporte
7d0744d46b lyrics: update unit tests 2014-12-17 22:04:54 +01:00
Fabrice Laporte
e7a4b92de5 lyrics: add 'sources' option 2014-12-17 00:42:11 +01:00
Fabrice Laporte
0f2f43ca9b lyrics: add musixmatch source 2014-12-17 00:41:21 +01:00
Adrian Sampson
c2184be679 Merge branch '1060_ft_lang_support' 2014-12-16 11:53:59 +00:00
Adrian Sampson
c2c1e7236d Simplify word boundaries (#1060)
Use lookahead/lookbehind matching to ensure there is whitespace around the
token. Replaces the use of \b, which doesn't work for "ft.", etc.
2014-12-16 11:49:54 +00:00
Fabrice Laporte
82de2a55bc ftintitle unit tests 2014-12-13 23:35:59 +01:00
Fabrice Laporte
5434c028a4 lyrics: add sources to google CSE 2014-12-13 11:15:55 +01:00
Thomas Scholtes
20f809650c zero: make tests more explicit 2014-12-02 18:07:19 +01:00
Thomas Scholtes
66b81ed081 echonest: test conversion failure 2014-12-02 11:54:36 +01:00
Thomas Scholtes
c248a71494 echonest: mock convert and truncate commands 2014-12-02 11:51:18 +01:00
geigerzaehler
d0e8be45a9 Merge pull request #1128 from geigerzaehler/edit-invalid-config
Allow invalid configuration files to be edited
2014-12-02 11:25:35 +01:00
Thomas Scholtes
575740f5a5 echonest: test different methods to fetch songs 2014-12-02 11:19:47 +01:00
Adrian Sampson
c41b8acf82 Merge pull request #1129 from geigerzaehler/zero-images
zero: Can delete embedded images

Conflicts:
	docs/changelog.rst
2014-12-01 11:40:48 -08:00
Adrian Sampson
4670a8485f Merge pull request #1127 from geigerzaehler/empty-dir-warning
Warn user when no files are imported from a directory
2014-12-01 11:30:26 -08:00
Thomas Scholtes
e2b2a505fc zero: Can delete embedded images
Fixes #1100.
2014-12-01 17:33:45 +01:00
Thomas Scholtes
9d3729dc5e mediafile: Test deleting images and implement it for MP3s 2014-12-01 17:20:16 +01:00
Thomas Scholtes
eb8ccef8e6 Fix py26 string format 2014-12-01 13:05:29 +01:00
Thomas Scholtes
a5f097a883 Allow invalid configuration files to be edited
Fixes #1123.
2014-12-01 13:02:21 +01:00
Thomas Scholtes
75c6af6329 Warn user when no files are imported from a directory
Fixes #1116.
2014-12-01 12:31:49 +01:00
Marvin Steadfast
b25393151d Added plexupdate plugin for refreshing plex music library after importing music. 2014-11-28 11:19:17 +01:00
Adrian Sampson
42228e6d82 Tests: fix unload_plugins
Don't mutate the base classes. This was causing plugins to break on the second
test that uses them, since after they were unloaded their class-level fields
were broken (since the modules are not re-loaded).

This makes it more clear than ever that we need to encapsulate plugin loading
state using some manner of PluginManager.
2014-11-24 10:58:32 -08:00
Marvin Steadfast
d3b76d83d2 Permissions plugins listens now for album_imported and item_imported 2014-11-24 18:41:50 +01:00
Adrian Sampson
daeab3d3a9 Add (skipped) tests for #359 2014-11-22 21:48:06 -08:00
Adrian Sampson
671d8d6aa7 Merge pull request #1098 from xsteadfastx/master
Added fix_permissions plugin
2014-11-20 07:38:21 -08:00
Marvin Steadfast
8784e8d8ca plugin now listens for item_copied instead of after_write. now the test works 2014-11-20 11:40:02 +01:00
Fabrice Laporte
c69ad5d243 print google sources url
when releasing a beets version, run the script before running test_lyrics.py, and copy/paste the sources listed on stdout as a bulk add on Google CSE so beets engine is up-to-date.
2014-11-19 23:33:06 +01:00
Marvin Steadfast
a01e73d813 added not working test for debugging 2014-11-19 19:43:31 +01:00
David
5f1f6bbd04 Remove function from RmTempTest 2014-11-16 21:53:33 -05:00
David
e1ff258ce5 Move function to increase DRY 2014-11-16 21:39:58 -05:00
David
38f056a30c Adding tests for #1067 2014-11-16 21:33:03 -05:00
David
b901071e2c Implment -> Implement 2014-11-16 10:39:50 -05:00
Adrian Sampson
66d02bc289 Add link parameter to Item.move (#710) 2014-11-15 12:41:40 -08:00
Adrian Sampson
36d332ab6a Fix #856: album dirty tracking 2014-11-13 23:25:16 -08:00
Adrian Sampson
288fb0da4c Merge pull request #1075 from Kraymer/1066-fetchart_sources
fetchart: add 'sources' option
2014-11-11 10:04:45 -08:00
Adrian Sampson
91ad0d9f58 Merge pull request #1069 from Kraymer/1035_no_copyright
Remove licensed lyrics from tests resources
2014-11-11 09:58:54 -08:00
Fabrice Laporte
a0579d66cf lyrics: remove full texts from lyricstext.yaml
lyrics are considered valid if they contain a set of
selected keywords picked along the original full text.
2014-11-11 09:06:37 +01:00
Fabrice Laporte
1b0933daa9 fetchart: fix tests to handle generators 2014-11-10 22:37:19 +01:00
Fabrice Laporte
ef6d3efe6d fetchart: cover engines yield their results 2014-11-10 22:17:34 +01:00
Adrian Sampson
68770f85e3 Update ALAC tests for Mutagen 1.26
The metadata extraction is now more accurate for ALACs, but we lost the
ability to distinguish them from AAC.
2014-11-10 10:06:21 -08:00
Fabrice Laporte
09bea52a41 fetchart: fix flake8 2014-11-09 20:55:53 +01:00
Fabrice Laporte
6170c3a179 fetchart: make test_art.py tests pass 2014-11-09 20:41:21 +01:00
Fabrice Laporte
1b694e569e fetchart: add 'sources' option
Fasten cover search by enabling engines selection and prioritisation.
2014-11-08 23:20:44 +01:00
Fabrice Laporte
84c82cc44b Move script to download pages out of tests_lyrics.py
By default (as runned by CI tools), only *fake* example.com page is present in
rsr/lyrics and tests that check content of pages coming from *real* sources are
thus skipped.
Execute lyrics_download_samples.py to download pages from *real* sources. When
done and *real* pages are present on disk, no tests are skipped.
2014-11-08 10:55:48 +01:00
Fabrice Laporte
f5e7bd5d05 Move script to download pages out of tests_lyrics.py
By default (as runned by CI tools), only *fake* example.com page is present in
rsr/lyrics and tests that check content of pages coming from *real* sources are
thus skipped.
Execute lyrics_download_samples.py to download pages from *real* sources. When
done and *real* pages are present on disk, no tests are skipped.
2014-11-08 10:48:28 +01:00
Fabrice Laporte
356c1f44b5 nosetests: don't run slow tests by default 2014-11-06 22:46:42 +01:00
Fabrice Laporte
b143ad7e3e fix #1035 do scraping tests on mock data
don’t store scraped pages with licensed lyrics in repo
2014-11-06 22:10:15 +01:00
Adrian Sampson
ddf5511624 Use unittest.SkipTest instead of nose's version
I don't *think* this should actually do anything, but it does remove a
dependence on nose.
2014-11-05 10:49:45 -08:00
pscn
291675330d Allow plugins to define the same flexible fields if they are of the same
type #1059
2014-11-04 21:20:35 +01:00
Adrian Sampson
832d658571 Use assertAlmostEqual (#1054)
Rounding and then comparing could lead to some surprising sensitivity. This
uses a known-good approximate comparison.
2014-11-01 13:08:07 -07:00
Adrian Sampson
256a3b4055 Tiny formatting tweaks (#1054) 2014-11-01 12:49:44 -07:00
Stig Inge Lea Bjørnsen
afee48379d Add tests for the importadded plugin
The tests verifies that the `importadded` plugin updates added dates and
mtimes when importing:

* an album
* an album with file mtime preservation on
* singletons
* singletons with file mtime preservation on

It also verifies the the plugin doesn't update added dates when
re-importing:

* an album
* singletons
2014-11-01 15:32:27 +01:00
Adrian Sampson
8ed76298e3 Merge pull request #1043 from kiefermat/mediafile_comments_and_year
Added slash separator to DateField and more comments styles to MediaFile
2014-10-28 11:30:07 -07:00
Adrian Sampson
3c748b6cc8 Merge pull request #1042 from kiefermat/apev2_cover_support
Support for APEv2 cover tags
2014-10-28 11:03:00 -07:00
Matthias Kiefer
610942b1a5 Fixed getting description for wma file with standard WMA attributes 2014-10-28 10:28:12 +01:00
Matthias Kiefer
b02da5e150 Added test for date with slashed and fixed date regex 2014-10-28 08:52:03 +01:00
Matthias Kiefer
f8abb03b40 Added support for APEv2 cover tags 2014-10-27 16:10:17 +01:00
Thomas Scholtes
464f8cdc04 Types plugin: Field types for albums and documentation example 2014-10-27 10:54:21 +01:00
Adrian Sampson
9137b5c2f3 Fix another lyrics scraper regression (#1034)
Along with a test.
2014-10-24 20:08:32 -07:00
Adrian Sampson
0325fe2225 lyrics: Remove script tags (fix #1034) 2014-10-24 17:33:11 -07:00
Adrian Sampson
c158bb630c Fix mock function restoration in test :(
An argument for using decorators, context managers and stuff so this is
impossible to mess up.
2014-10-24 17:15:09 -07:00
Adrian Sampson
6aa9e60756 Add tests for #1029
The mbngs library does not like to be called with whitespace-only criteria.
2014-10-24 16:30:14 -07:00
Adrian Sampson
434280f248 A couple of coverage tweaks 2014-10-11 22:05:22 -07:00
Adrian Sampson
e949fe2d93 A bunch more tests for Results 2014-10-11 20:44:10 -07:00
Adrian Sampson
9d5fdbb37f Fix concurrent iterators in incremental results
Some weird behavior was possible when having two iterators on the same Results
object. May seem far-fetched, but it is possible. As an added bonus, this
saves a little memory by disposing of rows when they have been materialized
into model objects.
2014-10-11 20:30:33 -07:00
Fabrice L.
e6bf8c21d8 Merge pull request #992 from KraYmer/lyrics-coverage
Improve lyrics coverage
2014-10-09 22:11:28 +02:00
Fabrice Laporte
4386d9d4df skip test involving bs4 if python version too low 2014-10-09 08:23:20 +02:00
Fabrice Laporte
b32838b519 fix flake8 2014-10-09 06:47:23 +02:00
Fabrice Laporte
2b908b48bc lastgenre: use an ordinary Item instead of a Mock 2014-10-09 06:38:40 +02:00
Fabrice Laporte
b95990ee9c lastgenre: add unit tests 2014-10-09 00:00:26 +02:00
Fabrice Laporte
546d17f52f fix flake8 2014-10-08 20:55:00 +02:00
Fabrice Laporte
4600727e17 fix building of lyrics file paths 2014-10-08 20:32:30 +02:00
Fabrice Laporte
edbbadaf4f add test to check lyrics title match in url title 2014-10-08 14:49:59 +02:00
Fabrice Laporte
9992d65366 test_lyrics: add onelyrics.net source 2014-10-08 14:44:43 +02:00
Adrian Sampson
2b1353a4f1 Malformed date queries no longer crash 2014-10-04 16:50:50 -07:00
Adrian Sampson
06b4730105 Re-import tests: stub out *_for_id functions
Currently, these just return no results. (For our testing purposes, the
matches we get from the ordinary metadata search suffice just fine.)
2014-09-28 11:39:04 -07:00
Adrian Sampson
a3eef35ba8 Test singleton re-imports 2014-09-28 11:16:38 -07:00
Adrian Sampson
f367a0971c Re-import test: check item-level data preserved 2014-09-28 11:04:25 -07:00
Adrian Sampson
e8d2ade167 Basic re-import tests 2014-09-28 10:58:43 -07:00
Fabrice L.
54c9761135 Merge pull request #981 from KraYmer/lyrics-enh
Lyrics scraping code refactored
2014-09-27 11:25:06 +02:00
Adrian Sampson
4f2d7e0aaa Merge pull request #974 from KraYmer/fetchart_issue848_2
embedart: write candidate image only if it is "similar" to already embedded one (suite)
2014-09-25 15:25:46 -07:00
Fabrice Laporte
3a748f3294 add test_is_page_candidate() 2014-09-25 00:05:29 +02:00
Fabrice Laporte
a6a83be434 fix flake8 2014-09-24 23:30:38 +02:00
Fabrice Laporte
879fc8d3ca add LyricsGooglePluginTest to test_lyrics.py 2014-09-24 18:04:37 +02:00
Fabrice Laporte
8ef7837d22 merge strip_cruft() and _scrape_normalize_eol() into _scrape_strip_cruft 2014-09-24 16:51:54 +02:00
Adrian Sampson
fc2c75ee9c Tests for mkdirall
A red herring. I thought this might be responsible for #969.
2014-09-23 18:49:38 -07:00
Fabrice Laporte
333591fd78 no html entities in _scrape_streamline_soup output 2014-09-24 00:25:50 +02:00
Fabrice Laporte
da6bcda4af add lyrics rsrc files 2014-09-23 18:05:08 +02:00
Fabrice Laporte
7e3676ecc9 sort sources in alphabetical order
remove test_sources_fail() (all sources pass now)
2014-09-23 18:01:05 +02:00
Fabrice Laporte
a938e68c98 refactor scrape_lyrics_from_url into smaller functions 2014-09-23 13:21:31 +02:00
Fabrice Laporte
168a24ad77 test_lyrics.py: improve lyrics module coverage 2014-09-22 17:28:02 +02:00
Fabrice Laporte
1dd4ca1d81 lyrics_sources: put sources in their correct category 2014-09-22 17:21:29 +02:00
Fabrice Laporte
e4180e406e fix flake8 2014-09-21 14:44:22 +02:00
Fabrice Laporte
c1224caab5 Merge branch 'fetchart_issue848'
Conflicts:
	test/test_embedart.py
2014-09-21 14:23:59 +02:00
Fabrice Laporte
f5520d7ec9 fix flake8 warnings 2014-09-20 12:27:27 +02:00
Fabrice Laporte
d684229816 skip art compare tests if no recent IM version 2014-09-20 12:26:36 +02:00
Thomas Scholtes
79d1203541 Remove unnecessary method on ImportTask 2014-09-18 19:32:29 +02:00
Thomas Scholtes
56aba87fdc convert: Test skip existing files
Reproduces #970
2014-09-18 17:01:17 +02:00
Thomas Scholtes
d0ac66bfe6 Fix oldstyle object initializer for py26 2014-09-18 16:51:11 +02:00
Thomas Scholtes
1e45ba597d embed_item function does not raise if image file not found
Fixes #968
2014-09-18 16:19:05 +02:00
Fabrice Laporte
cf372f72a6 reduce image sizes 2014-09-17 22:57:50 +02:00
Fabrice Laporte
3ec8902ea4 embedart: add tests for 'compare_threshold' option
was tricky to write meaningful tests when computing phash of existing 6
pixels image (image-2x3.jpg) so I added new -more representatives-
images.
2014-09-17 22:04:45 +02:00
Thomas Scholtes
db391c8f20 zero: Only changes media file tags not database
Uses the new API from the previous commit and fixes #963.

There is a possible issue with backwards compatibility: Changes to the
item in the 'write' event do not propagate to the tags anymore. But I'm
not aware of other plugins that use the API in that way.
2014-09-17 12:17:20 +02:00
Thomas Scholtes
0bf7c06f7d Media file tags can be customized with the `write` event 2014-09-17 12:05:17 +02:00
Thomas Scholtes
ad71af2c3d Add NoneQuery
This makes fast SQL queries for singletons possible
2014-09-17 11:23:00 +02:00
Adrian Sampson
5f2ca0b75b Rename smartartist to artist/albumartist (#953)
This is basically always what you want, so now you can just use the name of
the field without "smart".
2014-09-16 14:53:16 -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
0bdd0c7159 Fix mocking in Spotify tests
The mock wasn't being triggered; these tests were going to the network. Now we
don't match on the query string and instead test that it was correct by
actually parsing it.
2014-09-16 10:43:53 -07:00
Thomas Scholtes
9a382eb581 Test importing unmatched tracks 2014-09-16 13:44:33 +02:00
Thomas Scholtes
e579db6f0a Hide task specific code from importer stage 2014-09-16 12:52:15 +02:00
Adrian Sampson
f9c6dd6d67 Move SmartArtistSort to library (#953)
Models can now have a dict of special sort classes.
2014-09-15 19:43:22 -07:00
Thomas Scholtes
a92493cf12 Test queries on boolean fields 2014-09-15 00:48:18 +02:00
Thomas Scholtes
e5da5757c0 Preserve state in query tests 2014-09-15 00:36:24 +02: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
Adrian Sampson
8ec4f8bc24 Merge pull request #958 from geigerzaehler/item-sync
Update database mtimes in modify and write commands
2014-09-14 12:09:55 -07:00
Thomas Scholtes
b86669fe05 Add integer query tests 2014-09-14 16:11:13 +02:00
Thomas Scholtes
84acf17855 Test that mtimes are updated when writing files
Follows the discussion in #937 and the wiki [1].

[1]: https://github.com/sampsyo/beets/wiki/Architecture#modification-times-mtime
2014-09-14 14:19:11 +02:00
Thomas Scholtes
3fe52a7694 Add test helpers to create database fixtures 2014-09-14 14:16:34 +02:00
Thomas Scholtes
bd871cbc03 Don’t interact with files in TypePluginTest 2014-09-14 14:00:34 +02:00
Thomas Scholtes
ffc75c333d Merge branch 'flextypes' 2014-09-14 13:16:43 +02:00
Adrian Sampson
d081b6a220 Docs for types plugin 2014-09-14 12:35:47 +02:00
Thomas Scholtes
d4f72f62eb echonest: set types for flexible fields
Conflicts:
	beetsplug/echonest.py
2014-09-14 12:34:46 +02:00
Thomas Scholtes
aa24fa7c1b Fix tests on python2.6 2014-09-14 12:34:46 +02:00
Thomas Scholtes
f112c9610c Add 'types' plugin for flexible field types
Conflicts:
	beets/library.py
2014-09-14 12:34:46 +02:00
Thomas Scholtes
475d4899ee Add tests for plugins providing flexible field types 2014-09-14 12:34:45 +02:00
Thomas Scholtes
9a732fbd26 Converted files are tagged and checked in tests
The conversion function either copies files or runs the conversion
command on them, depending on the result of the `should_transcode()`
function. This commit makes the tests more sensitive to these cases.
2014-09-14 12:17:05 +02:00
Thomas Scholtes
9e9f645e59 convert: add cli flag to skip confirmation
The flag mirrors the `--yes` flag from the modify command.
2014-09-14 11:46:24 +02:00
Thomas Scholtes
75a28de543 Extend and refactor 'never_convert_lossy_files' tests
* Each test function only uses on fixture, so we create fixtures in the
  test functions and not in the `setup()` method.

* We test the effect of the option set to true and false.
2014-09-14 11:35:01 +02:00
Thomas Scholtes
a37cabb969 Make 'never_convert_lossy_files' tests more meaningful
We should expect the original file extensions to be preserved since we
do not transcode lossy files. The tests now fail, but a fix is coming
up.
2014-09-14 11:17:43 +02:00
Adrian Sampson
af60272cc5 Merge pull request #956 from voidus/master
Added never_convert_lossy_files option to convert plugin
2014-09-13 23:45:16 -07:00
Adrian Sampson
2b921b19fd NullSort instead of None
A more descriptive placeholder for "don't sort".
2014-09-13 20:38:31 -07:00
Adrian Sampson
76c831a1cd Merge branch 'master' of github.com:sampsyo/beets 2014-09-13 17:19:04 -07:00
Adrian Sampson
4870d7e0fa Roll back fast flexible field sorts (#953)
Sad to see them go, but happy be rid of the SQL injection.
2014-09-13 17:16:12 -07:00
Simon Kohlmeyer
ee6f3dba1b fix coding style errors 2014-09-13 19:51:23 +02:00
Simon Kohlmeyer
9d55179d2d Added never_convert_lossy_files option to convert plugin
When set to true, this config option chooses copying over converting when the
source file is in a lossy format. At the moment, everything except ape, flac,
alac and wav is considered lossy.
2014-09-13 19:07:25 +02:00
Thomas Scholtes
89c82dc63d fetchart: correctly handle path encoding
* Ensure that `config.as_str_seq()` returns a list of unicode objects.
* Map these to bytestring paths so we can compare them to other paths.

Fixes #887
2014-09-13 16:49:34 +02:00
Thomas Scholtes
0bb6348df3 fetchart: Add test that reproduces #887 2014-09-13 16:39:39 +02:00
Adrian Sampson
bb4082fbfc Style cleanup in sorting 2014-09-12 20:58:25 -07:00
Thomas Scholtes
fc5f2126bb Add test helper for adding items 2014-09-11 22:47:55 +02:00
Thomas Scholtes
9ee794beb7 Model.load() should remove flexible fields 2014-09-10 17:22:23 +02:00
Fabrice L.
5a799c7fbe Merge pull request #924 from nrgetik/patch-1
Update genres-tree.yaml using scraping script <https://github.com/nrgetik/genre-cannon>.
2014-09-10 10:23:56 +02:00
Thomas Scholtes
98ae8cbbc9 Make tests conform to PEP8 2014-09-09 22:31:46 +02: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
Thomas Scholtes
3ce5dda0c9 Failing tests for empty import directories
Reproduces #932.
2014-09-06 18:52:57 +02:00
Thomas Gordon
98adb35e3f Change expected result for compatibility with updated genres-tree.yaml 2014-09-06 08:51:31 -04:00
Thomas Scholtes
429f1c1573 PEP8 Fixes 2014-09-05 19:53:46 +02:00
Thomas Scholtes
68bc77362b Increase test speed by removing unnecessary file operations 2014-09-05 19:49:20 +02:00
Thomas Scholtes
273874f3a2 Refactor cli main function
The logic of setting up beets and running a command was scattered
across the `_raw_main` and `_configure` functions. This is an attempt
to bring more structure to the process and to diminish the dependency
on global state.
2014-09-05 19:05:06 +02:00
Thomas Scholtes
3554c0925c Fix doc and flake8 build (again) 2014-08-26 12:44:23 +02:00
Thomas Scholtes
fe0a2482f3 info: add --summarize option
Closes #409.
2014-08-26 12:32:26 +02:00
Thomas Scholtes
5e4600afd8 info: add tests and omit None values 2014-08-26 12:01:53 +02:00
Thomas Scholtes
b278db42be info: print library fields and sort output 2014-08-25 23:47:16 +02:00
Thomas Scholtes
a9f839bbf8 info: Specify files through library query 2014-08-25 23:01:02 +02:00
Thomas Scholtes
4835475fb7 Tags are not read while walking the import tree.
This makes skipping directories on incremental imports much faster and
fixes #158.
2014-08-25 18:40:56 +02:00
Thomas Scholtes
b1f670ada3 Move albums_in_dir() from autotag to import module
Has nothing to do with the former
2014-08-25 18:40:56 +02:00
Adrian Sampson
dcb21ecfb3 Merge pull request #918 from geigerzaehler/formatting
Model formatting: Refactor and fix precedence
2014-08-25 09:02:47 -07: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
91c5d0ae12 Item fields take precedence over Album fields in formatting
For consistency, this is reversed when formatting paths. Fixes #858.
2014-08-25 14:38:58 +02:00
Thomas Scholtes
0798af7774 Refactor model formatting
Remove all formatting related code from models. It now lives in the
`FormattedMapping` class. Only API change is from `model.formatted` to
`model.formatted()`.
2014-08-25 14:24:39 +02:00
Thomas Scholtes
b512a0ce37 lyrics: Use multiple lyrics search strings.
In particular we use the original artist and title before stripping
*and* and *featuring* suffixes.

Fixes #914.
2014-08-24 16:17:21 +02:00
Thomas Scholtes
225ce62a33 Catch all errors when loading state file.
A crash during the multi-threaded import process may leave the pickled
state invalid (see #913). We recover from all these errors.
2014-08-24 14:40:38 +02: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
Adrian Sampson
b31ad388b1 Clean up properly after DistanceTest
One more ordering dependency. That's all of them, right???
2014-08-19 12:52:48 -07:00
Adrian Sampson
61416da0a7 Better isolation for ConfigTest 2014-08-19 12:27:35 -07:00
Adrian Sampson
6b9df4e0f5 Fix harness in test_zero
May have been the cause of some intermittent failures on Travis.
2014-08-19 10:51:48 -07:00
Adrian Sampson
4eb23f7c06 Update tests for #900 2014-08-18 22:26:17 -07:00
Adrian Sampson
3981a6bca0 Merge pull request #892 from olinbg/spotify-plugin
Pull request for Spotify plugin development
2014-08-18 17:22:27 -07:00
Adrian Sampson
4ecaa4239f Fix unittest.skip decorator use
This fixes the py26 build.
2014-08-18 17:11:08 -07:00
Adrian Sampson
bf553eae34 MediaFile: detect missing numbers (fix #901) 2014-08-18 10:17:01 -07:00
Olin Gay
d076e14515 Complete PEP8 cleanup of spotify plugin 2014-08-17 09:53:54 -04:00
Olin Gay
6bab9a2cae Merge branch 'master' of https://github.com/sampsyo/beets into spotify-plugin 2014-08-17 08:36:32 -04:00
Adrian Sampson
09b0e1c75d Add failing test for #899 2014-08-15 12:38:41 -07:00
Adrian Sampson
7de6259c1d MediaFile: make id3v23 a constructor parameter
For #899, we need to change MediaFile's behavior (pre-write) based on whether
we're doing ID3v2.3 or not. So we need a field on the object, not a parameter
to `save()`.
2014-08-15 12:09:18 -07:00
Thomas Scholtes
76c7ba9186 Add asciify_paths configuration option 2014-08-06 17:53:44 +02:00
Thomas Scholtes
29e4fde571 convert: Simplify format configuration.
We don't have to specify the extension. By default it is the same as
the format name.
2014-08-05 12:06:35 +02:00
Thomas Scholtes
b27409684e convert: Add --format option
This option allows the user to specify the format on the command line
instead of editing the configuration.

The commit also includes some refactoring. In particular adding
arguments to functions to avoid dependence on global state.

Doc and Changelog in next commit
2014-08-05 10:45:32 +02:00
Olin Gay
ce4b45ec76 Pull request for Spotify plugin development, see: https://groups.google.com/forum/#!topic/beets-users/2xsOZC-NMNk 2014-08-03 19:55:50 -04:00
Thomas Scholtes
0f2a9bdcdc Record singletons for incremental import
We still need to implement this for flat imports, archives and toppath
singletons. Fixes #860.
2014-07-31 11:09:16 +02:00
Thomas Scholtes
c5f23cc4f8 Don't write state to disk when nothing changes 2014-07-19 14:17:51 +02:00
Thomas Scholtes
46c9992633 Refactor resuming of imports
Instead of recording only the most recently imported path and assuming
that all previous path have also been imported, we record all imported
paths and skip recorded paths when resuming the import.

This fixes an issue where parallelism would screw up the import order
and reimport some files. It also allows us to record singleton items.

We can apply the same strategy can be applied for incremental imports.
2014-07-08 15:06:01 +02:00
Thomas Scholtes
b5426f72a1 Wrap mediafile read exceptions in library.ReadError
The ui only handles library Exceptions. Fixes #857.
2014-07-06 13:19:43 +02:00
Adrian Sampson
10d0572214 Tiny style fixes for #854 2014-07-01 23:10:50 -07:00
philipbjorge
9e6f31eef0 Fixed flake8 errors 2014-07-01 19:41:43 -07:00
philipbjorge
16ef9a7aeb Added unit test for Library unicode filenames #833 2014-07-01 19:19:55 -07:00
Adrian Sampson
e5c5e1858c Changelog for #851 (bucket improvements) 2014-07-01 14:40:39 -07:00
Adrian Sampson
711b1a5bb1 Merge branch 'sotho-master' 2014-07-01 14:38:02 -07:00
Adrian Sampson
59da6c851d Merge pull request #847 from KraYmer/issue805
lastgenre: remove duplicate genres
2014-07-01 14:27:51 -07:00
Alexander Elbs
9ca816f247 the bucket plugin transforms a pattern like 'A - D' into something that
matches all letters starting with A to D (upper and lower case). This
change allows to put more artists into that bucket. E.g. artists
starting with ä or Ä and 0 to 9 and … (three dots)

Example config for overriding a bucket pattern:

  bucket:
     bucket_alpha: ['A - D', 'E - L', 'M - R', 'S - Z']
     bucket_alpha_regex:
       'A - D': ^[0-9a-dA-D…äÄ]
2014-06-30 20:55:28 +02:00
Fabrice Laporte
df47f19e86 lastgenre: remove duplicate genres 2014-06-28 10:31:12 +02:00
Fabrice Laporte
ef89daf1be test_art: add unit test
the test checks that the keyword priority (related to its
position in the keywords list) is considered when selecting
image filename amongst several candidates
2014-06-27 23:32:57 +02:00
Pierre Rust
18539b0bd1 Fix flake8 warnings. 2014-06-15 22:32:26 +02:00
Pierre Rust
69213ad574 Add tests for computed attributes. 2014-06-15 22:32:26 +02:00
Pierre Rust
936acf0236 Fix typo in common utility function for tests 2014-06-15 22:32:26 +02:00
Pierre Rust
728797718e Add tests cases for sort on albums.
On fixed and flex attributes.
2014-06-15 22:32:26 +02:00
Pierre Rust
ad1c0b3831 Add unit tests for fixef and flex field sort 2014-06-15 22:32:26 +02:00
Pierre Rust
1303a915c1 Sort implementation
* sort can be sepcified using the 'field_name'(+|-) syntax
 * supports fixed fields and flexible attributes
 * includes plugins fix for API changes (might have missed some)
2014-06-15 22:32:25 +02:00
Thomas Scholtes
f19fa1567e Test converter embeds album art 2014-06-02 17:09:16 +02:00
Thomas Scholtes
9c6491a65d Embedart TestCase 2014-06-02 16:04:55 +02:00
Adrian Sampson
632d3a9612 dbcore: Add shared instances of common types
Following click's example:
https://github.com/mitsuhiko/click/blob/master/click/types.py#L414
2014-05-25 16:38:47 -07:00
Adrian Sampson
394e4e45eb dbcore: Add types for non-fixed fields
The base Type class now serves as the catch-all logic for untyped fields.
2014-05-25 16:23:15 -07:00
Adrian Sampson
70b5a44ef4 Move query parsing to new dbcore.queryparse
Fix #649.
2014-05-24 17:07:18 -07:00
Adrian Sampson
908584bde8 Revamp FormattedItemMapping
This subclass was not cleanly conforming to the Mapping abstract base. Now
we're in business -- the thing looks like a dict. Brought up by #782.
2014-05-20 16:24:40 -07:00
Pierre Rust
9901d6a4eb Add Test case for flexattr removal (#779) 2014-05-20 23:55:42 +02:00
Adrian Sampson
943cbe0838 MediaFile: allow setting date fields to None 2014-05-18 15:14:36 -07:00
Adrian Sampson
dfa8445980 Style and wording for Google Images (#766) 2014-05-17 22:10:39 -07:00
Adrian Sampson
7f675dbf64 Merge branch 'Lemutar-master' 2014-05-17 22:02:09 -07:00
Adrian Sampson
79aef50c25 AIFF support (fix #250)
Thanks to @EvanPurkhiser, AIFF is now supported in Mutagen 1.23! Now we can
support it too.
2014-05-17 21:13:40 -07:00
Lemutar
c890384215 add a test, replace urllibs , update help 2014-05-16 10:56:55 +02:00
Fabrice L.
c0f7e1fec4 Merge pull request #747 from KraYmer/issue740_buckets
Issue740: introduce bucket plugin to organize files in bucket directories
2014-05-10 23:04:28 +02:00
Fabrice Laporte
02f7e78fd3 fix flake8 warnings 2014-05-10 10:57:44 +02:00
Fabrice Laporte
21feab7ab1 add tests to check bad buckets definitions
message is now printed to the user when buckets declared in the config
file cannot be parsed
2014-05-10 10:55:38 +02:00
Fabrice Laporte
4add189608 Add option to extrapolate year buckets names
- spans are now tracked via a list of dicts instead of 2 lists
previously (simpler code)
- extend_year_spans() pregenerates all possible ranges at plugin setup
stage
- a BucketError is now raised if declared bucket format not accepted
2014-05-08 01:28:17 +02:00
Adrian Sampson
e800b46a5d Make FormattedMapping behave more like a dict
The collections.Mapping abstract base class provides all the nice dict-like
functionality we need.
2014-05-06 11:32:20 -07:00
Fabrice Laporte
509af59d4e cleanup docstrings and add tests 2014-05-04 08:51:11 +02:00
Fabrice Laporte
31569baba7 fix range upper bound + tests added 2014-05-03 23:46:31 +02:00
Fabrice Laporte
581bf768ca add buckets plugin + tests
Add a new template functions %bucket(text, field) for path formatting.
2014-05-03 13:55:21 +02:00
Adrian Sampson
6cc643520d Merge branch 'KraYmer-lyrics-integration-sources' 2014-05-01 08:58:07 -07:00
Adrian Sampson
362db8f22f Merge pull request #728 from sampsyo/lastgenre-tests-new
Tests for lastgenre (cleaned up)
2014-04-29 08:38:56 -07:00
Adrian Sampson
233f71a457 Use real booleans for whitelist/canonical options
As opposed to the strings "true" and "false".
2014-04-28 23:00:00 -07:00
Adrian Sampson
add309b57d Isolate lastgenre tests
We now appropriately set up and tear down the fixture for the lastgenre tests.
(This was causing unpredictable failures elsewhere before.)
2014-04-28 22:35:32 -07:00
Fabrice Laporte
ef3c1cd1ff use booleans for whitelist and c14n options
homogenise options setup using booleans, while keeping the empty string
(synonym of ‘true’) for backward compatibility.
2014-04-28 10:31:22 +02:00
Adrian Sampson
d5dbaeff7a lastgenre: Restore default whitelist 2014-04-27 13:54:32 -07:00
Adrian Sampson
dfd9a4c397 Merge branch 'KraYmer-lastgenre-tests-new' into lastgenre-tests-new
Conflicts:
	test/test_lastgenre.py
2014-04-27 13:52:06 -07:00
Fabrice Laporte
d1cc95984e Rename/add tests
Rewrite tests now that empty whitelist is allowed.
2014-04-27 22:32:31 +02:00
Fabrice Laporte
0613cb7d13 Update _setup_config
Give an empty string to obtain default whitelist, None for no whitelist
or a stringlist for a custom one.
2014-04-27 22:31:31 +02:00
Adrian Sampson
9f5f70aeab Merge pull request #720 from sampsyo/import-refactor
Import refactor
2014-04-27 09:51:10 -07:00
Fabrice L.
e442749cd4 add a test that would fail with the restricted whitelist approach
If no option is set, valid genres should not be rejected. Which is an argument
to have a wide default whitelist.
2014-04-27 16:05:16 +02:00
Fabrice Laporte
e399173f7e add a test that would fail with the restricted whitelist approach
If no option is set, valid genres should not be rejected. Which is an argument
to have a wide default whitelist.
2014-04-27 15:59:43 +02:00
Fabrice Laporte
d0d3c18da2 lastgenre: rewrite filtering logic to make tests pass
- remove filter_tags() as genres should not be removed this soon while
c14n has not been applied
- group all filtering logic in the function _resolve_genres (formerly
_strings_to_genre)
2014-04-26 20:51:13 -07:00
Fabrice Laporte
2e8e55736d get rid of module level options variable
Conflicts:
	beetsplug/lastgenre/__init__.py
2014-04-26 20:51:00 -07:00
Fabrice Laporte
4e5bb262a7 wip: rewrite setup_config 2014-04-26 20:50:04 -07:00
Fabrice Laporte
21f1607e8f lastgenre: add tests functions 2014-04-26 20:50:04 -07:00
Fabrice Laporte
3d30708839 add test_lastgenre.py 2014-04-26 20:50:04 -07:00
Adrian Sampson
e9355f336b Rename remove_duplicates and do_remove_duplicates 2014-04-26 20:21:20 -07:00
Adrian Sampson
38eba4af31 Remove obsolete null checks
Along with their tests. Background:
https://github.com/sampsyo/beets/pull/720/files#r12027386
2014-04-26 20:07:26 -07:00
Fabrice Laporte
cee5e81500 remove _lyricstext.py 2014-04-27 00:27:11 +02:00
Fabrice Laporte
af468f5259 Move lyrics listings from .py to .yaml file 2014-04-26 19:26:28 +02:00
Thomas Scholtes
1d787e0b38 Adapt FetchArt tests to new task api 2014-04-26 18:51:56 +02:00
Fabrice L
9e39946da5 Update lyrics_sources.py
add copyright header
2014-04-26 07:27:23 +02:00
Fabrice Laporte
567e6300fd fix flake8 2014-04-26 07:27:13 +02:00
Fabrice Laporte
117d16f2ad lyrics: add tests to track which websites can be scraped by our algo and be
used as sources fot the google custom search engine.
2014-04-26 07:26:50 +02:00
Thomas Scholtes
07dbe042f5 Move set_candidate logic 2014-04-25 13:23:35 +02:00
Thomas Scholtes
6d22c7489c Test build with setup.py
Since some builds use `python ./setup.py test` to test beets we want to make
sure it runs smoothly.
2014-04-25 12:56:01 +02:00
Thomas Scholtes
495c49703c Add pipeline.mutator_stage 2014-04-19 19:04:49 +02:00
Thomas Scholtes
d8362fd03c Add pipeline.stage decorator 2014-04-19 18:54:29 +02:00
Thomas Scholtes
09ef565cfc Make _infer_album_fields a method 2014-04-19 17:02:36 +02:00
Thomas Scholtes
ecb9ba97be Add SingletonImportTask
The goal of this class is to eliminate all checks for `task.is_album`. This is
already accomplished for the methods. Next, we want to tackle the plugin
stages.
2014-04-19 17:02:36 +02:00
Thomas Scholtes
a09b2d4760 Test that duplicate files are removed 2014-04-19 17:02:20 +02:00
Thomas Scholtes
4677c55c4f Remove DuplicateCheckTest
Superseded by `ImportDuplicate*Test`.
2014-04-19 15:50:49 +02:00
Thomas Scholtes
efee81cda7 Refactor ImportDuplicateAlbumTest 2014-04-19 15:49:39 +02:00
Thomas Scholtes
52e3413c5b Test import singleton duplicates 2014-04-19 15:44:20 +02:00
Thomas Scholtes
0518d4e265 Add tests for duplicate album imports 2014-04-19 15:23:01 +02:00
Adrian Sampson
337b1f8610 tests: use Windows config location on Windows
Only 10 test failures remain on my system!
2014-04-18 15:57:57 -07:00
Adrian Sampson
5f4a9c6446 fix Windows path manipulation in importfeeds 2014-04-18 15:52:23 -07:00
Adrian Sampson
eee2213099 Merge pull request #696 from ayberk/master
Fixed #453 and added test cases
2014-04-18 15:38:27 -07:00
Adrian Sampson
309c5c1a58 fix #705: unicode in SoundCheck fields 2014-04-17 18:10:16 -07:00
Thomas Scholtes
bd047ec6c8 Add tests for resumed import 2014-04-17 21:56:15 +02:00
Yevgeny Bezman
bbb1f7a295 tests: made all tests pass on cygwin. Fixes #655 2014-04-17 19:50:59 +03:00
Thomas Scholtes
a6aed22ddd Flake8 fixes 2014-04-17 12:25:59 +02:00
Thomas Scholtes
ea04344560 Test and fix unicode issues in logs. Fixes #699
The helper functions for creating test fixtures now include unicode characters.
2014-04-17 12:12:49 +02:00
Ayberk Yilmaz
f67ace610a Fixed #453 and added test cases 2014-04-16 23:16:04 +03:00
Thomas Scholtes
d02dec8364 Test albums and singletons simultaneously 2014-04-16 14:50:57 +02:00
Thomas Scholtes
b8687999e2 Query string for computed fields. Fixes #693 2014-04-16 14:18:07 +02:00
Thomas Scholtes
8057830c01 Test mbsync plugin
Exposes bug from #693
2014-04-16 14:01:00 +02:00
Thomas Scholtes
1f742130c4 Catch all archive extract errors and skip tests without unrar 2014-04-15 18:26:35 +02:00
Thomas Scholtes
68595ee09d Import rar archives 2014-04-15 18:24:09 +02:00
Thomas Scholtes
e3acdd0cc8 Import tar archives
Also refactors the importer code to make better use of ArchiveImportTask.
2014-04-15 18:24:08 +02:00
Thomas Scholtes
b783097329 Import zip archives
`beet import archive.zip` extracts the archive to a temporary directory and
imports the content.

The code is very hacky. To make it cleaner the `importer` module needs some
refactoring. One thing the code hints at is extending the `ImportTask` class.
2014-04-15 18:24:08 +02:00
Thomas Scholtes
770bee3583 Extract check for thrird party programs in tests 2014-04-15 18:23:55 +02:00
Thomas Scholtes
4b012e5ddf Import tests use TestHelper
Removes duplicate code, increases speed and makes some files clake8 clean.
2014-04-15 14:57:01 +02:00
Adrian Sampson
02036dd480 Merge pull request #686 from mook/master
`beet modify`: Treat arguments with : before = as queries, not modifications
2014-04-14 10:39:43 -07:00
Mook
12a5215afa beet modify: Add simple argument parsing tests. 2014-04-13 21:24:45 -07:00
Adrian Sampson
2f3ed3e450 avoid extra output in test mp3gain run 2014-04-13 20:41:58 -07:00
Adrian Sampson
77af4ce040 more test isolation (#670)
Doing test-specific cleanup in tearDown before general sandbox deletion helps
avoiding contamination of global state between tests when cleanup fails.

Current Windows status:

    Ran 1106 tests in 72.373s
    FAILED (SKIP=10, errors=13, failures=15)

Closer!
2014-04-13 13:57:22 -07:00
Adrian Sampson
8555fa7640 skip pyechonest tests when library not installed 2014-04-13 13:26:51 -07:00
Adrian Sampson
9dd4ad96bd syspath: correctly prefix Windows UNC paths
Identified while tackling #670, but this should actually solve some legitimate
problems with cataloging music on a network drive.
2014-04-13 13:19:03 -07:00
Adrian Sampson
77eddaa2d1 properly sandbox all tests
All filesystem writes are now to temporary directories. (Long ago, the policy
was to put temporary stuff in _RSRC, but that was a pretty bad idea.)
2014-04-12 19:29:29 -07:00
Adrian Sampson
5477a5d039 better tolerance in RG tests
The first fix avoids contaminating all future tests if the plugin fails to
load. The second skips the CLI backend tests when the appropriate tool is not
available (just as we do with the GStreamer tests).
2014-04-12 19:04:01 -07:00
Adrian Sampson
ed8002bed5 tests: close databases to avoid errors on Windows
Fixes #655 and makes progress on #670.
2014-04-12 15:00:17 -07:00
Adrian Sampson
e5d28e2171 lyrics is flake8-clean 2014-04-12 13:32:46 -07:00
Adrian Sampson
7fcd7daf7c lyrics: minor style/doc cleanup 2014-04-12 13:08:24 -07:00
Adrian Sampson
2dafaa2f0c Merge branch 'KraYmer-lyrics-enh-tests' 2014-04-12 12:58:20 -07:00
Adrian Sampson
7639267f8f Pythonic names for test helpers 2014-04-12 11:24:47 -07:00
Thomas Scholtes
650b49795b Add keyfinder plugin
Closes #662 and #279.
2014-04-12 18:44:38 +02:00
Thomas Scholtes
e5104784c6 Add captureStdout helper and mocks to some tests 2014-04-12 16:49:54 +02:00
Thomas Scholtes
65fcb8a28c Allow CLI tests to use :memory: db
This significantly increases performance
2014-04-12 16:08:57 +02:00
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