94 Commits

Author SHA1 Message Date
Loïc CORBASSON
3fc930b768 Keep working if the HTOA track couldn't be ripped
Signed-off-by: Loïc CORBASSON <loic.devel@corbasson.fr>
2026-02-13 23:04:17 +01:00
Katharina Dröge
314660f7d1 Only look for this rip's log file in output directory
Signed-off-by: Katharina Dröge <kate@commandmc.de>
2025-09-24 17:02:40 +02:00
Andrew Kvalheim
2ebe7033e0 Correct string formatting
The input to the RuntimeError constructor is not a format string.
2023-09-26 05:46:33 -07:00
Daniel J. Perry
31073c67cb Fix bug caused by unescaped globbing
Signed-off-by: Daniel J. Perry <dperry45@gatech.edu>
2021-07-26 01:45:00 -04:00
JoeLametta
731453ea8d Avoid useless './' in file paths
Replaced useless 'os.path.relpath(os.getcwd())' statement with 'os.curdir' (which is equal to '.').

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 17:19:14 +00:00
JoeLametta
1edd3657ba Introduce %M, %N template variables
- %M: total number of discs in the chosen release
- %N: number of current disc

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +00:00
JoeLametta
76b8004b8f Introduce %T (medium title) template variable
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +00:00
JoeLametta
e6ad23f119 Introduce %c (release disambiguation comment) template variable
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +00:00
JoeLametta
bff5c91fa3 Introduce %I (MusicBrainz Disc ID) template variable
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +00:00
JoeLametta
e4645dfdd3 Swap 'title' and 'releaseTitle' meaning
- Trasparent change: now it makes more sense.
- Updated tests to reflect 'title', 'releaseTitle' meaning swap.
- Improved documentation.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +00:00
JoeLametta
e6d9838148 Enable %B (barcode) and %C (catalog number) template variables
Already included but were not allowed.
Improved documentation.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +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
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
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
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
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
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
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
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
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
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
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
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
JoeLametta
f79fb32340 Remove broken assertion 2019-02-02 19:19:50 +01:00