Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rstemmer committed Jan 11, 2020
1 parent 5270f9a commit 8b7d1b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions mdbapi/artwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 8 additions & 9 deletions mod/artwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8b7d1b7

Please sign in to comment.