Package: sacad
SACADSmart Automatic Cover Art DownloaderSACAD is a multi platform command line tool to download album covers without manual intervention, ideal for integration in scripts, audio players, etc.SACAD also provides a second 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.FeaturesCan target specific image size, and find results for high resolution coversSupport JPEG and PNG formatsCustomizable output: save image along with the audio files / in a different directory named by artist/album / embed cover in audio files...Currently support the following cover sources:Amazon CD (.com, .ca, .cn, .fr, .de, .co.jp and .co.uk variants)Amazon digital musicCoverLib(site is dead)DeezerDiscogsGoogle Images(removed, too unreliable)Last.fmItunesSmart 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, oxipng or jpegoptim (can save 30% of filesize without any loss of quality, great for portable players)Cache search results locally for faster future searchDo everything to avoid getting blocked by the sources: hide user-agent and automatically take care of rate limitingAutomatically convert/resize image if neededMultiplatform (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 changesWhen 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 headerProcess several queries simultaneously (usingasyncio), to speed up processingAutomatically reuse TCP connections (HTTP Keep-Alive), for better network performanceAutomatically retry failed HTTP requestsMusic 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 accordinglyInstallationSACAD requiresPython>= 3.7.Standalone Windows executableWindows users can download astandalone binarywhich does not require Python.Arch LinuxArch Linux users can install thesacadAUR package.From PyPI (with PIP)If you don't already have it,install pipfor Python 3Install SACAD:pip3 install sacadFrom sourceIf you don't already have it,install setuptoolsfor Python 3Clone this repository:git clone https://github.com/desbma/sacadInstall SACAD:python3 setup.py installOptionalAdditionally, if you want to benefit from image crunching (lossless recompression to save additional space):InstalloxipngoroptipngInstalljpegoptimOn Ubuntu and other Debian derivatives, you can install them withsudo 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 with optipng).Command line usageTwo tools are provided:sacadto search and download one cover, andsacad_rto scan a music library and download all missing covers.Runsacad -h/sacad_r -hto get full command line reference.ExamplesTo download the cover ofMaster of PuppetsfromMetallica, to the fileAlbumArt.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.LimitationsOnly supports front coversAdding cover sourcesAdding a new cover source is very easy if you are a Python developer, you need to inherit theCoverSourceclass 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.LicenseMozilla Public License Version 2.0