Commit Graph

90 Commits

Author SHA1 Message Date
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
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
036fd82096 Make tests more robust by mocking AccurateRip responses
Signed-off-by: Katharina Dröge <kate@commandmc.de>
2025-09-24 17:52:47 +02:00
Alicia Boya García
4719c74f65 New TOC CD-TEXT string decoding
This patch replaces the previous broken approach to TOC string decoding
that used `.encode().decode('unicode_escape')` with proper parsing of
the escape sequences cdrdao is known to generate.

The new parser is also lenient with invalid escape sequences, that can
occur due to improper escaping in cdrdao. See:
https://github.com/cdrdao/cdrdao/issues/32

Latin-1:

This new parsing method should work for Latin-1 strings for both old and
new versions of cdrdao, as long as those strings don't trigger the
improper escaping issues in upstream cdrdao.

This has been verified with the album Diorama from the Danish black
metal band MØL.

MS-JIS:

This new parsing method should also work for MS-JIS strings as long as
the .toc file was generated by cdrdao 1.2.5+ and the strings don't
trigger improper escaping issues in upstream cdrdao.

Unfortunately, I don't have any CD with CD-Text in MS-JIS, so I could
not verify this.

cdrdao versions before 1.2.5 will still cause whipper to produce
mojibake (garbled characters) when reading MS-JIS CD-Text, as those
versions do not encode strings in UTF-8.

Other encodings:

As far as I know, CD-Text only supports officially ASCII, Latin-1 and
MS-JIS, but I wouldn't be surprised if there are unofficial encodings
out there, given the strange strings I've seen in some bug reports.

If you have a CD with garbled CD-Text, please submit a bug report
indicating the performer, album name, language and attach the .toc file
so that the produced strings can be compared to the expected text.

Fixes https://github.com/whipper-team/whipper/issues/169

Signed-off-by: Alicia Boya García <ntrrgc@gmail.com>
2024-08-27 12:19:29 +02:00
Martin Weinelt
e0942417a1 Use custom YAML subclass to be compatible with ruamel_yaml>=0.17
Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2021-07-04 16:53:09 +02: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
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
Matthew Peveler
a8942a8037 Update test_result_logger.log
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
2020-09-24 03:58:32 -04: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
bbed92bb30 Update failing AccurateRipResponse tests
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-08-10 16:39:55 +02:00
JoeLametta
752162a434 Fix two flake8 errors
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-05-29 14:03:27 +00: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
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
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
56f2b1d5f5 Merge pull request #456 from ABCbum/add-version-test
Test all four cases of whipper version scheme
2020-01-29 09:51:43 +01:00
ABCbum
f59caeae7b Test all four cases of whipper version schemes
Group different version schemes with the actual one generated from the logger in a list to avoid parsing a whole .log file.
The four possible cases are documented here: https://github.com/pypa/setuptools_scm/#default-versioning-scheme.

Fixes: #427.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2020-01-29 08:45:07 +00:00
JoeLametta
b39345e1f0 Use shutil.move() instead of os.replace/rename
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-28 21:50:27 +00:00
ABCbum
0daf0158b8 Test: verify that MusicBrainz lookup URL defaults to https
Applies to a default configuration (no custom MusicBrainz server specified).

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-17 15:23:11 +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
ABCbum
b79236ee11 Add test to check _getPerformers and _getComposers
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:16:16 +07: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
97ffd0fe4d Add test case when data track is first track
Using existing TOCs, create a new test case to verify discid generated
when data track is not at the end of the disc track-list.

