Commit graph

3991 commits

Author SHA1 Message Date
Adrian Sampson
20968a92ee Merge pull request #955 from robotanarchy/master
importfeeds: add new 'echo' type that writes to stdout
2014-09-14 13:03:59 -07:00
Adrian Sampson
67c043532c More docstrings for try_sync (#958) 2014-09-14 12:22:56 -07:00
Adrian Sampson
5ba3d98631 More docs/changelog for flex types (#951) 2014-09-14 12:10:47 -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
robotanarchy
2039d2effe don't use the _write_m3u function for stdout stuff 2014-09-14 20:17:53 +02:00
Thomas Scholtes
fafc56c95b Unify similar code from Type subclasses in base class
Instead of implementing the `parse()` and `format()` methods and
setting the `null` attribute in subclasses, we set the `model_type`
field and the generic implementations of the two methods take care of
the rest.

Again: No change in behaviour!
2014-09-14 17:11:02 +02:00
Lucas Duailibe
b1a5189f68 Add default value for relative_to in play plugin 2014-09-14 12:07:08 -03:00
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
1613a199fa Combine try_write() and store() as try_sync()
This makes sure we store the updated file `mtime`. By providing the
same interface on `Album` and `item` we can also reduce some code
duplication in the `modify` command.
2014-09-14 14:44:32 +02:00
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
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
robotanarchy
68eae9e683 didn't know about flake... 2014-09-13 17:25:10 +02:00
robotanarchy
5b0b3eee45 importfeeds: add new 'echo' type that writes to stdout 2014-09-13 17:11:00 +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