Commit Graph

107 Commits

Author SHA1 Message Date
Loïc Corbasson
b778b645ab Make exception handling for cover art fetching more tolerant
Use the parent class WebServiceError to cover all errors related to MusicBrainz API requests (ResponseError, NetworkError and AuthenticationError)

Signed-off-by: Loïc CORBASSON <loic.devel@corbasson.fr>
2026-02-09 17:06:02 +01:00
Merlijn Wajer
656cbe1858 Merge pull request #634 from sinofp/fix-S
Default %S to 'Unknown Artist'
2026-02-07 14:21:05 +01:00
Merlijn Wajer
bf8fe39d6b Merge pull request #660 from CommandMC/feat/multiple-catalognums
Support releases with multiple catalog numbers
2026-02-07 12:41:23 +01:00
Merlijn Wajer
4bf9d8cf8b Merge pull request #662 from CommandMC/fix/releaseid-complete
Make sure to always print out the full release id
2026-02-07 10:59:26 +01:00
Katharina Dröge
d2f1ea9d9e Make sure to always print out the full release id
Signed-off-by: Katharina Dröge <kate@commandmc.de>
2025-09-25 23:45:55 +02:00
Katharina Dröge
65e9439d45 Support releases with multiple catalog numbers
Signed-off-by: Katharina Dröge <kate@commandmc.de>
2025-09-25 21:09:56 +02:00
Katharina Dröge
adab25986f No longer rely on pkg_resources
Signed-off-by: Katharina Dröge <kate@commandmc.de>
2025-09-24 21:52:02 +02:00
sinofp
cac1fe5ed4 Default %S to 'Unknown Artist'
When metadata is absent,
the %S template variable does not have a default value set in the dictionary,
which can cause a "KeyError: 'S'" error.

While %A defaults to 'Unknown Artist' and %S might conventionally default to 'Artist, Unknown',
defaulting %S to that is unnecessary,
because manual tagging typically follows to assign the correct name.
Therefore, I default %S to 'Unknown Artist', just like %A.

Signed-off-by: sinofp <sinofp@tuta.io>
2024-08-30 23:09:06 +01:00
Daniel J. Perry
3395c1d753 Make --prompt input case in-sensitive
Signed-off-by: Daniel J. Perry <dperry45@gatech.edu>
2021-08-01 14:29:14 -04:00
Daniel J. Perry
ebdbde4ce9 Less ambiguous prompt selection message
Signed-off-by: Daniel J. Perry <dperry45@gatech.edu>
2021-08-01 14:29:14 -04:00
JoeLametta
042bf8f926 Mark suitable methods as static
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-26 10:35:58 +00:00
JoeLametta
06356fc40f README update, code linting changes
- PEP8 fix
- Remove useless parens
- Docstring fixes
- RegEX: remove unneeded escape character
- accuraterip-checksum: output usage to stderr in case of wrong invocation

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-26 10:35:58 +00: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
9d67144087 Add 'TRACKTOTAL', 'DISCTOTAL', 'DISCNUMBER' metatada to audio tracks
Co-authored-by: Máximo Castañeda <antiswen@yahoo.es>
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:32:02 +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
0eaf80c4bb Template: replace None values with empty string
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-16 10:28:54 +00:00
JoeLametta
dedd38f029 Ignore leading / trailing slashes in template
Fixes #530.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-14 16:08:58 +00:00
JoeLametta
5040bc9094 Fix stupid syntax error in previous commit
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-14 11:34:29 +00:00
JoeLametta
6577b7f262 Hopefully fix test failures introduced with previous commit
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-14 11:25:41 +00:00
JoeLametta
7e30e7c952 Apply PathFilter's filters to all the template's components
Fixes #513.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2021-05-14 10:33:38 +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
Peter Taylor
4fb9d99ddd Add missing 'Album Artist' tag when its value is 'Various Artists'
Fixes #518.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-12-25 14:30:00 +00:00
JoeLametta
c229c01a58 Replace 'freedb.dbpoweramp.com' CDDB server with gnudb.org
It seems gnudb.org allows submissions too while 'freedb.dbpoweramp.com' is read only.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-11-28 17:44:21 +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
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
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
bbf1eba0e4 Replace 'freedb.freedb.org' CDDB server with a mirror
This is motivated by the imminent shut down of freedb.org which will happen on 2020-03-31.

More details here: https://web.archive.org/web/20200331093822/http://www.freedb.org/
And here: https://hydrogenaud.io/index.php?topic=118682

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-03-31 13:22:21 +00:00
JoeLametta
4dc02ec12e Rewrite PathFilter
Added filter options:
- dot (replace leading dot with _)
- posix (replace illegal chars in *nix OSes with _)
- vfat (replace illegal chars in VFAT filesystems with _)
- whitespace (replace all whitespace chars with _)
- printable (replace all non printable ASCII chars with _)

Removed filter options:
- fat (replaced with vfat)
- special

Fixes #313.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-22 18:01:20 +00:00
JoeLametta
e56c636fd3 Improve docstrings
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-02-22 15:11:22 +00:00
JoeLametta
9e63915f65 Display release country in matching releases
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>
2020-02-04 16:36:02 +01:00
JoeLametta
087a53a7d0 Merge pull request #444 from ABCbum/add-alternative-tagging
Add PERFORMER & COMPOSER metadata tags to audio tracks (if available)
2020-01-29 10:01:27 +01:00
Kevin Locke
b6607c6573 Fix cover file saving with /tmp on different FS
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>
2020-01-26 17:37:11 -07:00
ABCbum
5cd96da6cb Extend whipper's tagging ability
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>
2020-01-15 13:13:53 +07: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
35201d5290 Address errors, improvements, formatting
- Removed unused code not portable due to buffer() use
- raw_input() does not exist in Python 3
- Fixed octal constant syntax for Python 3
- Fixed TypeError
- Replace if not exists: makedirs(path) with single call: using makedirs(path, exist_ok=True)
- Class inherits from object, can be safely removed from bases in python3: pylint's useless-object-inheritance (W0235) check

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-26 18:46:12 +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
2e966a446d Pass toc_path as argument in program.py
Resolves #368.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-10-21 14:00:00 +00:00
Andreas Oberritter
342bce9be2 Make getFastToc() fast again.
Broken since #345 was merged.

Signed-off-by: Andreas Oberritter <obi@saftware.de>
2019-10-20 15:25:17 +02:00
JoeLametta
69f8f39c49 Change documentation from epydoc to reStructuredText
Thanks to Freso for all the useful comments!

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-05-03 20:06:13 +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
JoeLametta
8d4f818754 Fix critical regressions introduced in 3e79032 and 16b0d8d
Fixes #369.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-02-19 15:42:32 +01:00
Frederik “Freso” S. Olesen
6abd120e4a Fix calls to cdrdao.ReadTOCTask()
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-14 00:49:02 +01: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
364f024c08 Add Work MBIDs to ripped files
See https://musicbrainz.org/doc/Work

Third and final and thus closes https://github.com/whipper-team/whipper/issues/200

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 21:01:57 +01:00