Commit graph

231 commits

Author SHA1 Message Date
Boris-Chengbiao Zhou
47ba590999 convert: Correctly identify WAVE format as lossless
Seems like this entry was added before mediafile gained support for WAVE
files in commit 832f3d. Adjust it to fix detection.
2024-03-01 17:58:26 +01: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
29c21860a9 add missing syspath conversions (2/3, beetsplug) 2023-07-16 10:17:40 +02:00
J0J0 Todos
0d8f8a3cff Fix ValueError in convert plugin auto_convert_keep 2023-06-22 09:13:09 +02:00
J0J0 Todos
86929eb6a0 convert: playlist: Adapt code comments
- Remove initial comment around playlist entry condition (which is better
  suited for user docs anyway, and stated there already)
- Add explanation above the items_paths playlist contents creation list
  comprehension.
2023-04-02 19:34:13 +02:00
J0J0 Todos
16e361baf3 convert: playlist: item_paths relative to playlist
Ensure entries in items_paths are generated with a path relative to the
location of the playlist file.
2023-04-02 13:10:14 +02:00
J0J0 Todos
a4d03ef586 convert: playlist: M3U write + contents as bytes
Make sure we stay with the beets standard of handling everything internally as
bytes.

- M3UFile.write() method writes in wb mode.
- Playlist contents and EXTM3U header is handled as bytes.
  - item.destination() gives us unicode string paths, we tranlate to bytes
    using util.bytestring_path().
- Fix test_playlist*write* tests to encode UTF-8 assert strings as bytes using
  bytestring_path() before comparision.
2023-03-29 07:46:08 +02:00
J0J0 Todos
20a0012f79 convert: playlist: Use normpath for playlist file
Fixes FileNotFoundError when for example a tilde (~) characteris used for a
--dest path.
2023-03-29 07:46:08 +02:00
J0J0 T
d248063f96 convert: playlist: Improve --playlist help text 2023-03-29 07:46:08 +02:00
J0J0 T
cb630c45f6 convert: playlist: Also use syspath() for contents
of playlist. We want to have processed every entry in the media list we
pass to the M3UFile instance.
2023-03-29 07:46:08 +02:00
J0J0 T
7d121c390b convert: playlist: Move M3UFile class to separate
module in util package.
2023-03-29 07:46:08 +02:00
J0J0 T
55b386375a convert: playlist: Move m3u creation after conversions
- Move the creation of the playlist file to the very end, right after
  self._parallel_convert, in the convert plugin's main function.
- In the test code, the destination directory is created when the
  conversion happens, thus this fixes test_playlist and doesn't hurt the
  feature - The playlist creation can as well be the very last step in
  the process.
2023-03-29 07:21:27 +02:00
J0J0 T
5dfff50005 convert: playlist: Refactor m3u writing to class
and also implement a currently untested load() method.
2023-03-29 07:21:27 +02:00
J0J0 T
c251ed19c4 convert: playlist: Generate m3u file in one batch
to avoid any possible interference with the threaded file conversion
mechanism.
2023-03-29 07:21:27 +02:00
J0J0 T
d589e77ade convert: playlist: Fix redundant join path
It's done in _get_opts_and_config already.
2023-03-29 07:21:27 +02:00
J0J0 T
c0b1bc9867 convert: playlist feature: Better relative path gen
Use Item.destination method for generation of relative paths to media
files in playlist. The fragment keyword enables returning the path as
unicode instead of bytes, let's keep that in mind.
2023-03-29 07:21:27 +02:00
J0J0 T
16e25bb61b convert: playlist feature: Fix relative paths
pointing to media files in playlist. Also refine code comment and move
to a better fitting place.
2023-03-29 07:21:27 +02:00
J0J0 T
fd8fe69738 convert: Playlist feature linting fixes 2023-03-29 07:21:27 +02:00
J0J0 T
d448e0c4de convert: Refine and fix playlist feature
- Improve --help text
- Use unicode instead of bytes when adding media file paths to the
  playlist file.
- The "standard" (?) of m3u8 defines that unicode should ensure support
  of special characters in media file names. util.displayable_path() is
  used to do the conversion from bytes. We save everything in bytes in
  the config since it seemes to be the way this plugin or beets in
  general likes to save paths.
- Join dest and playlist in the config reader method already to have it
  ready in both methods that require the full path to the playlist file.
2023-03-29 07:21:27 +02:00
J0J0 T
861bc69df5 convert: Add a quick & dirty m3u playlist feature 2023-03-29 07:21:27 +02:00
Aidan Epstein
c906e55ba9 Fix recent bug that would not transcode when format was wrong
Bug introduced in c6d623241b, should_transcode would return False even when the format was different.

Also fix up tests and documentation.
2022-10-19 08:55:51 -07:00
Adrian Sampson
1ebcbf6944
Merge branch 'master' into fix_max_bitrate_default 2022-10-03 11:02:07 -07:00
Adrian Sampson
82d41446a2
Use fsdecode for template substitution
The idea in this PR is to converge on Python's `fsdecode` and `fsencode`
for argument manipulation. This seems to match up with the Python
standard library's assumptions: namely, on Windows, we use `fsdecode` to
get back to Unicode strings:
54bbb5e336/Lib/subprocess.py (L561)

So let's start by dropping this utility and going straight for
`fsdecode` here to match.
2022-10-01 16:37:47 -07:00
Jordi
c6d623241b Fix beets#4472 - set 'max_bitrate' default param to none 2022-10-01 01:20:30 +02:00
Aidan Epstein
ac5634d592
Fix old alias
It looks like the convert option for wma used to be called windows media.  We could just remove this alias, but might be good to keep for backwards compatibility.
2022-07-30 16:10:58 +00:00
Duc Nguyen
c4281ddacc add some documentation 2022-03-09 18:34:31 +01:00
Duc Nguyen
a2325e72ad refactoring 2022-03-04 10:42:18 +01:00
Duc Nguyen
af5858d200 doc + linter + changelog 2022-03-04 10:42:17 +01:00
Duc Nguyen
18e8b73c33 add option to convert items after import
convert items after imports but also keep original files intact
2022-03-04 10:40:59 +01:00
Adam Fontenot
07eb26f276 Resize album art when embedding (convert plugin)
Fixes #2116
2022-02-09 23:52:21 -08:00
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