This simplifies choosing the correct release when there are multiple matches.
If a certain release has multiple countries associated, all will be shown.
Thanks to the user "the-confessor" for testing this new feature.
Fixes#451.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
9db3aa9 introduced the -r/--max-retries option, but passed `'r'` to
`argparse.ArgumentParser.add_argument` instead of `'-r'` which causes:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../whipper/command/main.py", line 48, in main
cmd = Whipper(sys.argv[1:], os.path.basename(sys.argv[0]), None)
File ".../whipper/command/basecommand.py", line 117, in __init__
self.options
File ".../whipper/command/basecommand.py", line 117, in __init__
self.options
File ".../whipper/command/basecommand.py", line 60, in __init__
self.add_arguments()
File ".../whipper/command/cd.py", line 308, in add_arguments
default=DEFAULT_MAX_RETRIES)
File "/usr/lib/python3.7/argparse.py", line 1354, in add_argument
kwargs = self._get_optional_kwargs(*args, **kwargs)
File "/usr/lib/python3.7/argparse.py", line 1485, in _get_optional_kwargs
raise ValueError(msg % args)
ValueError: invalid option string 'r': must start with a character '-'
for any arguments passed to `whipper cd rip`.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Don't think it's required but it would be impolite not to announce
the software making the requests with its name, version and
contact information.
Fixes#439.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Ripping an unknown album when cover art fetching is enabled (e.g.
`whipper cd rip --unknown --cover-art complete`) causes whipper to crash
with an error similar to the following:
```python
Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../whipper/whipper/command/main.py", line 43, in main
ret = cmd.do()
File ".../whipper/whipper/command/basecommand.py", line 139, in do
return self.cmd.do()
File ".../whipper/whipper/command/basecommand.py", line 139, in do
return self.cmd.do()
File ".../whipper/whipper/command/cd.py", line 191, in do
self.doCommand()
File ".../whipper/whipper/command/cd.py", line 363, in doCommand
self.program.metadata.mbid)
AttributeError: 'NoneType' object has no attribute 'mbid'
```
due to accessing `self.program.metadata.mbid` when
`self.program.metadata` is `None`. To avoid this, only attempt to get
cover art when `self.program.metadata` is available.
Also print a warning when the cover art can't be fetched to inform the
user that it isn't being downloaded.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
* Update docker instructions to use --bind instead of -v.
This is the better and approved option now as `-v` will yield permission errors on some systems.
Signed-off-by: Martin Paul Eve <martin@martineve.com>
* Add requirement for directories to exist
Signed-off-by: Martin Paul Eve <martin@martineve.com>
Add new `--max-retries` argument to allow users to specify maximum number
of attempts to try before giving up ripping a track. This value defaults to `5` while `0` means infinity.
Possible errors (negative number, string, etc) are also handled.
Co-authored-by: JoeLametta <JoeLametta@users.noreply.github.com>
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Signed-off-by: ABCbum <kimlong221002@gmail.com>
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>
Fixed some bugs:
- MusicBrainz submit URL always has https as protocol: hardcoded, even when
inappropriate. It's just a graphical issue.
- Whipper appears to always communicate with MusicBrainz using musicbrainzngs
over http. The musicbrainzngs.set_hostname(server).
- `musicbrainzngs.set_hostname(server)` always defaults to http. Since musicbrainzngs
version 0.7 the method `set_hostname` takes an optional argument named `use_https`
(defaults to False) which whipper never passes.
Changed behaviour of `server` option (`musicbrainz` section of whipper's configuration file).
Now it expects an URL with a valid scheme (scheme must be `http` or `http`, empty scheme isn't allowed anymore).
Only the scheme and netloc parts of the URL are taken into account.
Fixes#437.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Add PERFORMER & COMPOSER metadata tags to audio tracks (if available).
Composer(s) and performer(s) will be extracted from MusicBrainz
recording metadata by new _getComposers and _getPerformers
functions then there will be new properties added to each track
metadata. If those data are present it will be tagged as new tags
PERFORMER and COMPOSER.
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>
Mock two functions `getCoverArt`, `get_image_front` and use
a locally available cover art to check if the created cover
art exists.
Problems:
- How to check image's quality.
- Not sure if only this check is enough (do we need to check the
embedding part?).
Signed-off-by: ABCbum <kimlong221002@gmail.com>
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>
This avoids `%` character interpolation leading to `InterpolationSyntaxError`.
Added a comment explaining this too.
Fixes#443.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
whipper now requires `discid` package - which can be installed through
pip and `discid` relies on libdiscid.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
Using existing TOCs, create a new test case to verify discid generated
when data track is not at the end of the disc track-list.
Quality of test is not verified.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
Since whipper's own "musicbrainz id calculation" fails on CDs with data
tracks on special places, the disc id calculation code is replaced with
libdiscid.
Gives a new way to calculate disc leadout or sectors (last sector of last
audio track) depends on whether the data track is placed last or not.
`discid` requires `len(track_offsets) != last - first + 1`.Which means
there can be only one data track in the disc and the lastTrack number is
deceptive.
For example: a disc (data audio audio audio) has firstTrack=1 lastTrack=3
which is wrong since according to the discid code :
"last **audio** track as :obj:`int"
it should be 4 but the firstTrack is always 1.
The code is duplicated with _getMusicBrainzValues function.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
A new test case to check for mblookup's ability to search
for data based on release id is created along with a function
mocks getReleaseMetadata using an existing JSON file.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
In order to make mblookup command able to lookup data based
on release id, new function getReleaseMetadata is created.
To remove duplicated code, importing and set_useragent is moved
to the top of the file.
Now _getMetadata behaves differently when the discid is not
specified.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
To make mblookup able to look up data based on release id,
RegExp is used to detect whether the input is release id
or disc id and behaves differently according to that.
The input is now also tripped before being passed down.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
This creates a specific job with the `FLAKE8` variable set, rather than
a setting up a 4×2 matrix. This means we create a total of 5 jobs now
rather than 8 jobs.
Part of https://github.com/whipper-team/whipper/pull/433
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
Right now tests are only run against Python 3.5, but we claim we support
Python 3.5+ so let’s run our tests against both Python 3.5 and all later
(stable) versions.
PR: https://github.com/whipper-team/whipper/pull/433
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>