Commit graph

1366 commits

Author SHA1 Message Date
Wieland Hoffmann
335ce9c73c Some grammar corrections for docs/.../ihate.rst 2012-12-01 10:53:35 +01:00
Adrian Sampson
c499be05ea fix some tests under PyPy
In PyPy's pure-Python implementation of the sqlite3 module, sqlite3.Row has no
__len__ method. This works around calling len(row).
2012-11-27 21:47:15 -08:00
Adrian Sampson
f06c7dfbef modernize basic MediaFile tests
These tests were written when I knew almost nothing about Python and even less
about unittest. The class-generating magic never worked with nose for a crazy
reason I won't get into here. This has a bit more copypasta but the workings
are more obvious and we no longer generate enormous numbers of independent
tests. There should be a more representative number of dots in the test runner
output now.
2012-11-27 21:42:36 -08:00
Adrian Sampson
0a21d72a79 tolerate non-UTF8 locale in test 2012-11-27 20:38:47 -08:00
Adrian Sampson
56a49b1374 avoid potential error with malformed dates from MB 2012-11-27 19:50:35 -08:00
Adrian Sampson
becd4f957d long-overdue docs for the "info" plugin 2012-11-27 19:44:46 -08:00
Adrian Sampson
9a4cda60cd autotag: use albumartist if available (GC-423) 2012-11-27 17:05:56 -08:00
Adrian Sampson
eef87c2189 truncation incorporates extension length (GC-461) 2012-11-27 16:54:50 -08:00
Adrian Sampson
953291f736 truncate bytes instead of unicode (GC-422) 2012-11-27 16:43:57 -08:00
Adrian Sampson
da3ffcbec3 version change: b16 is now 1.0rc1 2012-11-27 15:56:02 -08:00
Adrian Sampson
927759fc00 readme: use default-version RTD links 2012-11-27 15:53:54 -08:00
Adrian Sampson
ad9021b9d9 replaygain: normalize peaks to 2^15 (closes #65) 2012-11-09 16:25:19 -08:00
Adrian Sampson
729a89cff3 lyrics: possibly address a Unicode error 2012-11-09 00:01:36 -08:00
Adrian Sampson
90f7fabb9a convert docs phrasing tweaks
@yagebu: I did a code review of the new version of convert using FFmpeg as a
backend. Everything looks perfect. These are just a few changes to the docs.
Thanks again!
2012-11-06 14:38:45 -08:00
Adrian Sampson
859268f707 decode Unicode arguments to import -L (GC-457) 2012-11-06 14:29:58 -08:00
Adrian Sampson
ffe5d37d78 log unicode string literals (GC-456) 2012-11-06 14:22:36 -08:00
Jakob Schnitzer
19acf0809f convert: switch from flac and lame to ffmpeg
Instead of flac and lame the convert plugin now uses ffmpeg. This adds
support for more input formats and simplifies the code. ffmpeg also uses
the lame encoder internally and has equivalents of all the -V<num>
presets which should be sufficient.
2012-11-05 22:30:21 +01:00
Adrian Sampson
6e889bb6d0 fix tests for new explicit urlretrieve() call 2012-11-03 12:47:35 -07:00
Adrian Sampson
cb03766813 merge 2012-11-03 12:16:50 -07:00
Adrian Sampson
c569ddd412 human-readable mkdir error 2012-11-03 12:16:32 -07:00
Fabrice Laporte
dfddc3a899 Update docs/plugins/fetchart.rst 2012-11-01 23:58:49 +01:00
Adrian Sampson
289287690e more helpful changelog about maxsize 2012-11-01 15:33:38 -07:00
Adrian Sampson
338eb6388e documentation for convert.exe problem (#64)
We currently just document the fact that convert.exe can interfere with finding
ImageMagick's convert binary. We can solve this with a config option easily once
confit is merged.

This also changes the line endings for fetchart.rst back to Unix.
2012-11-01 14:25:46 -07:00
Adrian Sampson
d9974081a7 add extension for proxied images
`urllib.urlretrieve` was using the correct extension in most cases -- I think
when the URL ended with .jpg -- but not in every case. This was leading to files
named just "cover" and not "cover.jpg" or something else sensible. In
particular, proxied URLs don't have .jpg extensions. This generates the filename
manually so the source image always has an extension.
2012-11-01 12:39:02 -07:00
Adrian Sampson
45650a4b64 artresizer: fix argument lists to helper functions
Also added some useful debug logs.
2012-11-01 12:15:51 -07:00
Adrian Sampson
f4fa11f8ca don't use subprocess.check_output
This function was added in Python 2.7 and we're currently targetting 2.6 as a
minimum version. Replaced with a function in util.
2012-11-01 11:59:02 -07:00
Adrian Sampson
07d3f3e066 lazily initialize ArtResizer singleton (#64)
Searching for `convert` or PIL has non-negligible performance overhead, so it's
preferable to only do it when really necessary. This way, the search is only
performed when ArtResizer.shared is accessed for the first time.
2012-11-01 11:40:53 -07:00
Adrian Sampson
f7677a4b56 fetchart: fix command & use maxwidth (#64)
An earlier commit broke the call to art_for_album here (too few arguments).
I've also now propagated the maxwidth setting for the command to match the
import hook.
2012-11-01 00:19:15 -07:00
Adrian Sampson
ea128910c5 fix art tests for new URL interface (#64)
The various source helper functions now return URLs instead of calling
_fetch_image themselves.
2012-11-01 00:14:55 -07:00
Adrian Sampson
e3fe9712d5 fetchart fixes for image resizing (#64)
Fixed a number of issues with the changes to fetchart:
- Remove redundant fetches. This was making the Amazon source download every
  image twice even when art resizing was not enabled!
- Restore local_only switch in plugin hook, which got lost in the shuffle at
  some point.
- Don't replace the original image file in-place; use a temporary file instead.
  This would clobber the original source image on the filesystem with the
  downscaled version!
2012-11-01 00:09:35 -07:00
Adrian Sampson
3873c29448 artresizer (#64): helper functions, not classes
The previous method was to change self.__class__ dynamically to make __init__
instantiate different classes. This new way, which uses bare functions instead
of separate functor-like classes, instead just forwards the resize() call to
a module-global implementation based on self.method.

Additionally, the semantics of ArtResizer have changed. Clients now *always*
call resize() and proxy_url(), regardless of method. The method makes *one* of
these a no-op. This way, clients need not manually inspect which method is
being used.
2012-10-31 23:33:59 -07:00
Adrian Sampson
1169d2095e misc. minor fixes for artresizer (#64)
- Safer proxy resize. The URL parameters are now properly encoded. And a
  spurious additional request has been removed.
- Removed manual search of $PATH. Invoking "convert" without a path does this
  automatically.
- More pyflakes-friendly test import of PIL.
- Do not delete the NamedTemporaryFile -- doing so creates a race condition
  where the file might be created between the filename generation and the tool
  invocation.
2012-10-31 23:01:09 -07:00
Adrian Sampson
29c6f9c342 changelog and light style fixes for #64 2012-10-31 17:52:21 -07:00
Fabrice Laporte
447454a62c fix few errors revealed by test_art.py 2012-10-28 23:02:45 +01:00
Fabrice Laporte
d271735dd2 fetchart: fix urlopen call 2012-10-28 17:09:39 +01:00
Fabrice Laporte
7f2aa44ac6 Add 'maxwidth' option to embedart and fetchart plugins.
artresizer.py instances an ArtResizer object that uses internally the PIL; ImageMagick
or a web proxy service to perform the resizing operations.
Because embedart works on input images located on filesystem it requires PIL or ImageMagick, whereas
fetchart is able to do the job with the fallback webproxy resizer.
2012-10-28 15:36:42 +01:00
Adrian Sampson
99e36d870e send "failed reading file" message to debug
This message was being logged as an error every time MediaFile failed to parse a
file. But this is not actually an error -- the importer uses FileTypeErrors to
determine whether a file is music or not. This resulted in error logs for every
album art file, .m3u, etc. in the imported directory. Verbose output is a better
home for this message.
2012-10-26 21:04:18 -07:00
Adrian Sampson
57e66d7b1a fetchart: sort image filenames (GC-452) 2012-10-25 18:02:22 -07:00
Jakob Schnitzer
cf98bfcbe6 convert: write tags from library to copied files 2012-10-25 01:05:06 +02:00
Adrian Sampson
02fd9bf809 convert: embed into destination file, not source file
Paging @yagebu: I think the old version of the code would embed album art into
the wrong file. Please correct me (and accept my apologies) if I'm wrong
though.
2012-10-24 15:17:00 -07:00
Adrian Sampson
dcb9ad7373 fix several non-unicode logging statements
A user reported a problem with one of the logging statements where .format()
tried to convert a Unicode string to bytes because the log message was '', not
u''. As a rule, we should ensure that all logging statements use Unicode
literals.
2012-10-24 15:14:33 -07:00
Adrian Sampson
3fbce8dfdd merge 2012-10-21 15:26:50 -07:00
Adrian Sampson
1a94d9e4b7 warnings about using syspath with some utils
Also pertaining to #58: for most utility functions, paths should *not* be
`syspath`-ified. (This only occurs right before a path is sent to the OS.) In
fact, as @Wessie discovered, using the result of `syspath` with `ancestry` leads
to incorrect behavior. I checked and this should not currently happen anywhere,
but these docstring changes make that requirement explicit.
2012-10-21 14:27:40 -07:00
Philippe Mongeau
78f2003eb0 simplify the random print code
We don't need the 'if opts.album' since we print with the same function and
argsuments.
2012-10-21 11:39:23 -04:00
Philippe Mongeau
e80dce6930 fuzzy: use the new print_obj function 2012-10-21 11:29:21 -04:00
Jakob Schnitzer
d6f20e91bd Speedup 'beet ls' if no format is specified 2012-10-21 13:54:24 +02:00
Jakob Schnitzer
54f29812cf convert: fix breakage due to recent API changes 2012-10-21 13:35:41 +02:00
Adrian Sampson
16f207e927 make syspath/bytestring_path roundtrip on Windows
This is an alternative to #58 that makes bytestring_path perform more like the
inverse of syspath on Windows. This way, we can convert to syspath, operate on
the path, and then bring back to internal representation without data loss. This
involves looking for the magic prefix on the Unicode string and removing it
before encoding to the internal (UTF-8) representation.
2012-10-20 23:49:43 -07:00
Adrian Sampson
1f8fff7445 fix tests for recent API changes in commands 2012-10-20 21:19:50 -07:00
Adrian Sampson
91ad913399 #62: simplify list (and random) code
With the new centralized print_obj function, we can greatly simplify the code
for the list command. This necessitated a couple of additional tweaks:

- For performance reasons, print_obj can now take a compiled template. (There's
  still an issue with using the default/configured template, but we can cross
  that bridge later).
- When listing albums, $path now expands to the album's item dir. So the format
  string '$path' now exactly corresponds to passing the -p switch.

As an added bonus, we can now also reduce copypasta in the random plugin (which
behaves almost exactly the same as list).
2012-10-20 21:10:39 -07:00