Commit graph

251 commits

Author SHA1 Message Date
Adrian Sampson
088cdfe995
Revert some of #4226
Rectify a couple of things in that PR, pointed out here:
https://github.com/beetbox/beets/pull/4226#issuecomment-1011499620

- Undo the `pretend` sensitivity in the import path, because it's not
  clear how this setting could ever be true.
- Preserve the log message in debug mode, even when quiet.
2022-01-29 18:31:48 -05:00
mousecloak
438262844a
Fixed style violation 2022-01-07 21:39:19 -08:00
mousecloak
ec06694097
Makes the import converter respect the quiet and pretend flags.
When the delete_originals was set, beets would print the following, regardless
of the presence of the quiet parameter:

convert: Removing original file /path/to/file.ext

This commit ensures that the log is only printed when quiet is not present.
2022-01-07 21:29:43 -08:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Adrian Sampson
fd81d65c4b
Undo string type inversion in convert 2021-08-21 13:24:18 -04:00
Adrian Sampson
e6a1f5a3dc
convert: Split command in str form
...with yet another round-trip conversion. :/
2021-08-19 17:24:01 -04:00
Adrian Sampson
75c41c0546
Remove most six.PY2 checks 2021-08-19 16:45:11 -04:00
Andrew Rogl
51d922df27 Merge branch 'master' into fix_#2873 2021-05-24 16:21:27 +10:00
Andrew Rogl
81e50cb630 Too quick to delete 2021-05-23 15:43:14 +10:00
Andrew Rogl
39ca5b7be6 Changes as requested 2021-05-23 14:45:02 +10:00
Adrian Sampson
09a6ec4f74
Merge branch 'master' into pr/item-album-fallback 2021-03-07 09:20:50 -05:00
Martin Haaß
9587caf916
convert: uses new par_map to work in parallel (#3830)
Squashed 5 commits:
* convert: uses new par_map to work in parallel
* linting
* code review: remove unneeded list syntax
* linting
* changelog addition
2021-01-19 18:47:02 +01:00
FichteFoll
701cd6c42b
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-11-02 00:10:46 +01:00
Samuel Cook
b89a2650cc
Delete after convert (#3700)
* If import move is true, files will be deleted after converting.
Fixes #2947

* Removed trailing whitespace to comply with W293, fixing build

* Add period to the end of the comment

Co-Authored-By: Adrian Sampson <adrian@radbox.org>

* Added changelog entry for this fix.

* Added delete_originals option to remove source files after transcode

* Added unit test, removed redundant syspath call

Co-authored-by: Logan Arens <logan-arens@users.noreply.github.com>
Co-authored-by: Logan Arens <heresmygithub@protonmail.com>
Co-authored-by: Adrian Sampson <adrian@radbox.org>
Co-authored-by: Logan Arens <logan.arens@protonmail.com>
2020-08-03 20:20:20 -05:00
FichteFoll
eda9930c59
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-07-27 19:32:44 +02:00
Vexatos
7aab50b7b8
convert: Reduce amount of duplicate code for linking.
Also slightly reworded documentation.
2019-08-21 12:19:47 +02:00
Vexatos
aeb7d8846e
convert: disable album-art embedding for linked files.
Fixed flag precedence of link and hardlink over their options.
Fixed formatting issue.
2019-08-20 16:40:02 +02:00
Vexatos
a61aa74061
convert: add option to hardlink instead of copying.
Overrides the --link option.

As proposed in #2324.
2019-08-20 16:07:01 +02:00
Kier Davis
4820cee35c
convert: add option to symlink instead of copying
As proposed in #2324.

Updated commit from #2326.

Co-authored-by: Vexatos <stuarzt@gmx.de>
2019-08-20 14:50:44 +02:00
FichteFoll
e17c478f74 Cache an item's album with a property
Use Album.load() whenever the album is requested, which causes it to be
reloaded from the database.

Drawback: This adds a slowdown of 100% (6.2s to 12.6s) to `beet list`
on my setup.
2019-06-05 02:39:56 +02:00
Carl Suster
6382c364e2 confit: replace with confuse in plugins 2019-06-01 10:03:41 +10:00
Jan Holthuis
7afeb9b2ac convert: Add id3v23 config option to convert plugin 2019-02-14 23:42:36 +01:00
milesial
d5caae12bd
Now logs both the source and the destination 2018-10-25 15:29:28 +02:00
milesial
d4e615feba
Fixed typo in convert when copying cover art 2018-10-24 19:07:12 +02:00
Michal Koutenský
d4625bced0 Have convert plugin run early in the pipeline 2018-02-19 10:46:06 +01:00
Aaron Jubbal
e24f732014 Changed dont_convert to no_convert. 2017-11-29 20:08:50 -08:00
Aaron Jubbal
0998d9f8ef Added default value for dont_convert option, addressing crashes. 2017-11-29 17:53:50 -08:00
Aaron Jubbal
7265077e75 dont_convert option implemented.
Local testing indicates success.
2017-11-29 16:13:38 -08:00
Adrian Sampson
c7801d4cc0 Attempted fix for #2515 (convert on Windows)
On Python 3, this tries to pass through the Unicode filename representation
for paths to the Windows API.
2017-04-14 09:31:30 -04:00
Jan Solanti
7cf7bc5ff6 Change default aac encoder to FFmpeg's native one
FFmpeg's native aac encoder was declared stable in 3.0 (Feb 15. 2016).
Support for libfaac was removed some time later:
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=dc0f711459e0c682bf9f94ba38d26736e90cff45
2017-03-20 22:15:17 +02:00
Kier Davis
eb85ff422b
convert plugin: fix braces in filenames causing tracebacks in "pretend" mode
Previously "pretend" mode (a.k.a. dry run mode) passed the command to be
printed directly to _log.info, whose first argument is technically a
format string. Thus the command string was parsed for replacement fields, such
as '{foo}', which could cause the format evaluation to fail if the filenames
contained in the command contained valid (or partially valid) replacement fields.

This fix simply inserts an argument '{0}' to the call to _log.info, which is a
format string that simply evaluates to the second argument to _log.info (the
command string). By doing this, the command string is not parsed for replacement
fields.
2016-12-16 00:21:35 +00:00
nath@home
2e78628507 convert: Don't ask for confirmation if query result is empty 2016-11-13 17:46:29 +01:00
nath@home
d53b677e0f convert: initial cleanup of convert_func
Get cli options and configuration in a more readable, uniform way
2016-11-13 00:20:01 +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
Johnny Robeson
304df82361 rename/move ui._arg_encoding to util.arg_encoding
We use this for more than ui concerns, so it should be in util.

It is also no longer marked as a "private" method.
2016-08-04 17:16:11 -04:00
Johnny Robeson
1b103b087b reencode convert args on py3 for util.command_output
command_output requires bytestrings, so we put em back that way.
2016-07-25 04:57:02 -04:00
Johnny Robeson
e5497c7494 use stringed template vars on PY3 in convert plugin
We decode them with `surrogateescape`, so we avoid decoding errors
2016-07-25 03:28:02 -04:00
Johnny Robeson
5107f2e6d2 add missing py3_path to tempdir in convert plugin 2016-07-10 04:59:58 -04:00
Johnny Robeson
3db81a3345 bytestringify tmpdir in convert plugin
This works fine in py 3.5, but not 3.4
2016-07-09 03:50:16 -04:00
Johnny Robeson
1119e219b3 adjust bytestring treatment of ext in convert plugin 2016-07-07 03:44:19 -04:00
Adrian Sampson
5efd5b21c5 Use new as_str method
Instead of `get(six.text_type)`, which was a surprisingly large portion of our
uses of six.
2016-06-25 19:16:14 -07:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
cf5ab2617a reorient bytestring_path code in convert replace_ext 2016-06-17 01:20:42 -04:00
Johnny Robeson
411e4957b0 bytestringify replace_ext in convert plugin 2016-06-16 23:40:59 -04:00
Adrian Sampson
b752a58ed6 Improve a couple of docstrings 2016-06-05 12:16:41 -07:00
Adrian Sampson
33a4767eaf Portable mock command for testing convert plugin 2016-05-31 11:48:29 -07:00
Johnny Robeson
81484529c9 remove b' from a few more stdlib calls 2016-05-31 00:13:09 -04:00
Adrian Sampson
ef7cca4c12 Fix #2005: list AIFF as a lossless format 2016-05-18 11:24:34 -07:00
Jack Wilsdon
5f3c27990d Merge pull request #1974 from jackwilsdon/make-convert-extension-optional
Make convert extension optional
2016-05-08 16:30:30 +01:00
Profpatsch
2d36626d25 convert plugin: Change the default ogg quality
According to the `oggenc(1)` man page (in vorbis-tools), the default quality is 3, not 2. So we should use that.
2016-05-02 01:53:20 +02:00
Patrik
2f608fce0a convert.py: Fix error message 2016-05-01 01:53:03 +02:00
Patrik
4f596725ae convert.py: Fix error message 2016-05-01 01:27:02 +02:00
Jack Wilsdon
ae9ece1e62 Make format extension optional
The format extension defaults to the name of the format if it is not
provided.
2016-04-29 14:51:13 +01:00
Guilherme Danno
019d7cd2e6 fix some typos 2016-04-18 12:36:42 -03:00
Adrian Sampson
eac7d64545 Merge branch 'master' into no_unicode_literals 2016-02-28 15:21:43 -08:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Adrian Sampson
031d50abbf Human-readable message in non-pretend mode (#1894) 2016-02-27 09:58:05 -08:00
Ali Graham
a98bc481cd tweaks for style, option name 2016-02-27 19:05:56 +10:30
Ali Graham
a1f80275c4 revert a chunk of the work to be the way it was 2016-02-25 21:35:14 +10:30
Ali Graham
bc21afab42 better text for artwork resize/copy logs 2016-02-25 18:51:00 +10:30
Ali Graham
1fc6efe3b4 fix indentation 2016-02-25 18:45:53 +10:30
Ali Graham
04c12a50ac add copy_album_art_maxwidth config option to convert plugin 2016-02-25 12:44:56 +10:30
Peter Kessen
40900aa1cb Removed unicode_literals from plugins
* bucket
* chroma
* convert
* discogs
2016-02-20 12:10:01 +01:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
eb68177fee Fix #1735: convert --pretend encoding error 2015-11-21 12:40:45 -08:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Adrian Sampson
c617033476 convert: Add some comments 2015-11-01 11:01:40 -08:00
Adrian Sampson
5f5a8946c3 convert: Debug log when embedding images
To help diagnose #1671.
2015-10-30 15:25:01 -04:00
Giorgos Logiotatidis
4a8f978f4c [convert] Fix dest and format flags help text. 2015-05-25 14:37:38 +03:00
Adrian Sampson
07242f65e2 Convert always uses bytestring args (#1461) 2015-05-19 16:38:08 -07:00
Adrian Sampson
0af2cdaa3a New beets.art image utilities
This makes it cleaner to share the high-level image-embedding logic between
the `embedart` and `convert` plugins. This resolves a regression, introduced
in f504c786, that inadvertently activated the former plugin when the latter
was enabled. I also like avoiding cross-plugin imports.
2015-04-05 12:15:38 -07:00
Mara Kim
ddca1b2e13 Add 'tmpdir' option to convert plugin
Closes sampsyo/beets#1382

Add tmpdir setting

document tmpdir setting
2015-03-27 02:11:33 -05:00
Bruno Cauet
7798a521b5 Fix convert plugin 2015-03-05 17:40:32 +01:00
Bruno Cauet
650305c9a1 All suitable plugins use CommonOptionsParser features 2015-03-05 17:03:02 +01:00
Bruno Cauet
6234fee67d Option parser: add common options with a method
Add a new OptionParser subclass: CommonOptionsOptionParser, which
provides facilities for adding --album, --path and --format options. The
last one is quite versatile.

Update base commands (from beets.ui.commands) to use those.
2015-03-05 15:01:20 +01:00
Bruno Cauet
d267741ff3 Delete 'format' variables that shadow the built-in
Also cleanup the 'the' plugin a bit: delete unused variables.

Relates to #1300.
2015-02-11 16:26:16 +01:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Bruno Cauet
4e904c78af Simplify LibModel format management
Delete `ui.format_` and then `ui.print_obj`. Simply ensure that when
there is no format it defaults to '' = default format = config option.
2015-01-26 23:09:56 +01:00
Bruno Cauet
a5026100a3 All plugins use unicode_literals
Given that part of them has no test I may have broke them
2015-01-20 16:22:27 +01:00
Bruno Cauet
02d8e88ef1 Replace all mentions of 'str' with 'bytes' 2015-01-20 12:48:15 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Bruno Cauet
4babc40fd8 Delete useless "config['mypluginname']" mentions
Replace with self.config where this is painless.
More plugins would benefit from this update but that requires turning
functions into methods.
2015-01-12 10:55:59 +01:00
Adrian Sampson
24317fd4c7 Rename BeetsPlugin._import_stages to import_stages
For #1208. Restores backwards-compatibility and matches the development docs.
2015-01-11 14:27:59 -08:00
Bruno Cauet
b27c5304d1 Merge branch 'master' into logging
Conflicts:
	beetsplug/fetchart.py
	beetsplug/mpdstats.py
2015-01-09 15:15:27 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Bruno Cauet
f504c78681 Fix usage of embedart by convert plugin
Instanciation of EmbedCovertArtPlugin on the fly: there may be several
instances → problem with the listeners it registers?
2015-01-06 21:42:28 +01:00
Bruno Cauet
5c1cc6e7fc Convert the convert plugin to the new logging system 2015-01-06 21:42:10 +01:00
Bruno Cauet
427f7e7035 Automatic logger level changes on import
Breaking changes: plugins should set set _import_stages instead of
import_stages. From outside the latter is replaced by import_stages().
This is because it is now wrapped with log level-getting & -setting
statements.
2015-01-06 21:27:15 +01:00
Bruno Cauet
b8211a3c4c Every plugin uses its own logger
logging.getLogger(__name__) everywhere!
Several loggers prefixed every log message with [logername], which we
delete here.
2015-01-06 10:35:44 +01:00
Bruno Cauet
30f158a95e Move "from beets import logging" statements
Move the import next to other beets-related imports
2015-01-05 10:05:21 +01:00
Bruno Cauet
7df8bef8b7 Update logging imports: logging → beets.logging 2015-01-04 17:02:27 +01:00
Bruno Cauet
8cac47af2a Convert beets plugins to lazy logging 2015-01-04 17:02:27 +01:00
Adrian Sampson
016c901e6f Fix 2.6 compatibility with subprocess
We can add this back once we go 2.7-only.
2014-12-21 10:09:43 -05:00
Adrian Sampson
e8158194d6 More robust templating (#1157)
Don't require $source and $dest to be bare tokens.
2014-12-21 09:42:58 -05:00
Adrian Sampson
8579412a76 No shell execution (#1157)
Now that we do the proper thing, we do not need shell parsing.
2014-12-21 09:31:41 -05:00
Adrian Sampson
4180f42194 Encoding and other fixes for #1157
Log as one statement. No need to hold the filesystem lock. New variable name.
2014-12-21 09:30:25 -05:00
Adrian Sampson
c4eba5c741 Apply #1157 by @mluds as patch (fix #1158, #1026) 2014-12-21 09:22:56 -05:00
Angel Alonso
ad9786ce81 convert: update documentation and add a trailing comma. 2014-11-02 10:58:46 +01:00
Angel Alonso
94c268d17e convert: copy album art when copying or transcoding.
Only implemented to work when matching albums instead of tracks (-a option).
Disabled by default in the configuration of 'convert'.

fix indentation.

Fix Travis nagging over indentation (hopefully).

Finally pep8 conforming.
2014-11-01 19:09:33 +01:00