Quality of test is not verified.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-28 12:42:26 +00:00
ABCbum
bb66a092cd Add test case to new mblookup functionality
A new test case to check for mblookup's ability to search
for data based on release id is created along with a function
mocks getReleaseMetadata using an existing JSON file.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-19 08:56:00 +00:00
ABCbum
31d589b00d Enable whipper to use track title (#430)
* Enable whipper to use track title if possible

track.title = t.get('title', t['recording']['title']).

Since if a track itself doesn't have a title then the track
title is the same with the recording title. Otherwise, a track
has its own title then t['title'] is different from
t['recording']['title'] and whipper chooses t['title'].

[Fixes #192]
Signed-off-by: ABCbum <kimlong221002@gmail.com>

* Add test case to check for track title

Using an existing JSON release file

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-13 18:43:48 +01:00
JoeLametta
d5bf83e4cc Whipper's version RegEX: support all valid scheme cases
Initial work by ArchangeGabriel: https://github.com/whipper-team/whipper/pull/421

Fixes #420.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-03 10:53:05 +00:00
JoeLametta
bb4c25df97 Address ResourceWarning warnings
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-26 18:48:01 +00:00
JoeLametta
fff3014e15 Address test failures
More details about the fix to the testDuration failure (regression):

```
FAIL: testDuration (whipper.test.test_image_toc.CapitalMergeTestCase)
testDuration
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
    result = f(*args, **kw)
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/utils.py", line 221, in runWithWarningsSuppressed
    reraise(exc_info[1], exc_info[2])
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/python/compat.py", line 464, in reraise
    raise exception.with_traceback(traceback)
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/utils.py", line 217, in runWithWarningsSuppressed
    result = f(*a, **kw)
  File "/home/travis/build/whipper-team/whipper/whipper/test/test_image_toc.py", line 271, in testDuration
    self.assertEqual(self.table.getFrameLength(), 173530)
  File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/trial/_synctest.py", line 432, in assertEqual
    super(_Assertions, self).assertEqual(first, second, msg)
  File "/opt/python/3.5.6/lib/python3.5/unittest/case.py", line 829, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/opt/python/3.5.6/lib/python3.5/unittest/case.py", line 822, in _baseAssertEqual
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: 184930 != 173530
```

The test fails because if either nextTrack.session or thisTrack.session are None the if is false and the instructions inside it aren't executed. The check for None is needed because Python 3 doesn't allow NoneType comparisons (in Python 2 that was possible).
IIRC correctly in that test nextTrack.session has value 2 while thisTrack.session is None. That means the Python 2 version evaluates the if condition to true, while the Python 3 version in the first commit does not.
With this change both of the values of nextTrack.session and thisTrack.session are compared as int (if None, the value 1 is used for the comparison - as in disc session 1).

Regression introduced in 64dd9d843a.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-26 18:47:54 +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
f740a0ef0d Add missing backslash to RegEX
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-01 09:26:42 +00:00
itismadness
3cd2da79c3 write unit test case for WhipperLogger
Signed-off-by: itismadness <itismadness@users.noreply.github.com>
2019-10-27 08:00:00 +00:00
JoeLametta
4eeb0cddc7 Update failing AccurateRipResponse tests 2019-07-05 08:00:00 +00:00
Thomas Vander Stichele
7a4680f285 Add testcase for Gentlemen: same CDDB ID as Interpol
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-05-09 09:46:28 +02:00
Frederik “Freso” S. Olesen
bf8daf186d mbngs: Let releaseType be None if no type is set
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-05-03 02:49:42 +02:00
Frederik “Freso” S. Olesen
c2459067ce Test mblookup output when release type is missing
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-05-03 02:38:38 +02:00
Frederik “Freso” S. Olesen
8209927a79 Add testcase for failure when missing release type
See https://github.com/whipper-team/whipper/issues/396

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-05-02 18:35:42 +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
14aa8b7f7c Handle artist MBIDs as multivalue tags
Instead of joining artist MBIDs with a ';' save them as multiple values
to the tag. (This is how Picard saves that tag.)

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 22:59:58 +01:00
Frederik “Freso” S. Olesen
42e7a77645 Remove unused argument for ….mbngs._getMetadata()
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 22:07:59 +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
Frederik “Freso” S. Olesen
266a272e3c Add testcase to check all release and track metadata
Before this bits and pieces of release and track metadata would be
tested in the other test cases, but no test cases included all of them.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 19:55:37 +01:00
Frederik “Freso” S. Olesen
c963b0173b Add Release Group MBIDs to ripped files
See https://musicbrainz.org/doc/Release_Group

Second part of https://github.com/whipper-team/whipper/issues/200

(MusicBrainz JSON test data dumps needed to be refreshed due to the
new `includes` in the MusicBrainz web service call.)

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 19:03:15 +01:00
Frederik “Freso” S. Olesen
41b1b1feff Add Track MBIDs to ripped files
See https://musicbrainz.org/doc/Track

First part of https://github.com/whipper-team/whipper/issues/200

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 18:59:11 +01:00
Frederik “Freso” S. Olesen
fce00f492e Change release used for testing [unknown] artist credits
The previously used release has since had its [unknown] artist credit
resolved since the data was originally taken from MusicBrainz.

Using data from this release now:
https://musicbrainz.org/release/8478d4da-0cda-4e46-ae8c-1eeacfa5cf37
Specifically:
https://musicbrainz.org/track/a04ee451-46c3-3ad6-a815-d7bb8449d605

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 18:35:48 +01:00
Frederik “Freso” S. Olesen
6d3f44ba96 Change release used for testing missing release date
The previous release has gotten a release date added since it was
originally dumped from MusicBrainz.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 18:35:28 +01:00
Frederik “Freso” S. Olesen
a08bbeea6a Refresh MusicBrainz JSON dumps used for testing
Some of these dumps predate when MusicBrainz had (re)introduced track
MBIDs, so some tests for the code for issue #200 would fail since the
JSON dumps didn't contain those IDs.

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-13 16:47:01 +01:00
JoeLametta
cf923cc9cc Review existing comments and add new ones
Also clarified a statement
2019-02-02 19:19:50 +01:00