Commit Graph

1492 Commits

Author SHA1 Message Date
Martin Paul Eve
3a1663dd15 Update docker instructions to use --bind instead of -v. (#454)
* Update docker instructions to use --bind instead of -v.

This is the better and approved option now as `-v` will yield permission errors on some systems.

Signed-off-by: Martin Paul Eve <martin@martineve.com>

* Add requirement for directories to exist

Signed-off-by: Martin Paul Eve <martin@martineve.com>
2020-01-29 12:39:56 +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
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
5eac141b53 README: replace 'pip' commands with 'pip3'
Whipper is Python 3 only since version 0.9.0.

Related to #457.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-29 08:38:13 +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
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
ee11fac1da Merge pull request #458 from kevinoid/fix-cover-tmp-fs
Fix cover file saving with /tmp on different FS
2020-01-28 17:31:09 +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
JoeLametta
553a6de88f Fix typo in README and clarify Docker instructions
Fixes #452.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-17 15:42:06 +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
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
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
JoeLametta
9e37219401 Merge pull request #436 from ABCbum/grab-cover-art
Grab cover art from MusicBrainz/Cover Art Archive and add it to the resulting whipper rips
2020-01-14 17:04:53 +01: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
8181cacca5 Update README, dependencies and supporting files for cover art feature
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
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
6a43d7df1a Update copyright year in README
Misc README changes too.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-10 18:10:12 +00:00
JoeLametta
150f0d5e91 Move inline comment to separate line in example whipper config file
This avoids `%` character interpolation leading to `InterpolationSyntaxError`.
Added a comment explaining this too.

Fixes #443.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2020-01-04 15:35:32 +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
JoeLametta
d665fe44c4 Fix single wrong line order in README
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-29 15:14:24 +00:00
JoeLametta
25104145f0 Merge pull request #435 from ABCbum/develop
Fix whipper's MusicBrainz Disc ID calculation for CDs with data tracks that are not positioned at the end of the disc
2019-12-28 13:56:14 +01:00
ABCbum
8c41f4ddb3 Update whipper's dependencies
whipper now requires `discid` package - which can be installed through
pip and `discid` relies on libdiscid.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-28 12:42:26 +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
a113404c33 Replace whipper's disc id calculation with discid
Since whipper's own "musicbrainz id calculation" fails on CDs with data
tracks on special places, the disc id calculation code is replaced with
libdiscid.

Gives a new way to calculate disc leadout or sectors (last sector of last
audio track) depends on whether the data track is placed last or not.

`discid` requires `len(track_offsets) != last - first + 1`.Which means
there can be only one data track in the disc and the lastTrack number is
deceptive.

For example: a disc (data audio audio audio) has firstTrack=1 lastTrack=3
which is wrong since according to the discid code :
    "last **audio** track as :obj:`int"
it should be 4 but the firstTrack is always 1.

The code is duplicated with _getMusicBrainzValues function.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-28 12:42:26 +00:00
JoeLametta
8f5559ebc8 Merge pull request #432 from ABCbum/develop
Allow whipper's mblookup command to look up information based on Release MBID
2019-12-19 10:01:10 +01: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
78c91fd1c7 Add new functionality and refactor code
In order to make mblookup command able to lookup data based
on release id, new function getReleaseMetadata is created.
To remove duplicated code, importing and set_useragent is moved
to the top of the file.
Now _getMetadata behaves differently when the discid is not
specified.

Signed-off-by: ABCbum <kimlong221002@gmail.com>
2019-12-19 08:55:54 +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
9e95f0604f Merge pull request #434 from Freso/issue-431-broken-drive-analyze
Fix failed() task of AnalyzeTask (program/cdparanoia)
2019-12-15 16:55:10 +01:00
Merlijn Wajer
29ee670b7f program/cdparanoia: fix failed() task of AnalyzeTask
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-15 15:48:30 +00:00
Frederik “Freso” S. Olesen
4234c8fe8e Test against Python versions 3.6, 3.7, and 3.8
https://github.com/whipper-team/whipper/pull/433
2019-12-15 01:09:46 +01:00
Frederik “Freso” S. Olesen
7ad4265b18 Only run linting tests for one Python version
This creates a specific job with the `FLAKE8` variable set, rather than
a setting up a 4×2 matrix. This means we create a total of 5 jobs now
rather than 8 jobs.

Part of https://github.com/whipper-team/whipper/pull/433

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-12-15 01:06:05 +01:00
Frederik “Freso” S. Olesen
eca3be017a Test against Python versions 3.6, 3.7, and 3.8
Right now tests are only run against Python 3.5, but we claim we support
Python 3.5+ so let’s run our tests against both Python 3.5 and all later
(stable) versions.

PR: https://github.com/whipper-team/whipper/pull/433

Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
2019-12-15 00:57:37 +01: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
6e3e21f9d5 Merge branch 'master' into develop 2019-12-04 14:46:22 +01:00
JoeLametta
b1718a2a68 Merge branch 'develop' 2019-12-04 13:29:08 +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
JoeLametta
bc31b98b32 Fix offsets.py output
Every line, except the last one, of the output was missing a double quote character at the end.

Additional changes:
- Specify parser to avoid BeautifulSoup warning
- Use single quotes only

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-04 13:14:24 +00: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
Merlijn Wajer
47c62a9990 Fix regression introduced in Python 3 port
Fixes #424.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-12-03 10:39:46 +00:00
JoeLametta
bbd28c668f Reduce Docker image size
- Removed useless apt cache from layer 3
- Avoid installing apt recommended packages

The compressed image now weights 67 MB less (≈ -30% size).

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-27 22:05:36 +00:00
JoeLametta
d0efd74162 Merge pull request #411 from ddevault/py3
Python 3 port

From now on whipper's codebase will be compatible only with Python 3.
NOTE: This pull request introduces a regression: more details in #424.

Special thanks to @ddevault for kickstarting the porting effort!
2019-11-26 19:59:42 +01:00
JoeLametta
50c8cbb237 Update README, .travis.yml and Dockerfile for Python 3
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-26 18:48:01 +00:00
JoeLametta
42019ce85f Port (misc) offsets script to Python 3
I've also changed the output format a bit.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
2019-11-26 18:48:01 +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