Commit graph

354 commits

Author SHA1 Message Date
Šarūnas Nejus
39288637b9
Centralise warnings for maintainers into deprecate_for_maintainers 2025-11-30 07:02:46 +00:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
wisp3rwind
c657fb6642 mediafile: Improve deprecation warning
This is for mediafile what cc8c3529fb was
for confit, cf. https://github.com/beetbox/beets/pull/4263
2022-06-12 17:59:48 +02:00
Andrew Rogl
6d1316f463 pyupgrade beets dir 2021-08-25 16:05:28 +10:00
Carl Suster
8519f02335 mediafile: replace with a wrapper around mediafile 2019-05-29 09:35:14 +10:00
Rawrmonkeys
0f6f0391fd add tag, database entry, data population for musicbrainz release track id 2018-03-25 18:58:04 -07:00
Sebastian Reuße
c40ea4f22a mediafile._safe_cast: be safer when converting to int
The regex «[\+-]?[0-9]*» possibly matches a single minus/plus, which would then
be passed on to int(), raising a ValueError from within _safe_cast. The test
suite covered this for float, but not for int.

We now make sure we actually have a number after the sign by using a Kleene
plus.
2017-11-19 09:21:07 +01:00
Adrian Sampson
732f0174c8 Expand error message for FileTypeError (#2599)
...when Mutagen doesn't recognize the type at all.
2017-06-17 12:42:00 -04:00
Michal Koutenský
2685f13315 replaygain: support r128 2017-05-17 21:48:01 +02:00
Michal Koutenský
9fe171c5ce properly safe cast unicode as int 2017-05-17 21:37:38 +02:00
Adrian Sampson
9ccaad27d3 Undo some noisy whitespace changes 2017-05-12 10:42:50 -04:00
Adrian Sampson
0cb643f35e Merge pull request #2529 from dosoe/master
Add composer_sort as a tag
2017-05-12 10:34:46 -04:00
wordofglass
bb5629ea1d Remove untyped except statements 2017-04-29 00:05:20 +02:00
dosoe
4a17da8e10 requested changes: where there is no artist_sort, there is no need for composer_sort; cleaning up whitespaces. 2017-04-28 13:41:54 +02:00
dosoe
2a418a6350 ASFStorageStyle corrected 2017-04-28 12:29:44 +02:00
dosoe
075e2432bf deleted one duplicate block 2017-04-28 12:15:37 +02:00
dosoe
c51ecd46e3 add composer_sort tag# 2017-04-28 12:10:02 +02:00
Adrian Sampson
cb7c6bfb69 Use free-form MP4 tag for album gain (#2426)
I'm not sure how this got messed up, but this was:
- Trying to store album gain in the track peak part of the SoundCheck tag!
- Not writing the album gain to the non-SC free-form RG tag!

Together, this led to serious weirdness when writing these fields on AAC
files.

To be clear, we currently *only* support track-level data for SoundCheck. We
also record album-level RG information in non-iTunes tags, but that's
separate. A little googling suggests that SoundCheck now has album-level data,
but supporting that is a separate issue.
2017-02-04 14:16:11 -06:00
Adrian Sampson
da89be81fc Changelog for #2379 2017-01-10 12:30:48 -05:00
Boris Pruessmann
f7742939ef Support for DSF files 2017-01-09 18:54:30 +01:00
Adrian Sampson
b9500c379e Remove some unnecessary imports in mediafile.py 2017-01-09 12:44:53 -05:00
Adrian Sampson
24d43635cd Slightly more helpful UnreadableFileError (#2351)
The exception now says something about what caused it, instead of just
listing the path that led to the error.
2016-12-28 16:33:43 -05:00
Adrian Sampson
8cc2ac5b39 Remove stray prints (#2333) 2016-12-21 21:11:16 -05:00
Shen-Ta Hsieh
7060b512b8 Add Composer, Lyricist and Arranger tags
MusicBrainz provids composer, lyricist and arranger infomations related
to individual recordings. This commit adds query parameters to fetch them, and
write down to media files.

Tagging mapping is implemented according MusicBrainz Picard's data:
https://picard.musicbrainz.org/docs/mappings/

Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com>
2016-12-21 01:52:42 +08:00
Adrian Sampson
9de27c6b70 Sync up with separate MediaFile repository 2016-11-26 20:48:12 -05:00
Adrian Sampson
2cc1a61ea4 MediaFile: Remove one last utility function (#1966) 2016-11-26 17:40:40 -05:00
Adrian Sampson
075a4b6b85 MediaFile: Avoid using some beets utilities
Modularization: #1966
2016-11-26 17:37:01 -05:00
Adrian Sampson
692dea39e8 MediaFile: Use stock logging
This is part of the effort to separate MediaFile from beets (#1966). It avoids
using the beets-specific logging infrastructure. This commit is part of
fdebab657d6e85de56b3996e8fdece09796940ae from the new MediaFile repository.
2016-11-26 17:30:02 -05:00
Christoph Reiter
31f91129f3 Use mutagen id3 encoding constants 2016-11-19 10:36:31 +01:00
Christoph Reiter
31898111ed mediafile: prefer latin-1 encoding for ID3 APIC descriptions. Fixes #899
iTunes has problems with everything but latin-1
Try to use latin-1 if possible and fall back to utf-16.
2016-11-18 01:09:53 +01:00
nathdwek@laptop
b8213181f2 drop IdentityFallbackDict:
Used by mediafile to determine the preferred extension of an image
That solution looked cool for 2 days, but in hindsight it was pretty bad
2016-11-16 23:10:15 +01:00
nath@home
3b4b9085ea utils.collections: rename IdentityUnlessDict to IdentityFallbackDict 2016-11-08 18:48:44 +01:00
nathdwek@laptop
92ee141662 images: use jpg extensions for jpeg files everywhere
fix #2254
2016-11-08 18:48:44 +01:00
nathdwek@laptop
a0877dc092 images: Make sure all jpegs work everywhere
Apply #1545 to a public function used everywhere
2016-11-08 18:48:44 +01:00
Johnny Robeson
7a2bdf502f s/utf8/utf-8/ in all encoding/decoding contexts
This matches up with the python documentation.
2016-09-06 23:10:24 -04:00
Adrian Sampson
f001c0c532 Require Mutagen 1.33
This simplifies the exception-handling story. It also clarifies exactly what's
going on, which I didn't fully realize before: Mutagen *never* raises IOError
anymore, even for IO-related errors, so MediaFile doesn't either.
2016-08-02 08:39:14 -04:00
Adrian Sampson
3d7c8810e7 Deduplicate Mutagen error handling code 2016-08-02 08:24:37 -04:00
Adrian Sampson
4ddb7cfe9e ID3 desc fields also use unicode strings
The old version *also* silently led to the string "b'foo'" being stored in the
frame on Python 3.
2016-07-01 21:47:18 -07:00
Adrian Sampson
17927303ed Store Vorbis image blocks using text strings 2016-07-01 21:21:31 -07:00
Adrian Sampson
a3236cbee0 Set APIC frame desc to unicode
Weirdly, using binary data here resulted in Mutagen storing a string
containing "b'foo'", i.e., the `repr` of a bytes object.
2016-07-01 21:15:33 -07:00
Adrian Sampson
b1fb17c29c UFID tags store strings as encoded bytes 2016-07-01 21:03:00 -07:00
Adrian Sampson
eea4c02d54 Fix a bytes(s) call in MediaFile 2016-07-01 20:57:35 -07:00
Adrian Sampson
44e0e44108 Enforce type of ID3 desc fields 2016-06-28 20:22:58 -07:00
Adrian Sampson
0da1ba9299 Enforce string types for mutagen.Image 2016-06-28 20:19:20 -07:00
Adrian Sampson
4955933670 Update Mutagen dependency (#2088)
This lets us remove a few more workarounds that Mutagen itself has addressed
already.
2016-06-28 10:58:08 -07:00
Christoph Reiter
629241efd3 mediafile: Cleanup mutagen error handling
Instead of the individial mutagen format exceptions use the
mutagen.MutagenError exception introduced in 1.25.

Since 1.33 mutagen will only raise MutagenError for load/save/delete
and no longer raise IOError. Translate both errors to UnreadableFileError
to support older and newer mutagen versions. Unify error handling
in __init__(), save() and delete().

Since it's no longer possible to get an IOError from MediaFile, adjust
all callers and tests accordingly.

This was tested with mutagen 1.27 and current mutagen master.
2016-06-28 16:43:34 +02:00
Christoph Reiter
45404bce85 mediafile: Add note about MPEGInfo.channels being available in newer mutagen versions 2016-06-28 16:43:34 +02:00
Christoph Reiter
9f16cfd078 mediafile: Remove alac detection workaround
No longer needed since we depend on mutagen 1.27
2016-06-28 16:43:34 +02:00
Christoph Reiter
3984febf6c mediafile: Add note to ASF.delete that it's fixed in newer mutagen 2016-06-28 16:43:34 +02:00
Johnny Robeson
890102e114 explicitly cast g1, g2, and peak to int in _sc_encode
They seem to have been implicitly forced to int via `%X` format,
but with python 3.5 we must make it explicit.
2016-06-26 16:40:09 -04:00