Commit Graph

112 Commits

Author SHA1 Message Date
JoeLametta
3c9e75c3bc Merge pull request #509 from whipper-team/feature/issue-320-isrc-audio-tag
Tag audio tracks with ISRCs (if available)
2020-09-23 19:56:54 +02:00
JoeLametta
84cc824f2e Merge pull request #505 from whipper-team/feature/issue-488-drive-auto-close
Allow configuring whether to auto close the drive's tray
2020-09-23 19:54:59 +02:00
JoeLametta
21185f40a9 Merge pull request #507 from whipper-team/bugfix/issue-385-missing-cd-warning
Provide better error message when there's no CD in the drive
2020-09-23 19:52:50 +02:00
JoeLametta
8a1c0fabfc Allow configuring whether to auto close the drive's tray
Fixes #488.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-09-23 17:41:48 +00:00
JoeLametta
b754b2b0bf Restore getRipResult method to fix regression
The regression was introduced in commit 3acc3ffed6.
The getRipResult method has been slimmed down to its essence.

Fixes #508.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-09-20 13:07:14 +00:00
JoeLametta
acf942b5b6 Tag audio tracks with ISRCs (if available)
Fixes #320.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-09-19 20:14:22 +00:00
JoeLametta
921e25bf98 Provide better error message when there's no CD in the drive
Fixes #385.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-09-17 19:18:27 +00:00
JoeLametta
3acc3ffed6 Drop whipper caching (#336)
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>
2020-09-17 17:52:11 +02:00
JoeLametta
fa7c50d3a6 Replace 'sys.exit()' and 'exit()' instructions with 'SystemExit()' equivalents
- `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>
2020-05-30 09:38:52 +00:00
JoeLametta
8802c5482e Improve error message for unconfigured drive offset
Fixes #478.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-05-29 16:24:30 +00:00
JoeLametta
e56c636fd3 Improve docstrings
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-22 15:11:22 +00:00
JoeLametta
3b269e7a3b Fix flake8 warning
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-08 18:32:12 +00:00
JoeLametta
9a0b911666 Clarify 'set_hostname' warning message
Fixes #464.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-08 18:24:00 +00:00
JoeLametta
6fd7a78222 Change dest name of '--cover-art' option to 'cover_art'
Make it consistent with the name of the option.

Fixes #465.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-08 17:51:29 +00:00
Kevin Locke
922389687a Fix cd rip --max-retries option handling
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>
2020-01-29 16:40:24 -07:00
JoeLametta
dea7db10cf Merge pull request #459 from kevinoid/fix-unknown-no-mbid
Fix crash fetching cover art for unknown album
2020-01-29 13:42:44 +01:00
Kevin Locke
3ec17dbd33 Fix crash fetching cover art for unknown album
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>
2020-01-29 12:35:49 +00:00
JoeLametta
eaf96ea64e Merge pull request #455 from ABCbum/customize-max-tries
Allow customization of maximum rip attempts value
2020-01-29 12:42:04 +01:00
ABCbum
9db3aa9247 Allow customization of maximum rip attempts value
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>
2020-01-29 11:36:55 +00:00
JoeLametta
7b8a20b22b Merge pull request #450 from ABCbum/develop
Use https and http appropriately when connecting to MusicBrainz
2020-01-29 10:00:35 +01:00
JoeLametta
7f438d1b75 Improve help string consistency
Reported by user "ABCbum" in comment (https://github.com/whipper-team/whipper/pull/436#discussion_r370068256).

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-28 17:05:31 +00:00
JoeLametta
1206552bd2 Use https and http appropriately when connecting to MusicBrainz
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>
2020-01-17 15:12:40 +00:00
JoeLametta
caa2c8b27d Bug: whipper shouldn't abort if track rip succeeds on last allowed retry attempt
Fixes #449.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-14 17:50:04 +00:00
ABCbum
e2942b07e3 Add test case to check getCoverArt's functionality
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>
2020-01-14 15:57:34 +00:00
ABCbum
f61214a238 Support fetching cover art images from the Cover Art Archive
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>
2020-01-14 15:57:34 +00:00
JoeLametta
fb9fb34b83 Move comment to the right place
The blank line after the comment was added in commit 644e67f105.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-04 12:21:08 +00:00
ABCbum
b914b31119 Enable mblookup to take release id as argument
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>
2019-12-19 08:55:13 +00:00
JoeLametta
c13f541e61 Push whipper release v0.9.0
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-04 13:26:33 +00:00
Drew DeVault
64dd9d843a Initial pass on python 3 port
Given the imminent end-of-life for Python 2, I didn't bother making the
codebase compatible with both.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
2019-11-26 18:46:10 +00:00
JoeLametta
d7f6d6888f Merge pull request #274 from mtdcr/accuraterip-module
accuraterip-checksum: convert to python C extension
2019-10-26 11:32:27 +02:00
JoeLametta
993dd6cc33 Handle missing self.options for whipper cd info
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>
2019-10-26 11:24:30 +02:00
JoeLametta
d9b49df0aa Whitespace fixes
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-10-26 08:05:00 +00:00
Andreas Oberritter
252a2e8141 Use ittoc only for CDDB and MusicBrainz lookups
The data from itable may be more accurate, because ittoc comes from
getFastToc().

Signed-off-by: Andreas Oberritter <obi@saftware.de>
2019-10-20 15:25:17 +02:00
Andreas Oberritter
ab95715efc accuraterip-checksum: convert to python C extension
* calculate v1 and v2 checksums at once
* let libsndfile handle both WAV and FLAC

Signed-off-by: Andreas Oberritter <obi@saftware.de>
2019-09-09 20:37:50 +02:00
Volker Mische
9cf890a6e2 Fix offset find command
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>
2019-07-05 00:06:02 +02:00
JoeLametta
ccfe724e2e Merge pull request #392 from gorgobacka/default_success
Set default for eject to: success
2019-05-03 12:28:28 +02:00
JoeLametta
78b3c0d56a Merge pull request #391 from gorgobacka/perform_eject
Use eject value of the class again
2019-05-03 12:28:00 +02:00
gorgobacka
eff5fee3f4 use self.eject
Signed-off-by: gorgobacka <tho.b.j@gmx.de>
2019-05-03 12:25:48 +02:00
Frederik “Freso” S. Olesen
f74455c9f0 mblookup: Cast None to unicode before encoding
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-05-03 02:43:31 +02:00
JoeLametta
1ae6240e63 Remove useless "stopgap morituri-insanity compatibility layer"
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-03-29 13:34:39 +01:00
gorgobacka
a977f9b7f6 set success as default
Signed-off-by: gorgobacka <tho.b.j@gmx.de>
2019-03-27 23:16:21 +01:00
Frederik “Freso” S. Olesen
135cc9ce05 Include MusicBrainz Release URL in log output (#382)
* 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>
2019-03-18 11:15:27 +00:00
Frederik “Freso” S. Olesen
239fc3e6ae Lowercase description of "%R" template variable
All other descriptions are lowercased, except for this one.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 23:13:45 +01:00
JoeLametta
8266368c7d Merge pull request #364 from whipper-team/task/cleanup-musicbrainz-nomenclature
Clean up MusicBrainz nomenclature
2019-02-13 15:29:33 +01:00
Frederik “Freso” S. Olesen
75c5646d1e Fix MusicBrainz nomenclature: album → release
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>
2019-02-13 14:55:45 +01:00
Frederik “Freso” S. Olesen
e91fe2720b command.mblookup: Fix misaligned output.
Only three spaces before "Barcode" instead of four.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 14:35:34 +01:00
JoeLametta
f79fb32340 Remove broken assertion 2019-02-02 19:19:50 +01:00
JoeLametta
cf923cc9cc Review existing comments and add new ones
Also clarified a statement
2019-02-02 19:19:50 +01:00
JoeLametta
ad66af900f Remove erroneous extra format argument 2019-02-02 19:19:49 +01:00
JoeLametta
e7bfc34c0e Rename 'throwaway' variables to single underscore
Also removed unused ones
2019-02-02 19:19:49 +01:00