Commit Graph

122 Commits

Author SHA1 Message Date
JoeLametta
84e4ef6ab8 offset find: fail early and inform the user with CDs having less than 3 tracks
Fixes #532

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-03-31 10:07:39 +00:00
JoeLametta
c97f2ce547 Add warning about missing files referenced in the cue sheet
This happens when a track fails to be ripped and gets skipped.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-03-28 16:13:39 +00:00
blueblots
6505591462 Fixed m3u and cue sheet generation
Added conditional to `program.write_m3u()` to
ignore skipped tracks.

Added skipped_tracks support to the `Program` and
`image.ImageVerifyTask` classes to avoid crashing
when a file for a skipped track doesn't exist.

Added conditional to `accurip.calculate_checksums`
to check if a path exists before trying to calculate
checksums, this prevents `accuraterip-checksum.c` from
emitting an error message (`sf_open failed!`) when a
path doesn't exist (as when a track is skipped).

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
2021-03-28 16:10:37 +00:00
blueblots
13e1ab6c14 Changed logging strings, removed unnecessary return
Removed `return None` from the `Rip.doCommand` method
as suggested in review comments.

Changed logging strings to use logger arguments rather
than printf-string, as suggested in review comments.

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
2021-03-28 16:10:37 +00:00
blueblots
9f36d323bb Added non-zero exit, altered logger format strings
Added an exit status of 5 when tracks are skipped
during a rip attempt.

Fixed a TypeError caused by a syntax error in the
format string on line 537 in `whipper/command/cd.py`.

Changed f-string to printf-style format string
on line 493 in `whipper/command/cd.py`.

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
2021-03-28 16:10:37 +00:00
blueblots
ae596df834 Fixed error and added log output
Made changes to fix `KeyError` and implemented logging
of skipped tracks. For instance:

if any tracks are skipped, the log will show:
`Health status: Some tracks were not ripped (skipped)`.

the tracks that are skipped will show:
`Status: Track not ripped (skipped)`.

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
2021-03-28 16:10:37 +00:00
blueblots
311cc557ff Added --keep-going option to cd rip command
Implemented the option (`-k`, `--keep-going`) to continue ripping
the CD even if one track fails to rip (as @xmixahlx suggested in #128).

Requested in #128
Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>

Changed line-lengths/indentation of some code

Travis-CI was failing on account of lines being
under-indented or too long, this should correct it.

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
2021-03-28 16:10:26 +00:00
JoeLametta
87f3d00ee3 Add missing information to manpages
Also:
- Updated description of command 'mblookup'
- Misc text changes

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-02-14 21:56:54 +00:00
JoeLametta
3e61c3dc1b Fix 'list index out of range' bug
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>
2020-11-19 15:36:48 +00:00
JoeLametta
04ff005806 Fix bug in cdrom drive status handling
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>
2020-10-12 12:20:53 +00:00
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