If the directory used by tempfile.NamedTemporaryFile is on a different
filesystem (e.g. /tmp on tmpfs), `whipper cd rip --cover-art` will fail
with an error such as:
Traceback (most recent call last):
File "/usr/bin/whipper", line 11, in <module>
load_entry_point('whipper==0.9.0', 'console_scripts', 'whipper')()
File "/home/kevin/tmp/whipper/whipper/command/main.py", line 43, in main
ret = cmd.do()
File "/home/kevin/tmp/whipper/whipper/command/basecommand.py", line 139, in do
return self.cmd.do()
File "/home/kevin/tmp/whipper/whipper/command/basecommand.py", line 139, in do
return self.cmd.do()
File "/home/kevin/tmp/whipper/whipper/command/cd.py", line 191, in do
self.doCommand()
File "/home/kevin/tmp/whipper/whipper/command/cd.py", line 363, in doCommand
self.program.metadata.mbid)
File "/home/kevin/tmp/whipper/whipper/common/program.py", line 498, in getCoverArt
os.replace(f.name, cover_art_path)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmprmx4d9c9.cover.jpg' -> './Boston/Greatest Hits/cover.jpg'
due to calling os.replace with paths on different filesystems.
Instead of os.replace, use shutil.move, which falls back to shutil.copy2
if os.replace doesn't work.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Add option `--cover-art` to `whipper cd rip` command which accepts three values:
- `file`: save the downloaded cover image as standalone file in the rip folder (named `cover.jpg`)
- `embed`: embed the download cover image into all the ripped audio tracks (no standalone file will be kept)
- `complete`: save standalone cover image as standalone file and embed it into all the ripped audio tracks (`file` + `embed`)
Every cover art is fetched from the Cover Art Archive as JPEG thumbnail with a maximum dimension of 500px.
Other supported values for the thumbnails are 250, 500 and 1200 (currently only some images have a corresponding 1200px sized thumbnail).
This feature introduces an optional dependency on the `Pillow` module which is required for the decoding of the cover file (required by the `embed` and `complete` option values).
Problem:
- EmbedPicTureTask shouldn't be a task.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
Co-authored-by: JoeLametta <JoeLametta@users.noreply.github.com>
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
- Removed unused code not portable due to buffer() use
- raw_input() does not exist in Python 3
- Fixed octal constant syntax for Python 3
- Fixed TypeError
- Replace if not exists: makedirs(path) with single call: using makedirs(path, exist_ok=True)
- Class inherits from object, can be safely removed from bases in python3: pylint's useless-object-inheritance (W0235) check
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
For historical reasons there is some confusion between Tracks[1] and
Recordings[2] in MusicBrainz. Essentially what should be saved to
`MUSICBRAINZ_TRACKID` is the Recording MBID—which is what whipper is
correctly doing, but the value storing this value was called `mbidTrack`
rather than `mbidRecording`, which could potentially cause confusion.
[1] https://musicbrainz.org/doc/Track
[2] https://musicbrainz.org/doc/Recording
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
In general, "albums" in everyday usage is what on MusicBrainz would be
considered a release group[1] while as far as I can tell, every single
instance of it being used in whipper is referring to a single "edition"
of an album, which is what would be called a "release" in
MusicBrainz terminology[2].
[1] https://musicbrainz.org/doc/Release_Group
[2] https://musicbrainz.org/doc/Release
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
- Fix PEP8's line too long warning
- Remove useless parentheses
- Use triple quotes for docstring
- Address pylint's 'inconsistent-return-statements'
- Specify string format arguments as logging function parameters
- Comment out already disabled block of code
- Remove useless else (after return)
- Remove useless statement
- Do not import already imported module
* Begin work on moving cdrdao to a task
* Add code to start cdrdao task
* Allow cdrdao output to be asynchronously parsable
* Provide progress of cdrdao read toc/table to console
* Flake8 fixes, Freso's advices
Whipper uses cdrdao during its ripping process. With this commit it will now store cdrdao's generated tocfile in the ripping path.
Preserving the tocfile allows users to easily burn ripped discs having a non-compliant cue sheet.
Fixes#214.
Commit 9c72ebccd3 introduced a bug: all template strings are validated against the disc template RegEx (which, for example, is wrong if we're testing the track template).
If the template string contains variables which aren't valid for whipper, raise ValueError exception listing all the included unrecognized variables.
I've also corrected the example template configuration lines in the README.
Fixes#279.
* Limit length of filenames
If whipper generated filenames are longer thant the maximum value supported by the filesystem, the I/O operations are going to fail.
With this commit filenames which may be too long are truncated to the maximum allowable length.
Fixes#197.
* handle FreeDB server errors gracefully
In my repeated tests, I ended up upsetting freedb.org, which started
issuing 502 errors. Those errors are not correctly caught by the
program which just crashes with a backtrace. Instead, we handle those
like any other API error, which can already be generated by
perform_lookup (but not handled).
The visible result for the user is that the CD is simply not found on
FreeDB, an acceptable compromise, in my opinion.
Closes: #206
* harmonize an error message with other warnings
... which are all capitalized.
* freedb: Import from python-audio-tools 660ee2c
License: GPL-2.0+
* freedb: Remove unused code and set client name to whipper.
The removed functions depend on other classes of python-audio-tools,
but aren't needed here.
* cddb-py: replace with newer freedb implementation
The last release of cddb-py was 15 years ago. The freedb code taken
from python-audio-tools speaks protocol version 6 (Unicode) and is
compatible to both Python 2 and 3.
* freedb: Don't allow the pedantic CI test to fail
This commit also includes:
- whitespace / code formatting fixes
- slight syntax related changes: except <exception_name>, e -> except <exception_name> as e
- 3 pointless instructions instances have been rewritten [sorted] (spotted by semi-automatic check)
The unrelated changes shouldn't have any real impact on whipper's behaviour.