Commit graph

147 commits

Author SHA1 Message Date
Thomas Scholtes
c01fc542ed Support for initial_key with EchoNest 2014-04-11 21:03:11 +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
663d91c4b2 Delete tags from media files 2014-04-09 23:28:11 +02: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
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
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
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
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
Adrian Sampson
ddddbbb919 some more thorough documentation for #614 2014-03-21 17:51:50 -07:00
Andrew Sutherland
e290f8dfad Use _safe_cast to avoid dying on illegal dates. 2014-03-18 01:38:04 -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
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
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
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
c5c87ac46c Implement extended image lists for mediafiles.
Makes the test of 80eded77b1 work.
2014-03-08 17:27:01 +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
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
4ca3c8764e Test mediafile with unicode strings 2014-02-28 14:04:41 +01: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
b490ed7d4b Remove superfluous code 2014-02-04 20:10:55 +01:00
Thomas Scholtes
fcf438c759 Remove duplicate tests 2014-02-04 20:10:55 +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
Adrian Sampson
24227d6ef4 mediafile: optionally save ID3v2.3 tags 2013-10-06 19:53:34 -07:00
Adrian Sampson
4e016f1913 fix MediaFile exception test 2013-06-03 13:39:52 -07:00
Adrian Sampson
4a35be5724 fix crash when RG fields set to null
In general, we convert None values to type-based nulls in packed fields just
as we do for normal fields.
2013-02-24 16:10:18 -08:00
Adrian Sampson
c2a746562a fix Sound Check decode (GC-521)
Fixes the case when the gain number is negative.
2013-02-20 22:54:57 -08:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
244ffd71e2 fix "beet modify" for date fields (GC-449)
This is fixed by allowing MediaFiles to convert strings to integers on
assignment. An eventual complete fix will perform these type conversions in the
Item interface.
2012-10-14 20:27:13 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
5a0105b12c fall back to unittest2 (#275) 2012-01-31 15:25:09 -08:00
Adrian Sampson
b7c9d2caf5 prevent divide-by-zero in bitrate property (#319) 2012-01-29 14:08:23 -08:00
Adrian Sampson
f685bdd89a unicode in str MediaFile fields (#311, closes #15) 2012-01-27 12:02:26 -08:00
Adrian Sampson
bfb8b443ff beginning of ReplayGain fields in MediaFile 2011-11-12 21:23:54 -08:00
Adrian Sampson
b63d6c858b MPEG-4 Unicode freeform frames are now encoded as UTF-8 bytes 2011-07-31 23:03:19 -07:00
Adrian Sampson
85ddfa4381 relocatable test rsrc directory 2011-04-12 14:26:48 -07:00
Adrian Sampson
c051df6d91 fix broken symlink crash (#157) 2011-04-02 18:03:42 -07:00
Adrian Sampson
d4d74dd68b fix crasher w/ old APE files (#159) 2011-04-02 17:48:54 -07:00
Adrian Sampson
43a5e913a7 move some reused testing stuff to _common module 2011-03-23 16:15:18 -07:00
Adrian Sampson
f69f69cecf merge in some fixes from wlof's repository 2011-03-23 15:50:11 -07:00
Adrian Sampson
c698868bf0 catch Ogg header error (#133) 2011-03-23 11:51:27 -07:00
wlof
7be77a99d9 .. is now inserted at the beginning of sys.path so that local beets
files are used instead of installed ones
2011-03-19 01:45:35 +01:00
Adrian Sampson
1b423f05db fix bug where magic "ftyp" string would cause a Mutagen exception (#129) 2011-01-21 15:11:47 -08:00
Adrian Sampson
c3988f7300 safely interpret integers in packed values 2010-08-06 11:17:57 -07:00
Adrian Sampson
7e56cd199d add test ensuring that tagless MP3s are not modified when opened 2010-07-22 13:21:39 -07:00
Adrian Sampson
40a965ea18 detect unreadable files that seem to be of the correct type
In the case that Mutagen throws an exception while trying to read a file, we
throw an UnreadableFileError, which is a new superclass for FileTypeError.
2010-07-03 23:44:28 -07:00
Adrian Sampson
cd9cfbe6fc refactor generated and specific mediafile tests into separate modules
--HG--
rename : test/test_mediafile.py => test/test_mediafile_basic.py
2010-06-26 10:52:39 -07:00
Adrian Sampson
3e23b412f4 a few more fields for Monkey's Audio support 2010-06-26 02:24:48 -07:00
Adrian Sampson
f8c8bff694 support some alternate ogg field names 2010-06-26 02:12:55 -07:00
Adrian Sampson
f944952300 preliminary support for ogg voribis
This entailed:
- changing the "flac" storage style option to "etc" to encompass both
  flac and vorbis as the tags are very similar
- permitting multiple StorageStyles per field/format, to allow a
  read-any/store-all approach to multiple field options
2010-06-26 02:07:13 -07:00
Adrian Sampson
ed51369dce track ordering now always uses bipartite matching algorithm, no longer assumes
current metadata to be correct if it's complete

Previously, we were using the Munkres algorithm (minimum bipartite matching) to
order tracks intelligently only as a fallback if the current metadata was
paradoxical or incomplete. This was because of a concern about the performance
of the potentially-O(n^3) Munkres solver. However, it was found that (a) the
performance is actually not bad, taking on the order of 0.02 to perform a
matching, and (b) there was no recourse for the tagger to reorder tracks that
were legitimately in the wrong order. Now, we get intelligent reordering of
badly tagged music even when the metadata seems to be complete.

To retain some of the functionality of the old orderer, the track distance
metric was expanded to include a component reflecting the track index.

In doing this, another bug was discovered in the UI that showed the track name
differences based on an arbitrary ordering. Now, the tag_album function returns
a reordered items list with every candidate.
2010-05-30 23:52:54 -07:00
Adrian Sampson
67c4ec9507 change to MIT license
--HG--
rename : COPYING.txt => LICENSE.txt
2010-05-28 00:07:11 -07:00
adrian.sampson
94b071493b int casting is now more tolerant (allowing "0 BPM" in "It's Blitz")
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40225
2009-05-12 19:56:49 +00:00
adrian.sampson
f6b53142a9 now tolerates space-separated release times
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40221
2009-04-21 07:21:23 +00:00
adrian.sampson
895806e8cc fixed handling of ID3 frames with empty lists
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40218
2009-04-14 03:47:09 +00:00
adrian.sampson
60848d85ee added GPL license and accompanying notice
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40197
2009-04-09 02:46:22 +00:00
adrian.sampson
1cdf13ea8d PEP8
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40133
2009-02-10 02:54:11 +00:00
adrian.sampson
cf556b8166 tolerate times in dates (but ignore them)
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40127
2009-02-07 23:55:19 +00:00
adrian.sampson
7d7c625091 limit to 80-character lines
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40121
2009-02-07 04:23:52 +00:00
adrian.sampson
647bd33b8e added bitrate support for flac
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40120
2009-02-07 04:19:07 +00:00
adrian.sampson
b1a45fda0b added bitrate and length to mediafile
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40119
2009-02-07 04:13:36 +00:00
adrian.sampson
22795c7124 added Mon Aug 25 00:52:14 PDT 2008 convenience field for MediaFile
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4089
2008-08-25 07:52:18 +00:00
adrian.sampson
b294b2e1f9 slightly reduced the number of unnecessary tests
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4088
2008-08-25 07:15:58 +00:00
adrian.sampson
1294d573d6 dded full date access to MediaFile (yyyy-mm-dd)
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4085
2008-08-04 05:46:44 +00:00
adrian.sampson
cd124d2dad new tests for DB and file operations
Also, new organization for tests and automatic loader. Fixed bugs uncovered by new tests.

--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4069
2008-07-07 05:23:17 +00:00
adrian.sampson
e836a76d0d changed maxdisc and maxtrack to disctotal and tracktotal (clearer)
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4064
2008-07-06 20:26:49 +00:00
adrian.sampson
c28efea9a6 changed save_tags to save
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4057
2008-07-06 03:25:12 +00:00
adrian.sampson
ec7e41a904 added FLAC support to MediaFile (with tests)
--HG--
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4054
2008-07-06 00:44:37 +00:00
adrian.sampson
526b65a9c3 changed beets.tag to beets.mediafile
--HG--
rename : beets/tag.py => beets/mediafile.py
extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%4050
2008-07-03 23:22:14 +00:00
Renamed from test/tag.py (Browse further)