Commit graph

3814 commits

Author SHA1 Message Date
Thomas Scholtes
30addc12b4 Do not use abstract base class instance
We want to move common code into the base class with out changing the
behaviour of the default type.
2014-09-14 16:47:21 +02:00
Thomas Scholtes
629fc0087d DateType inherits from Float type 2014-09-14 16:17:12 +02:00
Thomas Scholtes
492cf38927 Use item[field] instead of getattr(item, field) 2014-09-14 16:13:35 +02:00
Thomas Scholtes
19d3ca822e Minor simplifications in Model class 2014-09-14 16:13:35 +02:00
Thomas Scholtes
4cfb59bfba Add Type.to_sql() and simplify model code
Instead of encoding the conversion behaviour in the model class (via
the `_bytes_keys` attribute) we define it on the type. This gives us
a more extensible interface and separates logic.

This should not change any behaviour (as one can see by closely staring
at the code).
2014-09-14 16:13:33 +02:00
Thomas Scholtes
4134a5173a Split Type.normalize() responsibilities into normalize() and from_sql()
Previously `normalize()` was used to convert values set by the model API
consumer and values received from the database. These are two
orthogonal uses.

The commit does not change behaviour since the `from_sql()` method uses
the `normalize()` implementation.
2014-09-14 16:13:33 +02:00
Thomas Scholtes
b86669fe05 Add integer query tests 2014-09-14 16:11:13 +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
Thomas Scholtes
80f3ec1ed7 Document flexible field types in plugins 2014-09-14 13:15:47 +02:00
Adrian Sampson
d081b6a220 Docs for types plugin 2014-09-14 12:35:47 +02:00
Adrian Sampson
2314f0f9ff Use NONE type affinity for flexattr value column
This is what we should have been using all along---since it allows any type to
appear---but we didn't. 😢
2014-09-14 12:34:46 +02:00
Adrian Sampson
044dbfcd38 NumericQuery: Check that the field exists 2014-09-14 12:34:46 +02:00
Thomas Scholtes
5dec867ab3 mpdstats: set types for flexible fields 2014-09-14 12:34:46 +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
3cbe9cbd10 Plugins can define types of flexible fields
This partially solves #647.
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
1526720982 Swap 'if not' and 'else' for readability 2014-09-14 11:49:33 +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
3197795faa convert: Change file extension only if actually transcoded
This makes the tests from a37cabb969
pass.
2014-09-14 11:27:59 +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
f3e87b5b1b Changelog for #956 2014-09-13 23:49:56 -07: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
c57439770b Collapse build_sql into _fetch (#953)
This was getting so short that it made sense to go back from whence it came.
2014-09-13 21:35:19 -07:00
Adrian Sampson
85de214399 Remove SQL ORDER BY sorting option
I don't think anything uses this anymore.
2014-09-13 21:19:32 -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
369533d46f Remove special_sorts
These are not extensible anyway; we'll need another mechanism for that.
2014-09-13 19:47:20 -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
395be1a0f6 Fix missing super-constructor call 2014-09-12 21:40:00 -07:00
Adrian Sampson
cfb929223e Collapse some duplication in Confit templates 2014-09-12 21:28:32 -07:00
Adrian Sampson
f5b6431488 Flake8 fix 2014-09-12 21:12:44 -07:00
Adrian Sampson
db4e74fd57 Fix mistaken removals 2014-09-12 21:11:53 -07:00
Adrian Sampson
03d0f9dfb3 Fix namedtuple call 2014-09-12 20:59:19 -07:00
Adrian Sampson
bb4082fbfc Style cleanup in sorting 2014-09-12 20:58:25 -07:00
Adrian Sampson
d572bde13b Tiny docs typos
Conflicts:
	docs/plugins/index.rst
2014-09-12 20:58:24 -07:00
Adrian Sampson
ba93d6b176 Move flags back to _raw_main
SubcommandsOptionParser is supposed to be generic.
2014-09-12 20:57:48 -07:00
Thomas Scholtes
7328a09644 Align dispatch of 'version' command with other commands 2014-09-12 17:23:49 +02:00
Adrian Sampson
33da82cd12 Merge pull request #948 from KraYmer/lastgenre-doc
Add a link to whitelist raw file in lastgenre documentation
2014-09-11 23:28:04 -07:00
Fabrice L.
f11bbe6580 fix link 2014-09-12 08:16:01 +02:00
Fabrice L.
469b61689a Link to the internal whitelist raw file content 2014-09-12 07:50:50 +02:00