From 8b7d1b7f34482edb6bce5b8d07ff7f0a0357f93f Mon Sep 17 00:00:00 2001 From: Ralf Stemmer Date: Sat, 11 Jan 2020 16:17:00 +0100 Subject: [PATCH] minor improvements --- mdbapi/artwork.py | 1 + mod/artwork.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mdbapi/artwork.py b/mdbapi/artwork.py index df43ad67..5be179e5 100644 --- a/mdbapi/artwork.py +++ b/mdbapi/artwork.py @@ -332,6 +332,7 @@ def UpdateAlbumArtwork(self, album, artworkpath=None): artworkpath = None # Set new artwork + logging.info("Updating artwork for album \"%s\" to \"%s\" at \"%s\".", album["name"], imagename, artworkpath) retval = self.SetArtwork(album["id"], artworkpath, imagename) return retval diff --git a/mod/artwork.py b/mod/artwork.py index f11e9711..d417138f 100644 --- a/mod/artwork.py +++ b/mod/artwork.py @@ -52,6 +52,10 @@ .. code-block:: bash musicdb artwork --artwork $Artworkpath --album $Albumpath -u + + # For example: + wget -O ~/tmp.jpg https://some.url/artworks?id=37693cfc748049e45d87b8c7d8b9aacd + musicdb artwork -u --album /data/music/Lindemann/2019\ -\ F\ \&\ M\ \(Deluxe\) --artwork ~/tmp.jpg """ import argparse @@ -122,15 +126,10 @@ def UpdateAlbum(self, albumpath, artworkpath=None): print("\033[1;31mInvalid albumpath: \"%s\". \033[0;31m(No album with this path in database.)\033[0m" % (albumpath)) return False - if not artworkpath: - self.UpdateAlbumArtwork(album) - else: - artist = self.db.GetArtistById(album["artistid"]) - imagename = self.CreateArtworkName(artist["name"], album["name"]) - retval = self.SetArtwork(album["id"], artworkpath, imagename) - if retval == False: - print("\033[1;31mSetting artwork failed!\033[0m") - return False + retval = self.UpdateAlbumArtwork(album, artworkpath) + if retval == False: + print("\033[1;31mSetting artwork failed!\033[0m") + return False return True