Commit Graph

206 Commits

Author SHA1 Message Date
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
JoeLametta
b2d06645af Address Freso's comment
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
JoeLametta
8e60fb9a18 Merge pull request #415 from itismadness/ruamel_yaml
Use ruamel.yaml for formatting and outputting rip .log file
2019-10-27 09:11:49 +01: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
itismadness
862afffee9 Use ruamel.yaml for formatting rip .log file
- insert newlines after blocks of content
- strip quotes around creation time and offset
- Change offset value representation
- Clarify logger regular expressions
- Fix missing AccurateRip Summary field
- Read usage of time.gmtime(epoch) for generating datetime string
- fix missing dependency in travis
- install pycdio with specific version separately

Signed-off-by: itismadness <itismadness@users.noreply.github.com>
2019-10-27 08:00:00 +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
JoeLametta
87a477a5d6 Fix wrong logger call
Introduced in 048a31e348.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-10-26 08:00:00 +00:00
JoeLametta
4569644335 Separate out Release in log into two value map
This allows log parsers to always extract correct information about the "artist" and "title" fields: previously that was a problem if either (or both) of those fields contained a "-" character.

Fixes #416.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-10-22 07:00:00 +00:00
JoeLametta
8b6b2d34fe Merge pull request #418 from mtdcr/fix-less-than-ten
Fix ripping discs with less than ten tracks
2019-10-21 17:40:18 +02: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
JoeLametta
1be5adda65 Merge pull request #407 from whipper-team/bugfix/issue-284-flac-file-permissions
Set FLAC files permissions to 0644
2019-10-21 16:32:13 +02:00
JoeLametta
fe13affac2 Merge pull request #409 from whipper-team/bugfix/issue-361-drive-analysis-fails
Fix erroneous result message for whipper drive analyze
2019-10-21 16:30:03 +02:00
JoeLametta
14fb96e87c Merge pull request #408 from whipper-team/bugfix/issue-354-eliminate-eject-warning
Report eject's failures as logger warnings
2019-10-21 16:26:58 +02:00
Andreas Oberritter
abf9a971e7 Fix ripping discs with less than ten tracks
Output lines of cdrdao for single digit track numbers start with a
whitespace character.

Broken since #345 was merged.

Signed-off-by: Andreas Oberritter <obi@saftware.de>
2019-10-20 15:41:33 +02: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
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
JoeLametta
635113be9a Fix incorrect frames to MSF conversion
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-08-19 12:00:00 +00:00
JoeLametta
1c6fe42202 Set FLAC files permissions to 0644
Fixes #284.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-07-07 12:00:00 +00:00
JoeLametta
e5961ae04c Report eject's failures as logger warnings
If the eject command exits with an error, the output is logged as a WARNING. I don't think it's a good idea to mask those errors.

Closes #354.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-07-07 12:00:00 +00:00
JoeLametta
048a31e348 Fix erroneous result message for whipper drive analyze
If cdparanoia fails to analyze the drive, the drive is now marked as unable to defeat the cache.

Fixes #361.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-07-07 10:00:00 +00:00
JoeLametta
57d386e82f Remove too verbose logger statements
Related to #278.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-07-07 10:00:00 +00:00
it is madness
0d69258654 Use YAML 1.2 boolean values for booleans
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-07-06 16:00:00 +00:00
JoeLametta
b5f0af21be Merge pull request #406 from vmx/fix-offset-find
Fix offset find command
2019-07-05 11:18:49 +02:00
JoeLametta
4eeb0cddc7 Update failing AccurateRipResponse tests 2019-07-05 08:00:00 +00: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
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
JoeLametta
bb78dc109d Merge pull request #387 from whipper-team/feature/issue-383-restructuredtext
Convert documentation from epydoc to reStructuredText
2019-05-03 20:11:09 +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
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
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
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
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
885ad172a8 Set release type to empty string if none is given
Fixes https://github.com/whipper-team/whipper/issues/396

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-05-02 18:37:51 +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
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
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
JoeLametta
79cb5ef68f Merge pull request #367 from whipper-team/feature/use-multivalue-artistid-tags
Handle artist MBIDs as multivalue tags
2019-02-15 18:44:12 +01:00
Frederik “Freso” S. Olesen
af748c55b7 Use git to get whipper's version
This essentially a copy of code from spotify2musicbrainz:
59157165c4

Given that that code is in GPLv3 (and I'm its author :)), it should be
fine to use. It is mostly boilerplate from upstream documentation
anyway: https://pypi.org/project/setuptools-scm/

Should fix https://github.com/whipper-team/whipper/issues/337

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-02-14 11:55:21 +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