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>
This commit is contained in:
ABCbum
2019-12-23 23:03:49 +07:00
committed by JoeLametta
parent 150f0d5e91
commit f61214a238
4 changed files with 135 additions and 6 deletions

View File

@@ -427,7 +427,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
_tmppath = None
def __init__(self, path, table, start, stop, overread, offset=0,
device=None, taglist=None, what="track"):
device=None, taglist=None, what="track", coverArtPath=None):
"""
:param path: where to store the ripped track
:type path: str
@@ -493,8 +493,9 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
self.tasks.append(checksum.CRC32Task(tmppath))
self.tasks.append(encode.SoxPeakTask(tmppath))
# TODO: Move tagging outside of cdparanoia
# TODO: Move tagging and embed picture outside of cdparanoia
self.tasks.append(encode.TaggingTask(tmpoutpath, taglist))
self.tasks.append(encode.EmbedPictureTask(tmpoutpath, coverArtPath))
self.checksum = None