It was introduced in commit acf942b5b6.
The error happens because 'self.itable.tracks' is a list of tracks
(zero-based numbering, HTOA excluded) so the first track can be accessed with
'self.itable.tracks[0]' but when 'number' has value 0, that matches the HTOA
(everything is shifted by one compared to 'self.itable.tracks').
It's unrelated to this bugfix but I've also moved some instructions outside
the try ... except clause.
Fixes#512.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
The bare if evaluated to true for return codes > 0 and that's wrong (CDS_DISC_OK = 4).
Fixes#511.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Whipper's caching implementation causes a few issues (#196, #230, [#321 (comment)](https://github.com/whipper-team/whipper/pull/321#issuecomment-437588821)) and complicates the code: it's better to drop this feature.
The rip resume feature doesn't work anymore: if possible it will be restored in the future.
* Remove caching item from TODO
* Delete unneeded files related to caching
* Update 'common/directory.py' & 'test/test_common_directory.py' (caching removal)
* Update 'common/accurip.py' & 'test/test_common_accurip.py' (caching removal)
* Update 'common/program.py' (caching removal)
* Update 'command/cd.py' (caching removal)
This fixes#335, fixes#196 and fixes#230.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
- `SystemExit` doesn't require importing the `sys` module
- `exit()` depends on the `site` module (for this reason its usage is discouraged in production code)
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>
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>
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>
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>
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>
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>
The attributes working_directory, disc_template, output_directory and offset are not defined during whipper cd info and they are only needed for ripping. self.program.getTable doesn't need output_path to gather the tocfile.
Therefore, this part is excluded, if the attributes don't exist and an offset of 0 is used.
Fixes issue #375.
Co-authored-by: gorgobacka <tho.b.j@gmx.de>
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Signed-off-by: gorgobacka <tho.b.j@gmx.de>
The refactoring of `ReadTOCTask` in commit 3e79032b63
broke the `offset find` command. This commit fixes it again.
Signed-off-by: Volker Mische <volker.mische@gmail.com>
* Include MusicBrainz Release URL in log output
This also passes *all* metadata to the `result` object, giving loggers a
lot more (release) metadata to work with, in case custom, “3rd party”
loggers (or even ourselves in the future!) want to do something more
fancy or expansive with the metadata in the log file.
Fixes https://github.com/whipper-team/whipper/issues/381
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
* Uppercase "url" in output: "URL"
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>