Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Search and download music album covers

Project Description

Smart Automatic Cover Art Downloader

PyPI version AUR version Tests status Coverage Lines of code Supported Python versions License

SACAD is a multi platform command line tool to download album covers without manual intervention, ideal for integration in scripts, audio players, etc.

Since version 1.6, SACAD also provides a new command line tool, ``sacad_r``, to scan a music library, read metadata from audio tags, and download missing covers automatically, optionally embedding the image into audio audio files (since version 1.9).

Since version 2.0, SACAD has been rewritten to use the `asyncio <https://docs.python.org/3/library/asyncio.html>`__ framework, which typically results in ~40% faster processing for ``sacad`` and 600-700% faster (yes, 6-7x faster!) for ``sacad_r``.

Features

  • Can target specific image size, and find results for high resolution covers
  • Support JPEG and PNG formats
  • Currently support the following cover sources:
    • Last.fm
    • Google Images
    • [STRIKEOUT:CoverLib] (site is down)
    • Amazon CD (.com, .ca, .cn, .fr, .de, .co.jp and .co.uk variants)
    • Amazon digital music
  • Smart sorting algorithm to select THE best cover for a given query, using several factors: source reliability, image format, image size, image similarity with reference cover, etc.
  • Automatically crunch images with optipng or jpegoptim (can save 30% of filesize without any loss of quality, great for portable players)
  • Cache search results locally for faster future search
  • Do everything to avoid getting blocked by the sources: hide user-agent and automatically take care of rate limiting
  • Automatically convert/resize image if needed
  • Multiplatform (Windows/Mac/Linux)

SACAD is designed to be robust and be executed in batch of thousands of queries:

  • HTML parsing is done without regex but with the LXML library, which is faster, and more robust to page changes
  • When the size of an image reported by a source is not reliable (ie. Google Images), automatically download the first KB of the file to get its real size from the file header
  • Process several queries simultaneously (using asyncio), to speed up processing
  • Automatically reuse TCP connections (HTTP Keep-Alive), for better performance
  • Automatically retry failed HTTP requests
  • Music library scan supports all common audio formats (MP3, AAC, Vorbis, FLAC..)
  • Cover sources page or API changes are quickly detected, thanks to high test coverage, and SACAD is quickly updated accordingly

Installation

SACAD requires Python >= 3.5.

Standalone Windows executable

Windows users can download a standalone binary which does not require Python.

Arch Linux

Arch Linux users can install the sacad AUR package.

From PyPI (with PIP)

  1. If you don’t already have it, install pip for Python 3
  2. Install SACAD: pip3 install sacad

From source

  1. If you don’t already have it, install setuptools for Python 3
  2. Clone this repository: git clone https://github.com/desbma/sacad
  3. Install SACAD: python3 setup.py install

Optional

Additionnaly, if you want to benefit from image crunching (lossless recompression to save additional space):

On Ubuntu and other Debian derivatives, you can install both with sudo apt-get install optipng jpegoptim.

Note that depending of the speed of your CPU, crunching may significantly slow down processing as it is very CPU intensive (especially for PNG files).

Command line usage

Two tools are provided: sacad to search and download one cover, and sacad_r to scan a music library and download all missing covers.

Run sacad -h / sacad_r -h to get full command line reference.

Examples

To download the cover of Master of Puppets from Metallica, to the file AlbumArt.jpg, targetting ~ 600x600 pixel resolution: sacad "metallica" "master of puppets" 600 AlbumArt.jpg.

To download covers for your library with the same parameters as previous example: sacad_r library_directory 600 AlbumArt.jpg.

Limitations

  • Only supports front covers

Adding cover sources

Adding a new cover source is very easy if you are a Python developer, you need to inherit the CoverSource class and implement the following methods:

  • getSearchUrl(self, album, artist)
  • parseResults(self, api_data)
  • updateHttpHeaders(self, headers) (optional)

See comments in the code for more information.

Release history Release notifications

This version
History Node

2.1.1

History Node

2.1.0

History Node

2.0.6

History Node

2.0.5

History Node

2.0.4

History Node

2.0.3

History Node

2.0.2

History Node

2.0.1

History Node

2.0.0

History Node

1.9.0

History Node

1.8.4

History Node

1.8.3

History Node

1.8.2

History Node

1.8.1

History Node

1.8.0

History Node

1.7.3

History Node

1.7.2

History Node

1.7.1

History Node

1.7.0

History Node

1.6.10

History Node

1.6.9

History Node

1.6.7

History Node

1.6.6

History Node

1.6.5

History Node

1.6.4

History Node

1.6.3

History Node

1.6.2

History Node

1.6.1

History Node

1.6.0

History Node

1.5.0

History Node

1.4.6

History Node

1.4.5

History Node

1.4.4

History Node

1.4.3

History Node

1.4.2

History Node

1.4.1

History Node

1.4.0

History Node

1.3.6

History Node

1.3.5

History Node

1.3.4

History Node

1.3.3

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.5

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.1

History Node

1.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
sacad-2.1.1.tar.gz (32.3 kB) Copy SHA256 hash SHA256 Source None Apr 22, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page